Skip to content

Re-confirm a proof writer's stop after close cancels pending work - #61

Merged
LikC1606 merged 1 commit into
mainfrom
fix/writer-stop-reconfirm
Nov 28, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/writer-stop-reconfirm

Conversation

@LikC1606

Copy link
Copy Markdown
Collaborator

stopProofWriter now asks stopForFreeze a second time after close(). Before this change it asked only once, before closing.

Failure

A balance-7 research run ended in runtime_error with math_writer_stop_unconfirmed:solver:turn-not-settled:

  1. The Lead called native followup_task on an idle member. The host blocks that call until the member's workspace is prepared, which took about 5 minutes.
  2. The soft-slice wait-limit interrupted the Lead turn. Codex ended the turn, but the followup callback was still pending in NativeAgentControl, so stopForFreeze returned turn-not-settled.
  3. stopProofWriter then closed the session. Closing cancelled the callback and stopped the process, but the function threw anyway and the whole run failed.

Change

  • The quarantine is still persisted before close().
  • After a successful close, stopForFreeze is called again. If the writer is confirmed stopped, the quarantine is cleared, proof_ready_freeze_confirmed (Lead) or team_writer_stop_confirmed (member) is emitted, and the normal checkpoint path continues.
  • If the writer is still unconfirmed, or if close() fails, the quarantine is kept and the error is thrown as before.

Tests

  • New tests/proofWriter.test.ts (5 cases), plus one case in tests/codexSessionAgentControl.test.ts that drives the real Codex session fixture with a pending host callback.
  • The two cases for this failure fail on main and pass with the change.
  • 61 related test files (900 tests) pass. typecheck and bun run build pass.

Not changed

followup_task on an idle member still blocks the Lead's tool call while the member's workspace is prepared. With this fix that wait no longer fails the run.

🤖 Generated with Claude Code

stopProofWriter asked stopForFreeze once. When an interrupted turn
left a host callback pending, the answer was turn-not-settled; the
function then closed the session, which cancels the callback and
stops the process, but threw math_writer_stop_unconfirmed anyway and
failed the whole run.

A balance-7 research run hit this: the Lead's native followup_task
to an idle member blocked while the host prepared that member's
workspace, the soft-slice wait-limit interrupted the Lead turn, and
the still-pending followup callback made the freeze unconfirmed.

stopProofWriter now persists the quarantine first as before, closes,
and asks stopForFreeze again. If the writer is confirmed stopped it
clears the quarantine and emits proof_ready_freeze_confirmed /
team_writer_stop_confirmed; otherwise, or if close fails, it keeps
the quarantine and throws as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit 10fecbf into main Nov 28, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/writer-stop-reconfirm branch December 1, 2026 20:12
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.

1 participant