Repository navigation
A stranded page repairs itself: the token is re-read, never reloaded - #155
Merged
Merged
Conversation
Restarting the serve mints a fresh console token. The browser reads
`/capabilities` ONCE, at load, so an open tab keeps presenting the old one and
every gate action is refused — `agent_invocation refused: the console token
does not match this serve's`. Brett hit this on a real create, with a title, a
summary and a body already typed into the form.
THE REPAIR IS A RE-READ, NOT A RELOAD. `location.reload()` would fix the header
by discarding the textarea, the selection and the drafted seed — the exact work
the refusal interrupted, because the refusal fires precisely when there is work
in the page. So the page re-probes `/capabilities` once, takes the new token,
and sends the SAME request again, unchanged.
WHY RE-SENDING IS LEGITIMATE. The two console refusals — `agent_invocation` on
the gate and edit routes, `console_required` on the doxBench model routes — are
raised by `_not_the_human_console()` BEFORE the body is read and before any
write. The server did nothing, so a second attempt cannot double anything. That
is the whole membership rule for the retriable set: a refusal that might have
half-landed is deliberately not in it and stays with the human.
Two attempts, never a third. A second refusal, or a plane that hands back no
console token at all, says `this page was loaded against an earlier serve —
reload to continue`; FR-019's four-clause sentence is never surfaced. A refusal
that is NOT a console refusal is the engine's own answer and reaches the human
verbatim, with no re-probe behind it.
THREE PIECES, EACH WHERE IT BELONGS:
* the policy is pure and lives in the model (`withConsoleRepair`), so the
retriable set has one definition the transports and the tests read;
* the re-read is composed once, in app.js, through the capability probe boot
already performs — no new route, no new fetch call site — and it MUTATES
both capability objects the shell holds, because the views were handed them
by reference and read `console_token` at call time;
* the two write transports build their header INSIDE the retried send, so the
second attempt presents the repaired token.
COVERED: the create and the four session verbs (`edit-document`, `open-pr`,
`abandon-session`, and doxBench's governed Save) retry themselves. NOT COVERED,
deliberately: select-to-edit and the doxBench chat/catalog carry no unsaved
text, and they read the token at call time from the same object the repair
writes into, so they work again after anything else has repaired it.
This only bites because the shell now re-renders IN PLACE (Brett, 2026-08-09,
"get rid of the flash"). Before that most actions navigated, and a navigation
quietly re-read the token on the way past.
PROVEN IN A REAL BROWSER, against a SCRATCH checkout (runbook §7), by
restarting the serve on the same port between typing and pressing create:
the restarted serve minted a DIFFERENT token
the create LANDED from the stranded page — created ✓
it opened the tile's branch session — draft/demo-topic (opened)
the page never navigated (the form was not discarded)
the created document carries the typed Title and Summary
exactly two create attempts: one refused, one landed — [403, 200]
10/10 checks passed, zero page errors
That run also closes the open question from the last session: the create
branches from the UI, driven end to end from a freshly loaded page — not
inferred from a direct API call.
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
Pull request overview
Implements an in-place recovery path for “stranded” dashboard tabs that outlive a serve.py restart: when a guarded write is refused due to a stale console token, the page re-reads /capabilities, updates the in-memory token, and retries the same request once (no page reload, preserving unsaved form/editor state).
Changes:
- Add a pure, shared retry policy (
withConsoleRepair) keyed to the two console-refusal error codes and capped at two total attempts. - Wire a single capability re-probe/mutation function (
createConsoleRepair) inapp.jsand thread it into the two write transports (create + session verbs) so headers are rebuilt on retry using the repaired token. - Add end-to-end and wire-level tests for the stranded-tab scenario, plus runbook documentation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/ideation-dashboard/test_session_confinement.py | Adds wire + renderer policy assertions and a Node-based harness proving a single re-probe and a single retry that preserves the drafted body. |
| scripts/ideation_dashboard/web/views/swb-session.js | Routes session writes through withConsoleRepair, building console headers inside the retryable send. |
| scripts/ideation_dashboard/web/views/swb-create.js | Routes create writes through withConsoleRepair, building console headers inside the retryable send. |
| scripts/ideation_dashboard/web/views/staging-workbench.js | Plumbs the consoleRepair function down into create/session view options as repair. |
| scripts/ideation_dashboard/web/views/staging-workbench-model.js | Introduces console-refusal classification and the withConsoleRepair retry policy + stranded message. |
| scripts/ideation_dashboard/web/app.js | Adds createConsoleRepair and composes it once per render, forwarding it to transports (including doxBench Save via firstEditTransport). |
| docs/ideation-dashboard-session-runbook.md | Documents the stranded-tab behavior, why retry is safe for the refusal set, and what is/ isn’t covered. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+403
to
+404
| code = "\n".join(line for line in source.splitlines() | ||
| if not line.lstrip().startswith(("//", "*", "/*"))) |
This was referenced Sep 2, 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.
Restarting the serve mints a fresh console token. The browser reads
/capabilitiesONCE, at load, so an open tab keeps presenting the old one andevery gate action is refused —
agent_invocation refused: the console token does not match this serve's. Brett hit this on a real create, with a title, asummary and a body already typed into the form.
THE REPAIR IS A RE-READ, NOT A RELOAD.
location.reload()would fix the headerby discarding the textarea, the selection and the drafted seed — the exact work
the refusal interrupted, because the refusal fires precisely when there is work
in the page. So the page re-probes
/capabilitiesonce, takes the new token,and sends the SAME request again, unchanged.
WHY RE-SENDING IS LEGITIMATE. The two console refusals —
agent_invocationonthe gate and edit routes,
console_requiredon the doxBench model routes — areraised by
_not_the_human_console()BEFORE the body is read and before anywrite. The server did nothing, so a second attempt cannot double anything. That
is the whole membership rule for the retriable set: a refusal that might have
half-landed is deliberately not in it and stays with the human.
Two attempts, never a third. A second refusal, or a plane that hands back no
console token at all, says
this page was loaded against an earlier serve — reload to continue; FR-019's four-clause sentence is never surfaced. A refusalthat is NOT a console refusal is the engine's own answer and reaches the human
verbatim, with no re-probe behind it.
THREE PIECES, EACH WHERE IT BELONGS:
withConsoleRepair), so theretriable set has one definition the transports and the tests read;
already performs — no new route, no new fetch call site — and it MUTATES
both capability objects the shell holds, because the views were handed them
by reference and read
console_tokenat call time;second attempt presents the repaired token.
COVERED: the create and the four session verbs (
edit-document,open-pr,abandon-session, and doxBench's governed Save) retry themselves. NOT COVERED,deliberately: select-to-edit and the doxBench chat/catalog carry no unsaved
text, and they read the token at call time from the same object the repair
writes into, so they work again after anything else has repaired it.
This only bites because the shell now re-renders IN PLACE (Brett, 2026-08-09,
"get rid of the flash"). Before that most actions navigated, and a navigation
quietly re-read the token on the way past.
PROVEN IN A REAL BROWSER, against a SCRATCH checkout (runbook §7), by
restarting the serve on the same port between typing and pressing create:
the restarted serve minted a DIFFERENT token
the create LANDED from the stranded page — created ✓
it opened the tile's branch session — draft/demo-topic (opened)
the page never navigated (the form was not discarded)
the created document carries the typed Title and Summary
exactly two create attempts: one refused, one landed — [403, 200]
10/10 checks passed, zero page errors
That run also closes the open question from the last session: the create
branches from the UI, driven end to end from a freshly loaded page — not
inferred from a direct API call.
Suites: tests/ideation-dashboard + tests/ideation_dashboard — 2826 passed,
19 skipped (exit 0). Re-run after the rebase onto origin/main: the seven
affected files, 379 passed (exit 0).
🤖 Generated with Claude Code