Skip to content

fix(runner): steered sessions keep their workspace mount (pre-existing) - #5764

Merged
mmabrouk merged 2 commits into
release/v0.110.0from
agent-config-editing-s9-steer-mount
Aug 7, 2026
Merged

fix(runner): steered sessions keep their workspace mount (pre-existing)#5764
mmabrouk merged 2 commits into
release/v0.110.0from
agent-config-editing-s9-steer-mount

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Aug 5, 2026

Copy link
Copy Markdown
Member

Context

A steered session died on its next turn. Start a long turn, send a second message mid-flight (the steer path), and the third turn on that session failed with Internal error: Path /tmp/agenta/mounts/<id> does not exist. The session stayed broken until its pool entry aged out.

This bug predates the agent-config-editing stack: the identical repro fails against a git archive extraction of release/v0.109.0, and a variant where the displaced turn aborts promptly (as it would after the separate API-side heartbeat fix) still fails. The E2E campaign for the stack found it; the stack did not cause it.

What was broken

A cold turn was invisible to the keep-alive pool while it ran; nothing was inserted until park, after the turn returned. A steer therefore found no pool entry and cold-acquired a second environment for the same session. Both derive the same durable working directory, and mounting is idempotent, so the second adopted the first's live mount. Whichever environment tore down first unmounted and deleted the shared directory under the other. The next turn took the warm path, which never re-mounts, and crashed.

Changes

Two halves, independently tested:

  • A running cold turn now occupies its pool slot: SessionPool.reserve() seats the environment as busy before the turn runs, and the park converts the reservation (or an identity-checked evict removes it). A concurrent same-session request then takes the existing supersede branch, which completes the old teardown before the new acquire mounts. The reservation is refusable so the pool's capacity bound holds; on refusal the turn runs unreserved, exactly as before.
  • Warm reuse now probes the parked environment's mount for liveness (on both the idle and the approval-resume branches; an approval park holds its environment far longer). A dead mount becomes a mismatch, evicts, and rebuilds cold, which re-mounts. The probe fails open: a probe error reuses rather than sacrificing warm reuse to a flaky check.

Log-visible changes: a steer now logs evict (supersede-busy) instead of miss, and tears the displaced turn's sandbox down mid-flight rather than letting it finish beside the new one. New lines: reserve, evict reason=pre-acquire, mismatch (mount-lost), and mount-probe threw, reusing.

Tests / notes

  • 14 new tests in session-steer-mount-loss.test.ts, including the exact production sequence and the approval-park variant. Each half bite-verified independently (reverting the reservation fails 4, the idle probe 1, the approval probe 1, the pre-acquire claim 1).
  • Full runner suite on this tree: 116 files, 1959 tests, 0 failures; typecheck clean.
  • The API-side half of the steer story (a displaced turn's heartbeat keeps is_current_turn) is a separate bug with its own repro and is not addressed here.

Part of the agent-config-editing stack; targets its stack parent. Reading order bottom up.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 7, 2026 10:18am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ddb60e23-36d8-446b-b03f-16072e1b4aa4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from d75f18b to 00e5676 Compare August 5, 2026 21:55
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 4f2bab2 to 9c35216 Compare August 5, 2026 21:56
@mmabrouk

mmabrouk commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 00e5676 to 9ef9f89 Compare August 6, 2026 10:32
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 9c35216 to 7b34b97 Compare August 6, 2026 10:33
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 9ef9f89 to 4c14e5b Compare August 6, 2026 10:51
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 7b34b97 to f86d545 Compare August 6, 2026 10:52
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 4c14e5b to 1544505 Compare August 6, 2026 11:17
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from f86d545 to 5dce002 Compare August 6, 2026 11:18
@mmabrouk
mmabrouk marked this pull request as ready for review August 6, 2026 12:30
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. Bug Report Something isn't working labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-5764.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-5764-d4099ec
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-07T10:29:03.426Z

@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 1544505 to efe200e Compare August 6, 2026 12:46
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 5dce002 to fddcfe3 Compare August 6, 2026 12:47
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from efe200e to fcdfb61 Compare August 6, 2026 12:57
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from fddcfe3 to cb05287 Compare August 6, 2026 12:58
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from fcdfb61 to d9d6f52 Compare August 6, 2026 13:08
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from cb05287 to 4db68c4 Compare August 6, 2026 13:09
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 0433b89 to 33936a4 Compare August 6, 2026 14:50
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 803ae6d to e44019a Compare August 6, 2026 15:04
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 33936a4 to 05731be Compare August 6, 2026 15:05
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from e44019a to c19ceaf Compare August 6, 2026 15:10
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 05731be to 9d9e45e Compare August 6, 2026 15:11
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from c19ceaf to d7dac02 Compare August 6, 2026 15:19
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 9d9e45e to a328742 Compare August 6, 2026 15:20
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from d7dac02 to 1d88425 Compare August 6, 2026 15:27
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from a328742 to 1546c09 Compare August 6, 2026 15:27
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 1d88425 to ae7c8c3 Compare August 6, 2026 15:49
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 1546c09 to 3c66e23 Compare August 6, 2026 15:50
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from ae7c8c3 to edc00ec Compare August 6, 2026 15:57
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 3c66e23 to ca2d1ec Compare August 6, 2026 15:58
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from edc00ec to 7b33b41 Compare August 6, 2026 16:06
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from ca2d1ec to 5c6d5e6 Compare August 6, 2026 16:07

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Aug 6, 2026
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s3b-wire-web branch from 7b33b41 to 8df7d62 Compare August 6, 2026 16:16
@mmabrouk
mmabrouk force-pushed the agent-config-editing-s9-steer-mount branch from 5c6d5e6 to e8c48d8 Compare August 6, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Report Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant