Skip to content

Sonny: one reading of what needs you, for every surface - #631

Merged
lydakis merged 5 commits into
mainfrom
claude/project-thread-zthhjy
Nov 1, 2026
Merged

lydakis merged 5 commits into
mainfrom
claude/project-thread-zthhjy

Conversation

@lydakis

@lydakis lydakis commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Why

The Monday rehearsal (11-01, build 3232b4d) found the needs-you counts drifting:

  • after a planned restart, a pending approval dropped out of the lead's needs-you count and its tab read working;
  • a task waiting on its own question read done in its tab and was missing from the lead's count;
  • the footer said 0 while /status and /sky showed a pending approval and open questions.

The cause: four surfaces kept four counts with four sets of rules. The lead's tabs and footer (Fleet::doing) followed live events only, so a restart lost a held call (reconcile marked running tasks working, and a parked turn's turn_resumed cleared needs you), and they never knew about asks. /status and the started roster treated any waiting_on.approval as needs-you, including a call the approver was still weighing. /sky had its own event rules (a lead's message answered a task's question, unlike everywhere else).

What

A new sonny/src/needs.rs says it once. An agent needs the person while:

  • a call of its waits on their approval: gated manual, or handed over by the approver (asked), as the daemon's approvals listing reports it (needs::person_call, needs::listing); or
  • a question it asked them with the ask tool is still open, as asks::open reads its history (needs::scan, moved from App::scan).

needs::Needs holds that per agent. It is read whole when a surface starts or reconnects, and kept current from events after: approval_requested / approval_asked add a call; step_decided, turn_resumed, tool_completed and tool_started with that call's id let it go; the running turn's turn_finished drops that turn's calls; an ask call opens a question, and a refused one closes it. The person's own prompt closes a question for now. Whether it really answered it (a reaction does not, and with several questions open it may answer only one) is decided by reading the history again when that turn ends (Needs::due). No daemon change.

Each surface now reads it:

  • Lead's tabs and footer (Fleet): a tab shows needs you over whatever the bot is doing (activity). reconcile reads the listing first, so a held call survives a restart or reconnect, and then reads each agent's questions one at a time from the loop (cached by history head), so a big project still opens at once. A task that ended on a question keeps its window when a wait takes its result. Alerts only ring when an agent starts waiting, never when the wait ends. The lead's own questions don't ring here, because its own view rings at its turn's end, as before.
  • Footer: counts agents. This window's own agent counts once, for its open questions or held calls (it used to count each open question).
  • /status and the started roster: they use the same definition. What they read is written into the tabs' ledger, so the footer and /status agree after every refresh. A call the approver still weighs reads waiting on its reviewer (◌, like the other waiting on … rows), not needs you.
  • /sky: each agent's waits are a needs::Needs. They are seeded from the listing, and every agent's questions are read beside the follow, so questions asked before the sky opened show. Behaviour change: a lead's message to its task no longer answers the task's question in /sky. Now /sky matches the task's own window, /status and the decision of 10-31 (only the person's own words answer an ask).

sonny/FEATURES.md (Task states row) and sonny/README.md (the /status groups and the footer) are updated.

Tests

  • what_waits_on_the_person_comes_back_with_a_restart: a fresh fleet against a daemon holding a manual call on a running task and an idle task with an open question. The tab reads needs you and stays so through turn_resumed. The question is read after reconcile, the footer counts 3 others, and answering the call brings it back to working.
  • a_task_that_ends_on_its_own_question_needs_you: the person's words clear a question, a new ask sets it, and the turn ending leaves needs you and is read again.
  • status_says_needs_you_only_for_calls_the_person_must_answer_and_the_tabs_agree: a manual call reads needs you and an approver-only call reads waiting on its reviewer. The tabs, which had missed the call, are corrected by the /status read, and the footer agrees.
  • Unit tests in needs.rs for the reducer (gates, parked turns, steered turn ends, refused asks, person vs agent words, listings replacing only what they cover).
  • Updated: started::state no longer calls an approval wait needs you (the listing decides that); the footer test counts agents; the sky test now expects a lead's steer to leave the task's question open, and the person's own words to answer it.

cargo fmt --all --check, cargo clippy --workspace --all-targets -D warnings and all 934 Sonny tests pass locally.

Not covered

  • I did not run this live on the Mac. The rehearsal's exercises 2 (planned restart) and 11 (window budget) are the checks to repeat.
  • The lookout's "waiting for the person's approval" note to the lead still fires on any approval wait longer than 2 minutes, including the approver's. It tells the lead something rather than counting anything, so I left it out of this PR.

The footer, the lead's task tabs, /status, the started roster and /sky
each kept their own needs-you count, with their own rules, and drifted:
after a restart a held approval read as working, a task waiting on its
own question read as done, and the footer said 0 while /status and /sky
showed items (Monday rehearsal, 11-01).

A new needs module says it once: an agent needs the person while a call
of its waits on their approval (gated manual, or handed over by the
approver, as the daemon's approvals listing says) or a question it asked
them is open (as asks::open reads its history). Each surface reads it
whole at start and after a restart or reconnect, and keeps it current
from events; a turn the events leave unsure of its questions is read
again when it ends. No daemon change.

- Fleet: tabs show "needs you" from the ledger over what the bot does;
  reconcile reads the listing and each agent's questions; a parked
  turn's turn_resumed no longer clears a held call; a task that ended on
  a question keeps its window when a wait takes its result.
- Footer: counts agents, this one once.
- /status and the roster: the same definition, and what they read
  updates the tabs and footer; a call the approver still weighs reads
  "waiting on its reviewer".
- /sky: each agent's waits are the same ledger, seeded from the listing
  and a read of each agent's questions; a lead's word to its task no
  longer answers the task's question, as in its window and /status.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGDr9oe4vpxmHBGMGLD
@lydakis lydakis self-assigned this Nov 1, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-11-01T20:19:21.866776Z 5c40b1e New commits
🔒 Security Review ✅ Completed 2026-11-01T19:54:55.666201Z 7de3b65 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 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: 7de3b65fb8

ℹ️ 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 sonny/src/main.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: b10ed32913

ℹ️ 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 sonny/src/main.rs Resolved
Comment thread sonny/src/needs.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: 71882be200

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

@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: 15a79c534e

ℹ️ 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/sky.rs Resolved
@lydakis
lydakis merged commit ac050e2 into main Nov 1, 2026
10 checks passed
@lydakis
lydakis deleted the claude/project-thread-zthhjy branch November 1, 2026 20:49
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