Skip to content

🤖 fix: send the turn-end TODO nudge only after user turns - #7503

Merged
ThomasK33 merged 4 commits into
mainfrom
todo-nudge-user-turns
Oct 25, 2026
Merged

ThomasK33 merged 4 commits into
mainfrom
todo-nudge-user-turns

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

The turn-end TODO nudge now fires only after a turn that a message the user sent started. Machine wakes (monitor matches, sub-agent reports, heartbeats, peer messages, goal continuations) no longer get it. The nudge prompt also tells the agent not to start an item that it said waits on something.

Background

A local transcript audit (2026-10-25) read every nudge in recent ~/.xum/sessions histories: 571 nudges in 20 workspaces since #6720.

  • Machine wakes started about 90% of the nudged turns. Each wake counts as its own user turn, so one coordinator workspace got 101 nudges in 3.3 days.
  • The current nudge (🤖 fix: let the turn-end TODO nudge continue with the turn's tools #7027) cost an estimated $60–71 over 3.3 days for 387 nudges, about 20% on top of the turns it followed.
  • Local sub-agents judged a sample of 118 current nudges (all 28 after a real user message, 90 random after machine wakes):
Turn started by No-op Real work List fix Harmful
A real user message (28) 22 4 1 1
A machine wake (90) 84 5 0 1

"No-op" means the agent only restated that its open items wait on someone. "Harmful" means the nudged turn started a step that its own previous message said waits on a review or a merge. This PR keeps the nudge for user turns, where it still does useful work in about 1 of 5 cases. We will re-measure in a few days and then decide whether to keep or remove the feature.

Implementation

  • streamStartedByUserMessage (todoTurnEndNudge.ts) decides, when a sent message starts its stream, whether a message the user sent started the turn: a manual send that is not synthetic. Machine wakes, goal continuations, task briefs, and compaction requests and follow-ups are automatic, so they start machine turns.
  • A resume starts a stream without a new message (resumedStreamStartedByUserMessage): an automatic resume that is not a retry, such as the prompt-free resume after a sub-agent report, is a machine turn. Auto-retries and manual resumes (Retry, an answered question) keep the current turn's origin.
  • AgentSession records the value in turnStartedByUserMessage (retries keep it) and passes it through StopContinuationProvenance. readTurnEndNudges adds the TODO nudge only when it is true. The status page nudge (🤖 feat: nudge agents to publish and update the Agent interface status page #7486) is unchanged.
  • The value starts false, so a turn whose origin is unknown gets no nudge. A user turn that compacts (on send or mid-stream) also loses its one nudge, because its follow-up is an automatic send. An earlier version inherited the origin across compaction, and review found wakes that inherited a stale user origin that way. Skipping one nudge is cheaper than nudging a machine turn.
  • The gate does not use agentInitiated: persisted heartbeat rows do not carry it.
  • Rows stored with the 🤖 fix: let the turn-end TODO nudge continue with the turn's tools #7027 prompt text still render as the compact "current" nudge row, alone and joined with the status page nudge.

Validation

  • Session tests: a turn that a background wake, a heartbeat or an automatic visible send started gets no nudge, and the next user message does. After a user turn, a compaction request (idle or auto) and a compaction follow-up get no nudge. An automatic resume after a user turn gets no nudge, and a manual resume keeps the user turn's nudge. Each gate has a test that fails without it.
  • Renderer tests: the 🤖 fix: let the turn-end TODO nudge continue with the turn's tools #7027 text collapses alone and joined with the status page nudge. The joined test fails on the old exact-match classifier.
  • Bug bash, 2 rounds x 4 charters around [mock:todo-nudge] (web, reload and workspace switching, Stop and typed input during the nudge, phone), Sonnet 5.5 explorers on the mock app AI, $0.93 + $0.79 at list price. The explorers reported no confirmed bug. Triage of their claims found the joined-row classifier defect above, which this PR fixes.

Follow-ups

  • Owner: this PR's author, at the planned re-measure in a few days. Add a session-level test that an auto-retry of a failed user turn keeps its nudge (only the pure-function table covers it now).
  • Same trigger: in the re-measure, also count user turns that lost their nudge to compaction or a restart, next to the no-op rate after user turns (baseline 22 of 28) and nudges after machine wakes (expected 0).

Risks

Low. The change only removes nudges. The worst case is a user turn that misses its nudge (after compaction, or after a Xum restart), which is the behavior before #6720.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $11.74

A transcript audit of 571 nudges (20 workspaces) found that machine wakes
(monitor matches, sub-agent reports, heartbeats, peer messages) caused about
90% of nudges. Each wake counts as its own user turn, so coordinator
workspaces got one nudge per wake. In 106 of 118 judged nudges the agent only
restated that its open items wait on someone.

- AgentSession records whether a message the user sent started the turn
  (streamStartedByUserMessage). Compaction requests and their follow-ups keep
  the previous value. The nudge runs only for those turns.
- The prompt now says not to start an item the agent said waits on something:
  two judged nudges started a step against the agent's own stated order.
- The #7027 prompt text still renders as the compact current nudge row, alone
  and joined with the status page nudge (#7486).

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$7.00`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=7.00 -->
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 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-25T17:54:12.385990Z 45d99d0 New commits
🔒 Security Review ✅ Completed 2026-10-25T18:40:00.560611Z 45d99d0 Manual request
ℹ️ 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: 4a8b7a16d7

ℹ️ 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/node/services/agentSession.ts Resolved
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

27 agent steps · 12 replayed from cache · 15 model calls · 45.8k tokens (28% cached)
Spend: $0.08 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 2 steps · 1 call 7.0s
🟢 a chat survives a restart of the server 2 steps · 1 call 7.0s
🟢 compaction.e2e.ts · 1 passed 3 steps · 1 call 9.7s
🟢 /compact replaces the old chat with a summary 3 steps · 1 call 9.7s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.5s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.5s
🟢 settingsRoundTrip.e2e.ts · 1 passed 3 steps · 1 call 12.0s
🟢 a chat survives trips through Settings 3 steps · 1 call 12.0s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.0s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.0s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.7s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.7s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 7.0s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 7.0s
🟢 todoNudge.e2e.ts · 1 passed 2 steps · 1 call 5.4s
🟢 the agent finishes open TODO items after the turn-end nudge 2 steps · 1 call 5.4s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 27.1s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 5.5s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.4s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.2s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.1s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 6.8s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.0s

e2e 0.20.0 · 1m 28s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (33% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 7.6s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 7.6s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 6.0s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 6.0s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 12.7s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 12.7s

e2e 0.20.0 · 28.6s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.6s · 2 targets (web, phone) · run artifacts

Codex review on #7503: resumeStream starts a stream without a new message, so
the prompt-free resume after a sub-agent report (taskService) kept the earlier
user turn's origin and still got the TODO nudge. An automatic resume that is not
a retry now records a machine turn. Auto-retries and manual resumes (Retry, an
answered question) keep the current turn's origin.

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$11.74`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=11.74 -->

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

ℹ️ 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/node/services/agentSession.ts Resolved
…TODO nudge

Codex review on #7503: every compaction request kept the previous turn origin,
so a heartbeat that compacts after a user turn kept "user" through its
follow-up and still got the TODO nudge. Only an auto-compaction request
(on-send or mid-stream) continues the current turn now. An idle-compaction
request (idle or heartbeat) is a fresh synthetic send: a machine turn.

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$11.74`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=11.74 -->

@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: 95c860b3df

ℹ️ 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/node/services/agentSession.ts Resolved
Comment thread src/node/services/agentSession.ts Resolved
…ODO nudge

Codex review on #7503 found two more ways the inherited turn origin went
wrong: an automatic send that is not synthetic (a task brief) counted as a user
turn, and a wake compacted on send passed a stale user origin on through its
auto-compaction request. Instead of inheriting the earlier origin across
compaction, a send now starts a user turn only when it is manual and not
synthetic. Compaction requests and follow-ups are automatic, so a user turn that
compacts loses its one nudge, which fails closed.

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$11.74`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=11.74 -->
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 45d99d031a

View security finding report

Only the user who started this review can view the report in Codex.

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

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 25, 2026
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 25, 2026
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit adb10f5 Oct 25, 2026
64 of 66 checks passed
@ThomasK33
ThomasK33 deleted the todo-nudge-user-turns branch October 25, 2026 20:14
ibetitsmike added a commit that referenced this pull request Oct 25, 2026
The status page nudge classifier keeps both variants and, like main, accepts
any current TODO nudge text (earlier ones included) before either variant.
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