Skip to content

The pull cord: pause every agent until resume, across restarts - #408

Merged
lydakis merged 15 commits into
mainfrom
claude/project-thread-kysvcw
Oct 30, 2026
Merged

lydakis merged 15 commits into
mainfrom
claude/project-thread-kysvcw

Conversation

@lydakis

@lydakis lydakis commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

George asked for an andon cord: one way to stop every agent at once, which agents can pull from the CLI ("Let's not give them a tool, but let's keep the CLI"). The design was discussed first in the pull cord doc, and he took all three recommendations:

  • running turns are interrupted at once;
  • resuming is the person's call;
  • agents learn of it from one sentence in their roles plus the CLI's help.

Later, on Codex's security finding, he chose to have a sandboxed bot's socket refuse resume.

It works like a Toyota andon cord, or kubectl cordon: one flag that anyone with access can set and a person clears.

Daemon (protocol 24, schema 64)

  • {"op":"pause","reason","by"} stores a one-row pause table with the reason, who pulled it and when.
    • It ends every running turn as interrupted with daemon_paused, and it also ends background commands, steered shells and terminals. Detached commands are left running.
    • From then on no turn starts. Most of that is the existing shutdown-drain path:
      • has_capacity() is false while paused.
      • A reject submission answers daemon_paused, the same way draining answers daemon_draining.
      • queue and steer submissions are recorded and wait, and triggers and notes wait with them.
      • Parked and paced turns stay parked.
      • attach is taken as usual.
    • A second pause while one holds changes nothing; it answers with the first pause and changed: false.
    • On a bot's own socket, by is always that bot.
  • {"op":"resume"} lifts the pause. It answers with the pause it lifted, or null if none held. Whatever waited starts as capacity allows.
    • A sandboxed bot's socket refuses it with not_permitted.
  • It survives restarts. The pause lives in the store, so a daemon that a trigger or launchd brings back up comes up paused. That is the difference from shutdown --grace.
  • It's visible.
    • Every session gets a paused or resumed event (durable: false). A session too far behind to take one is closed, so it hears the pause in its next greeting.
    • ready and stats both carry paused.
  • CLI. agent pause --reason TEXT sends the pause as AGENT_BOT when run in a bot's shell, and agent resume lifts it.

Sonny

  • /pause REASON and /resume.
  • While a pause holds, every window shows ⏸ Every agent is paused by NAME: REASON · /resume above the footer. The banner starts from the ready pause, follows the events, and is kept across reattaches.
    • It takes precedence over a waiting approval, which y/n can't answer while paused.
  • task.md and lead.md each get one sentence: when you see agents doing harm someone needs to look at, such as data being lost, money being spent or messages going out, stop every agent with "$AGENT_BIN" pause --reason WHY; resuming them is the person's call. Agents get no tool for this.
  • Documented in docs/SONNY.md#pause, the README, and a row in FEATURES.md (experimental).

Shared numbers

Tests

  • New runtime test test_a_pause_stops_every_agent_until_resume_across_restarts (AGENT_TEST_RUNTIME=1). It checks that:
    • a running turn ends with daemon_paused;
    • a second pull changes nothing;
    • reject is refused and queue waits;
    • a restarted daemon is still paused and starts nothing;
    • resume runs what waited;
    • a second resume is a no-op.
  • Further tests cover:
    • the greeting carrying the pause;
    • a background command and a steered shell being ended by the pause;
    • a sandboxed socket being refused resume (test_approvals).
  • New Sonny tests:
    • /pause without a reason, then with one;
    • the banner from a paused event and over a waiting approval;
    • /resume, and the resumed event clearing the banner.
  • cargo test --workspace passes, and cargo clippy --workspace --all-targets -D warnings is clean.

🤖 Generated with Claude Code

A daemon op pause {reason, by} stores a one-row pause (schema 63), ends
every running turn as interrupted with daemon_paused, and holds every
start: reject submissions answer daemon_paused, queued work, triggers and
notes wait, parked turns stay parked. resume lifts it and what waited
starts. Both are told to every session as paused/resumed events, and
ready and stats carry the pause. A bot's own socket pauses as that bot.

agent pause --reason / agent resume send them, as AGENT_BOT in a bot's
shell. Sonny gets /pause REASON and /resume and a line above the footer
saying who paused and why. task.md and lead.md tell agents to pull it
when they see harm someone needs to look at, with no tool for it.
Protocol 24.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF2d82b9p96KboFLML
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T05:36:19.538782Z 1e06868 New commits
🔒 Security Review ✅ Completed 2026-10-30T05:38:44.533758Z 1e06868 New commits

Security findings

Advisory findings (2)

ℹ️ 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.

@lydakis lydakis self-assigned this Oct 30, 2026

@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: d0edb533fc

ℹ️ 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 sonny/src/main.rs Resolved
Comment thread src/server/mod.rs Resolved

@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: 21807dc0f4

ℹ️ 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/mod.rs Resolved
Comment thread src/server/mod.rs Resolved

@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: 54b6395f45

ℹ️ 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/mod.rs Resolved

@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: f25c82dcf4

ℹ️ 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/tools.rs Resolved
Comment thread sonny/src/main.rs Resolved
Comment thread sonny/src/main.rs Resolved
A command a steer moved to the background ends with the pull, as one
started there does. Sonny keeps a pause or resume that came during its
follow replay, and shows the pause over a waiting approval, whose keys
wait for the resume.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF2d82b9p96KboFLML

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 064515de88

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread src/server/mod.rs Resolved

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 4e8fac0f55

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread src/server/mod.rs Resolved
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGF2d82b9p96KboFLML

# Conflicts:
#	client/src/lib.rs
#	docs/DAEMON_MEASUREMENTS.md
#	sonny/agents/task.md
@lydakis
lydakis merged commit 0803cb6 into main Oct 30, 2026
5 checks passed
@lydakis lydakis mentioned this pull request Oct 30, 2026
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