Skip to content

fix(agent): keep working copy on agent view at session end - #148

Merged
geekgonecrazy merged 1 commit into
devfrom
fix/agent-session-end-no-view-restore
Aug 4, 2026
Merged

geekgonecrazy merged 1 commit into
devfrom
fix/agent-session-end-no-view-restore

Conversation

@geekgonecrazy

Copy link
Copy Markdown
Contributor

Problem

On SessionEnd, the turn orchestrator switched the working copy back to the session's parent view (session_end.rs called repo.switch_view(parent)). That makes the review flow clunky:

  1. Open agent harness
  2. Give it a direction — it creates an intent and code
  3. Exit, having fulfilled the work you intended to do
  4. atomic view list
  5. Identify the view that has 1 change (hope it's the right one…)
  6. atomic insert from-view <the view you hope holds the work>

Landing back on dev hides the work that was just done. Users who close their session (rather than keeping it open in another tab) have no idea which draft view holds their agent's changes.

Fix

Remove the switch-back. The working copy stays on the session's agent view when the session ends, so the user lands exactly where the work happened and can review (atomic log / atomic diff) and atomic insert from there.

  • parent_view is still captured at session start — it remains the fork baseline for the just-in-time self-heal in record_turn and the delta reference for atomic agent attest --pending.
  • The pre-finalize flush (which records uncommitted turns for headless agents like Cursor's CLI) is unchanged — it still aligns to the agent view before recording.
  • Sandbox sessions are unaffected (they never forked/switched in the first place).

Changes

  • atomic-agent/src/turn/orchestrator/session_end.rs — drop the switch_view(parent) block; document that staying on the agent view is deliberate
  • atomic-agent/src/turn/orchestrator/session_start.rs — update stale comment claiming session-end switches back
  • atomic-agent/src/turn/orchestrator/tests.rs — assert the new behavior: current_view() remains the agent view after session end
  • docs/adding-agents.md, atomic-repository/vault/skills/atomic-vault.md — docs updated to match

Testing

  • cargo test -p atomic-agent — 1313 passed, 0 failed
  • cargo clippy -p atomic-agent — clean

Session-end used to switch the working copy back to the session's
parent view. That made the review flow clunky: exit the harness and
you land back on dev, forced to hunt 'atomic view list' for the draft
view holding the agent's single change before you can insert it.

Leave the working copy on the session's agent view instead so the user
lands where the work happened and can review (log/diff) and insert
from there. parent_view is still recorded — it remains the fork
baseline and the 'attest --pending' delta reference.
@geekgonecrazy
geekgonecrazy merged commit 027b276 into dev Aug 4, 2026
8 checks passed
@geekgonecrazy
geekgonecrazy deleted the fix/agent-session-end-no-view-restore branch August 4, 2026 21:20
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.

1 participant