Document platform architecture - #12
Merged
Merged
Conversation
8 tasks
serge-ivo
pushed a commit
that referenced
this pull request
Aug 8, 2026
… to a button (#407) `ensureActiveSession` already reused a live session, re-attached one whose engine process had gone, opened a fresh one, and reported why when it could not. It had exactly one caller: the Loop driver. The chat tools called `getActiveSessionForRepo` and gave up. So the same agent, in the same conversation, about the same repo: "go fix issue #12" → start_work → a `claude --dangerously-skip- permissions` child process appears on your laptop "what's the terminal at?" → read_terminal → "No active session for X." The path with the LARGER consequence was the one that self-served, and the harmless half — reading a pane — was the one that needed a human in the console. `read_terminal` and `send_to_cli` now go through a new `ensureSessionForChat`, which wraps the same `ensureActiveSession` the Loop uses and adds the two things a chat surface needs that a Loop does not: * CONNECTIVITY FIRST, from `runtimeConnectivity` + `classifySubordinateConnectivity` — the same resolver delegation uses. Not politeness: `ensureActiveSession` INSERTS a `coding_sessions` row before it discovers there is no runner to launch on, then ends it. A 409'ing Loop can absorb that; a read tool a user calls repeatedly on a train would write and end a row every time, and the refusal has to blame the runner, which is what `noSessionMessage` says. Runner offline now means the runner diagnosis and NO row. * THE NOTICE. A process just appeared on somebody's machine and they did not ask for one, so the tool result names the session it started and instructs the model to say so. That string is the only lever available here — the prompt builder is a different file. The six-hour idle reap (#275) is untouched, and pinned by a test that asserts the exact constant: "chat can reopen it, so reap sooner" is the plausible wrong inference, and reaping early destroys a CLI context that cannot be recovered. What the reap gained is a reader. Its only durable trace was a `coding_timeline` sentence rendered in the Co-pilot view — the one place a chat user never looks — so from chat a session simply stopped existing and the next question failed for a reason nothing had stated. `lastIdleReapForRepo` reads that sentence back (marker and writer now share a constant, and a test fails if either drifts) and the opened-session notice explains it. No migration: the fact was already durable, it was just unreadable from the other side. Rejected: keeping it manual because spawning a process deserves an explicit act. That argument was already lost to `start_work` in the same chat; the split only made the safe half harder than the consequential one. read_terminal's offline degradation survives — `ensureActiveSession` now returns the session it FAILED to re-attach, so the last saved snapshot is still offered, labelled with the real diagnosis rather than presented as live. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification