Make convergence read what it thinks it reads #185
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lz/agent-nexus!185
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/converge-reads"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #178. Closes #179.
Two defects in one pass, collapsed into one PR because they are the same shape — convergence acting on a value that is not what it appears to be — and because both live in the same twenty lines of
convergeSessions. Both are sequencing dependencies of #177, which turns this pass into an input to a store other subsystems read as truth.1 · The window listing could not report failure (#178)
listTmuxWindowsread the exec stream itself and hand-stripped Docker's framing withstripFraming, which tested only the first frame's stream byte and then walked every frame regardless — so stderr payloads were concatenated into the window-name set. It also never calledexec.inspect(), so a non-zero exit was invisible.tmux list-windowsagainst a dead server writes a diagnostic to stderr and exits 1. That arrived either as a set of nonsense names or as an empty set meaning every window is missing — and a missing window with a surviving worktree is exactly what triggers a relaunch. The sibling worktree listing follows the opposite rule, and AGENTS.md fact #15 states it: uncertainty never triggers an action.Now it goes through
execAndCapture(which separates the streams and inspects the exit code) and returns{ names, ok }shaped likelistWorktrees; convergence skips the pass whenokis false.stripFraminghad exactly one caller — checked withgit grepacrossnexus/srcrather than assumed, as the issue's scope note asked — and is deleted.2 · Convergence alone never minted a conversation id (#179)
Three paths relaunch a session, and they handled the empty
claude_session_idthat migration 0012 left on every pre-existing row three different ways:openWorkspaceSessionsetSessionAgentrestartconvergeSessionsSince
resumeFlagemits nothing at all for an empty id, a restored legacy session launched with no--session-idand no--resume, and the row stayed empty — so it could never become resumable. The conversation was lost on every restore, silently, permanently.ensureClaudeSessionIdnow states the rule once and both relaunch paths read through it.openWorkspaceSessionkeeps its own mint deliberately: it may have no row to update yet, and it persists after the respawn succeeds rather than before, which is the safer order — its comment now points at the helper instead of at convergence's oldBoolean(row.claude_session_id), a cross-reference this change would otherwise have left stale.Guards, proven to fail first
All three were written against the unfixed code and observed red before anything was fixed — the failure output is the control, not a claim:
expected '' to match /^[0-9a-f-]{36}$/The launch assertion checks for
--session-idand the absence of--resume. Asserting the id alone cannot tell a fresh pin from a resumed conversation — the mistake the restart path's own test calls out in a comment.The test fake needed no restructuring, as #178 predicted: it already exposed the two methods
execAndCapturedrives. It gained aframeStderrhelper beside the existingframeStdout, and two options onmakeConvergeDockerfor what the listing writes to stderr and what it exits with.Deliberately left
resumeFlag's empty-id branch stays. After this no production path can reach it —createSessioninserts a uuid,openWorkspaceSessionmints, and both relaunch paths now go through the helper — and only the launch-builder unit tests still pass''. Deleting it means editing a dozen expectation strings that exist to pin quoting, flag order and the agent-teams flag, which would bury those assertions under an unrelated change. Worth its own small PR.Verification
Each gate its own command, output redirected,
$?read before the log — never piped totail.sessions/service.test.ts: 69 → 72)One self-inflicted defect caught before commit: the helper was first inserted between
resumeFlag's docblock andresumeFlag, orphaning that rationale onto the wrong function — the same displacement a review caught on #180. Moved below it, and the gates re-run after the move.