Skip to content

fix(btw): keep the side conversation and its queue isolated - #122

Merged
GeekCmore merged 1 commit into
mainfrom
fix/btw-persist
Oct 21, 2026
Merged

GeekCmore merged 1 commit into
mainfrom
fix/btw-persist

Conversation

@GeekCmore

Copy link
Copy Markdown
Collaborator

Problem

  1. /btw closed itself as soon as the side answer completed. d5572320 moved the side Agent to a native subagents.startActivation({ delivery: 'caller' }); the activation manager settles and disposes a local child at its first idle, and agent/disposed removes the BTW conversation view.
  2. The side Agent inherited the primary's unclaimed queued and steering messages. b6386624 had cleared that inherited inbox, but the activation refactor dropped the clear, so /btw ran the parent queue too.

Fix

  • Own a regular AgentHandle from agents.create for the side conversation; keep it until the view closes, is replaced, or the plugin unloads.
  • Seed from buildForkSeed(parent.session.snapshotEvents(), lastSeq), restore the model/preset selection and historyFloorSeq, and clear the child inbox before asking the question.
  • Keep the existing fork-provider gate, single-slot replacement, abort/stale-result guards, F8 close, and unload cleanup.
  • Update the harnessAlignment btw/main goldens for the side view that now survives completion.

Verification

  • pnpm run test — 6394 passed, 1 skipped.
  • pnpm run check -- --base origin/main — lint, build, typecheck, agent docs, diagrams, workflow tests, and the 7 selected specs pass; harnessAlignment passes. The remaining mergeConversations / mergeHeights / mergePanels scenario failures reproduce unchanged on a clean origin/main worktree (stale queue/stats goldens), so they are not part of this change.
  • check:lib and check:pack pass; btw-command.ts has 100% changed-file coverage.
  • Dedicated profile mayfly-btw-persist installed for human acceptance.

Acceptance

dsh --profile mayfly-btw-persist: with a queued message on the primary, /btw <question> shows only that question; when the answer ends the side view stays open for follow-ups; Esc/F8/empty /btw closes and disposes; F7 returns to main; new /btw replaces the slot; 40/60 columns and theme reload stay clean.

The native subagent activation settles a local child at its first idle and disposes it, so the BTW view closed as soon as the answer ended. Restore ownership of a regular AgentHandle: seed from buildForkSeed, hold the handle until the view closes, and clear the inherited inbox before asking so the parent's unclaimed queued and steering messages stay with the primary.

Update the harnessAlignment btw and main goldens for the side view that now survives completion.
@GeekCmore

Copy link
Copy Markdown
Collaborator Author

The check (pr tier) job fails only on the pre-existing scenario goldens (mergeConversations, mergeHeights, mergePanels). The same failures reproduce on a clean ffa7d5da worktree without this branch; they are stale queue/stats goldens (the shipped version already differs from the recorded 0.1.3-rc.2 shots). harnessAlignment passes with the updated btw/main goldens, and all non-scenario steps pass. This PR does not touch those unrelated goldens.

@GeekCmore
GeekCmore merged commit 862ecec into main Oct 21, 2026
6 of 7 checks passed
@GeekCmore
GeekCmore deleted the fix/btw-persist branch October 21, 2026 19:30
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.

2 participants