Skip to content

Pull cord: running turns park on a pull and continue on resume - #534

Merged
lydakis merged 5 commits into
mainfrom
claude/project-thread-04ukom
Oct 31, 2026
Merged

lydakis merged 5 commits into
mainfrom
claude/project-thread-04ukom

Conversation

@lydakis

@lydakis lydakis commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Why

A pull used to end every running turn as interrupted (daemon_paused), and nothing restarted them on resume. George picked "park on pull, continue on resume" and approved the design.

What changes

  • A pull parks running turns. Each running turn stops at once, as before, but parks like a closed pool rather than ending. Its status becomes paced, with a turn_paced event {"resume_at_ms": null, "paused": true}. It holds no slot and its wake-up waits for resume, across restarts too. The reply it was writing is requested again when it continues, from the whole model-call boundary (compaction included).
  • Calls cut short get a result, written by store::close_unanswered, which finish now shares. The result is {"error":"daemon_paused","detail":…,"pause":{reason,by,at_ms}}, stated as facts only, per src/AGENTS.md:
    • A call that was running: the pause stopped it before its result was recorded, it may have had effects, and it is not run again.
    • A call that had not started: the pause came before it ran.
    • No call is ever re-run. The model decides what to redo, the way Codex answers calls an interrupt cut off.
  • Waits on closed calls are cleaned up. Their approval requests and answers rows are removed. Each approve_step a closed call had asked is denied with step_decided, as end_steps does.
  • Background commands the pull ends give the same detail on their handle.
  • Turns that were already parked, queued work and steers carry on as today.
  • A park that commits as the pull lands (suspend, suspend_answer, suspend_approval) stays as it parked. The task registers that park's wake-ups as a restart would (Turn::rejoin): a pool's time, a verdict or answer looked at again, or a wait's handles plus the round's next lapse.
  • An interrupt after a pull still ends the turn. INTERRUPTED can replace a pending PAUSED; nothing else can.
  • Time parked by a pause is not added to paced_ms. This is tracked by Waiting.pulled in the JSON waiting column, so there is no schema change. The turn view's waiting_on reads {"resume_at_ms": null, "paused": true}.
  • The pause reply counts parked instead of interrupted.
  • by on pause and resume is limited to 1 to 128 bytes (invalid_by), the same limit a verdict's by has, since every session is told it. This fixes the open finding from Sonny: the sky shows the andon cord, who pulled it and who let the line go on #528.
  • Sonny shows "Paused" rather than "Rate limited" for such a turn, and /pause says "N running wait for /resume".
  • Protocol 33, since main now has 32.

Docs: RUST_PROTOTYPE pause section and event list, SONNY.md, sonny README, FEATURES row, CLI help.

Tests

  • test_a_pause_stops_every_agent_until_resume_across_restarts:
    • A turn that was mid-stream parks, stays parked across a restart, and completes after resume, with paced_ms under 300 ms.
    • An oversized or empty by is refused on both ops, and the pause still holds.
  • New test_a_pause_stops_a_running_command_and_the_turn_goes_on_without_rerunning_it: a running shell call gets the daemon_paused result with the pause reason. The turn completes on resume, and the command's side effect happened exactly once.
  • New unit test an_interrupt_supersedes_a_pause_and_nothing_relabels_an_interrupt.
  • Local: Rust workspace tests (Sonny included), clippy, and the runtime suites test_runtime, test_paced_park, test_daemon, test_lifecycle, test_wait, test_answered, test_approvals, test_delivery, test_cli and test_provider_pacing.

🤖 Generated with Claude Code

@lydakis lydakis self-assigned this Oct 31, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T18:25:30.322912Z 3eb2b41 New commits
🔒 Security Review ⚠️ Failed 2026-10-31T16:56:38.449055Z
We couldn’t complete this review. Comment @codex security review to try again.
6ad97ab PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ad97ab9cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/store/db.rs Resolved
Comment thread src/store/db.rs Resolved
Comment thread src/store/db.rs Resolved
Comment thread src/server/turn.rs Resolved

lydakis commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

@codex security review

This PR's one automatic security review failed on the usage limit. Tracked in #531 as riskier: daemon turn lifecycle, where a pulled cord parks running turns and resume continues them, so killed tool calls must never run again.


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 6ad97ab9cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lydakis
lydakis force-pushed the claude/project-thread-04ukom branch from 6ad97ab to 297462b Compare October 31, 2026 17:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 297462b534

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/turn.rs Resolved
A pull used to end every running turn as interrupted, and nothing started
them again on resume. Now each parks at once as a closed pool parks it
(status paced, `turn_paced` with `paused: true` and no `resume_at_ms`), and
its wake-up waits for `resume`, across restarts too. Each call it had not
answered gets a `daemon_paused` result saying the pause stopped it (it may
have had effects) or came before it ran, with the pause; none is run again,
as Codex answers the calls an interrupt cut off. A background command the
pull ends says the same on its handle. The pause is not counted as paced
time, and the pause reply counts `parked`, not `interrupted`. Sonny says
"Paused" for such a turn. Protocol 31; no schema change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHSbKZDm7SFtpZarEA
… bounded on pause and resume

A park of the turn's own that committed as the pull cancelled its task now
has its wake-ups registered by the task, as a restart registers a parked
turn's: a pool's time, a verdict or answer looked at again, or a wait's
handles and the round's next lapse. `by` on `pause` and `resume` is 1 to 128
bytes, as a verdict's is, answering `invalid_by` otherwise: it is told to
every session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGHSbKZDm7SFtpZarEA
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