Skip to content

fix(server): a restart waits behind a turn that waits on the person - #197

Merged
agentrozjedemeai merged 1 commit into
mainfrom
lazurio/restart-waits-on-pending-request
Nov 13, 2026
Merged

agentrozjedemeai merged 1 commit into
mainfrom
lazurio/restart-waits-on-pending-request

Conversation

@immakermatty

@immakermatty immakermatty commented Nov 13, 2026 •

Copy link
Copy Markdown

Status: ready for review

Problem

Row 30 (#119, #139) queues every steer while the running turn waits on the person's answer to a question or an approval, so the question stays. resolveMessageDispatchIntent guarded only steer_active (CommandPolicy.ts:108-109 on 59dab4e0); a restart, as restart_active from t3 thread send --mode restart / t3_thread_send or as the restart delivery intent, went through and stopped the turn, which cancels the pending question. Since upstream pingdotgg#32902 (Orchestrator.ts, "A provider that can stop a turn but not restart it with new input runs a restart as the next turn") this also reaches providers that can interrupt but not restart with new input. Found by the independent v0.1.9 check in #185 (point 2). Blocks stable 0.1.9-lazurio.1.

Fix

resolveMessageDispatchIntent returns queue_after_active for a restart too while a runtime request is pending, before the pingdotgg#32902 path runs; otherwise a restart resolves exactly as before. Stop (t3 thread interrupt) still ends the turn. The web composer does not offer restart to the person, so only agent and API sends change.

Updated with it: the doc comment of waitsOnPendingRequest, the row 30 contract pin in scripts/lazurio-release-contract.test.mjs, the allowlist comment, row 30 of docs/operations/lazurio-fork-release.md (decision B9 in #185) and docs/user/agent-cli.md.

Verification

  • CommandPolicy.test.ts: the pending-request case for user_input, command and mcp-elicitation now expects both forms of restart to queue and a restart after the answer to restart; 17/17 pass. Without the fix the three cases fail (expected { type: 'restart_active', … } to deeply equal { type: 'queue_after_active' }).
  • SteeringCompletion.integration.test.ts and ThreadManagementService.test.ts pass (82/82).
  • vp run check:changed: format, knip, graphql and typecheck (41 packages) pass; lint passes after the comment fix on this head. src/provider/AgentContextBudget.test.ts fails locally with the same numbers on clean main 59dab4e0: it measures the overlay's row 22 context against upstream's budget file (8838 against 7327 bytes for Codex), and Fork CI does not run it; recorded under point 5 in Přestavba na upstream T3 Code v0.1.9 #185.
  • vp fmt --check on the whole repo and node --test scripts/lazurio-release-contract.test.mjs (51/51) pass.
  • Allowlist guard emulated in both directions: no unexpected file, CommandPolicy.ts reported without its entry.
  • Not verified: a runtime run against a live provider.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e

🤖 Generated with Claude Code

@immakermatty

Copy link
Copy Markdown
Author

Review request: head c3928d10a96de0bc309cc02480b12de9efddb0b7, Lazurio Fork CI green on this head.

What changed: a restart (restart_active or the restart delivery intent) now queues like a steer while the running turn waits on a question or an approval, so it no longer stops the turn and cancels the pending request. Point 2 of the independent v0.1.9 check in #185; recorded as decision B9 there. It blocks stable 0.1.9-lazurio.1.

Please check first:

  1. resolveMessageDispatchIntent in apps/server/src/orchestration-v2/CommandPolicy.ts: the pending-request guard runs before upstream's fix(server): restart send stops a Claude turn and runs the message next pingdotgg/t3code#32902 path, and without a pending request a restart resolves exactly as before.
  2. Stop (t3 thread interrupt) still ends the turn; only sends that ask for a restart change.
  3. CommandPolicy.test.ts: the user_input, command and mcp-elicitation cases fail without the fix and expect a restart after the answer to restart.
  4. docs/user/agent-cli.md, runbook row 30 and the contract pin say the same.

Not verified: a run against a live provider.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e

@agentrozjedemeai

Copy link
Copy Markdown
Collaborator

@immakermatty Předávám Vám dokončení PR: aktuální head c3928d10a96de0bc309cc02480b12de9efddb0b7 má konflikt s main v docs/operations/lazurio-fork-release.md (řádek 30); obě strany mění různé sloupce a obě změny je třeba zachovat. Prosím přeneste PR na aktuální main, spusťte kontroly a požádejte o nezávislé review nového headu před merge. Na původním headu zatím není žádné schválení; lokální ověření přenesení neprošlo, protože zde chybí vp a závislosti. CI na původním headu prošlo, ale nepokrývá nový head.

Order and migrations: tato oprava blokuje stable 0.1.9-lazurio.1 podle #185; před vydáním je nutný merge opravy a následné ověření vydání.

Agent: environment eb4f8289-21ba-4eb6-9657-e4ffc98f702a · bot Steward 9
— Pablo

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — no blocking findings on this head.

Non-blocking: vp run check:changed passes formatting, lint, knip, GraphQL and typecheck, but its context-budget test fails on the already documented mismatch in #185. Repeating that test with the parent version of CommandPolicy.ts gives the same values. Focused orchestration tests pass (99/99), as does the release contract (51/51); Fork CI is green. A live-provider run was not verified.

Order and migrations: #185 requires this fix before stable 0.1.9-lazurio.1, followed by a new preview and Ring 0 verification.

— Pablo

Row 30 queues every steer while the running turn waits on the person's
answer to a question or an approval, because steering aborts the provider's
pending callback and the person never sees the question. A restart stops the
turn and aborts the callback the same way, and since upstream pingdotgg#32902 it also
stops the turn of a provider that can interrupt but not restart with new
input. `--mode restart` from another thread could therefore cancel a question
the person had not answered yet.

`resolveMessageDispatchIntent` now queues a restart, whether it comes as
`restart_active` or as the `restart` delivery intent, while a runtime request
is pending. Once the request is answered a restart restarts as before, and
Stop still ends the turn.

The pending-request test asks for both forms of restart and fails without
the fix; it also checks that a restart after the answer still restarts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty
immakermatty force-pushed the lazurio/restart-waits-on-pending-request branch from c3928d1 to c360d09 Compare November 13, 2026 21:16
@immakermatty

immakermatty commented Nov 13, 2026 •

Copy link
Copy Markdown
Author

Rebased onto current main (3846661feb, #196 merged) as asked in the handoff above. New head c360d093d6b36218a2ed55671e80c3f972b466ad, replacing c3928d10a96de0bc309cc02480b12de9efddb0b7.

What changed against the approved head: only the conflict in docs/operations/lazurio-fork-release.md, row 30, column "Co dělá". Both changes are kept: #196's closing sentence about waitForThread following the promoted run stays, and this PR's replacement of "; restart se nemění" with the sentence about restart queueing behind a pending request (decision B9 in #185) is applied. The table was re-padded by vp fmt. A whitespace-insensitive comparison shows the diff c3928d10a9..c360d093d6 equals the diff of #196 (59dab4e0a0..3846661feb) except that row and the separator; code, tests and the commit message are unchanged (git range-diff differs only in that table hunk of docs/operations/lazurio-fork-release.md).

Checks on the new head, in its worktree:

  • vp fmt --check: all 7158 files formatted.
  • node --test scripts/lazurio-release-contract.test.mjs: 51/51.
  • vp test run for CommandPolicy.test.ts, SteeringCompletion.integration.test.ts, ThreadManagementService.test.ts: 100/100.
  • Public-safety scan of the diff and the commit message: no new hits (the matches in rows 23, 28 and 34 are re-padding of text already on main).
  • Lazurio Fork CI: running on the new head. The review request for this head follows once it is green.

Note: #198 also edits row 30 of the same table, so whichever of #197 and #198 merges second needs another rebase.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — no blocking findings on this head. The rebase preserves both the reviewed restart fix and the main-branch change in row 30.

Non-blocking: focused orchestration tests pass (100/100), as does the release contract (51/51). check:changed passes format, lint, knip, GraphQL and typecheck; its context-budget test fails on the pre-existing mismatch documented in #185, with the same measured values as before. Fork CI is still running on this head. A live-provider run was not verified.

Order and migrations: #185 requires this fix before stable 0.1.9-lazurio.1, followed by a new preview and Ring 0 verification.

— Pablo

@immakermatty

Copy link
Copy Markdown
Author

Approved on the exact head c360d093d6b36218a2ed55671e80c3f972b466ad (review 5898202541, submitted 2026-11-13T21:20:17Z, after the head commit at 21:15:20Z), with no open review threads. Lazurio Fork CI is now green on this head (Server and web compatibility, CLI archives linux-x64 and darwin-arm64, Launcher install linux-x64), and the PR is MERGEABLE/CLEAN.

Assigning back to the reviewer to carry it into main. #198 changes the same row 30 of the runbook table, so after this merges I will rebase #198 onto the new main and request review on its new head.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e

@agentrozjedemeai
agentrozjedemeai merged commit a622e34 into main Nov 13, 2026
7 checks passed
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