Skip to content

fix: keep the shell-exit delta baseline across host rebuilds - #1212

Draft
gominimal-aw-bot[bot] wants to merge 1 commit into
mainfrom
inbox-patch/persist-session-delta-baseline-70e98debcaa0382f
Draft

fix: keep the shell-exit delta baseline across host rebuilds#1212
gominimal-aw-bot[bot] wants to merge 1 commit into
mainfrom
inbox-patch/persist-session-delta-baseline-70e98debcaa0382f

Conversation

@gominimal-aw-bot

@gominimal-aw-bot gominimal-aw-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABMgbl4Q

The shell-exit prompt's "changed since activation" baseline was armed in Host::build, which runs once per host launch rather than once per session. Exiting a session with the "keep filesystem" option tears the host down but leaves the session and its files in place; a later reattach builds a fresh host that re-snapshots the already-modified workspace as its baseline. A second exit then diffs against that dirty baseline, sees no new changes, and drops the save-changes option even though uncommitted changes are still present.

This moves the baseline onto the Session actor, which outlives the host: it is armed once before the first host launches and reused across every teardown and rebuild, so a reattach keeps the activation-time reference point. Host construction now receives the baseline instead of arming its own. A regression test drives a keep-exit followed by a reattach and asserts the pre-exit change is still reported.

Verification

  • cargo fmt --all --check --manifest-path target/Cargo.toml — clean
  • cargo clippy --workspace --locked --manifest-path target/Cargo.toml -- -D warnings — clean, no warnings
  • cargo build --workspace --locked --manifest-path target/Cargo.toml — ok
  • cargo test --workspace --locked --manifest-path target/Cargo.toml — all tests passed (exit 0), including the new session::tests::workspace_baseline_survives_keep_exit_and_reattach

Note

Keep the shell-exit workspace change-detection baseline across host rebuilds within a session

  • Introduces a WorkspaceBaseline enum in session.rs with Unarmed and Armed variants to track a session-scoped change-detection baseline.
  • Arms the baseline once before the first host launch and reuses it on subsequent host rebuilds, so changes made before a shell-exit and reattach are still reported by the SessionDelta RPC.
  • Moves baseline arming out of Host::build in session_host.rs; callers now pass an externally-armed Option<Arc<DeltaSource>> instead.
  • Adds a regression test workspace_baseline_survives_keep_exit_and_reattach that verifies pre-exit changes remain visible after reattach.

Macroscope summarized b1d4c82.

The shell-exit prompt's "changed since activation" baseline was armed
in Host::build, which runs once per host launch rather than once per
session. Exiting a session with "keep filesystem" tears the host down
but leaves the session and its files in place; a later reattach builds a
new host, which re-snapshotted the already-modified workspace as its
baseline. A second exit then diffed against that dirty baseline, found
nothing new, and dropped the save-changes option even though uncommitted
changes remained.

Move the baseline onto the Session actor, which outlives the host: it is
armed once before the first host launches and reused across every
teardown and rebuild, so a reattach keeps the activation-time reference
point. Host construction now receives the baseline instead of arming its
own.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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

Run ID: 5dbea47f-4427-4f04-ad58-e2b4b064c46e

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants