Skip to content

🤖 fix: record which attempt wrote a task's report, so a fresh attempt's own report is never read as inherited - #8102

Open
ThomasK33 wants to merge 3 commits into
mainfrom
fix/report-attempt-binding
Open

ThomasK33 wants to merge 3 commits into
mainfrom
fix/report-attempt-binding

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

A task row now records which attempt wrote its report, and the stream-end decision counts a report that names the attempt as the attempt's own. Before, one sequence on two backends let a held follow-up run as a new turn of a reported attempt. This closes the limit named on InheritedReport in #8067.

Background

#8067 tells an attempt's own report from an inherited one by the row's status. Only a row that read interrupted could be reported again, so a report that turned it reported was the attempt's own. A reported row's report was treated as inherited for good.

That fails in one sequence:

  1. A reactivation or reawakening gives a fresh attempt F a row that already reads reported.
  2. A failure turns the row interrupted and keeps its report time (failAgentTaskTerminally has no completed-report guard).
  3. Another backend reports F. finalizeAgentTaskReport ends early only on a reported row, so it writes reported.
  4. The row reads reported again, the same as when F began. The decision resolves nonreport, and a held follow-up runs as a new turn of a reported attempt.

The row said that a report exists, never whose it is.

Implementation

  • Field: taskReportAttemptId on the workspace row (server-owned, a bare attempt id). Not part of WorkspaceMetadata.
  • Writers: the two code paths that set reportedAt, publishAgentTaskReport and adoptPersistedReport, write the row's taskAttemptId into it in the same config edit. A superseded or retired report returns before the write, so it writes none. A row without an attempt id gets none.
  • Reader: StreamEndLedger.rowReportsAttempt keeps the status rule and adds one clause: statusRule || row.taskReportAttemptId === attemptId. A binding can only add a refusal. It never turns a case the status rule refuses into one it allows, so the same-millisecond case that 🤖 fix: tell an attempt's own report from an inherited one by the row's status #8067 pinned stays indeterminate whatever the binding says. The second reader, resolveDecisionOfReportedAttempt, gets the added case and nothing else.
  • Load: normalizePersistedWorkspace drops a value that is not an attempt id (hand edit, corruption). A dropped value reads as absent.
  • Metadata round trip: the copy list in config/index.ts keeps the field, like taskTerminalFailure.
  • Old rows: a row reported before this change has no field and gets the status rule alone. No backfill.

Validation

  • Real-host tests (taskService.reportDecisionHold.test.ts) hold the stream-end handler on the workspace event lock, change the row meanwhile, and let a second TaskService on the same config report. The failure is a raw row edit, because failAgentTaskTerminally on the owning backend also closes the attempt's admission, which is a different refusal. Two sequences end in a held follow-up with reason indeterminate and one stream: reported row, failure, then another backend's report. And interrupted row, another backend's report, then a failure. A control with a binding that names the predecessor still runs the follow-up. A superseded report writes no binding.
  • Ledger tests (streamEndLedger.test.ts): binding variants (names the attempt, names another attempt, absent) of the inherited-report and replaced-report cases, including the same-millisecond case, plus four cases in which a binding that names the attempt turns the decision indeterminate.
  • Writer test (taskService.agentReports.waits.test.ts): adoption writes the binding, and writes none for a row without an attempt id.
  • Config tests (config.test.ts): the field survives reload and a metadata write, and a malformed value is dropped at load.
  • Mutation proofs: ignoring the binding in the reader (the behavior on main) turns six tests red. Letting the binding replace the status rule turns the same-millisecond binding case red. Dropping either writer, the copy-list line or the load heal each turns its own tests red.

Risks

Behavior changes only in the sequence above, and only toward a refusal: the held follow-up is kept as held input instead of running, the same outcome as any other unconfirmed attempt.

Downgrade and mixed builds are safe, and the change is additive. A build without this change ignores the field and may drop it in a metadata round trip, which makes the row an old row. Such a build falls back to today's status rule: the reported-then-failed-then-reported sequence above is then refused as little as it is on main today. If that build reports after a new build wrote the field, the field names an earlier attempt, adds nothing, and the status rule applies as before. A stale value can only name an attempt that did write a report, so it cannot cause a wrong refusal.

I merged main (#8076 and later) into this branch. The merge had no conflicts. The gap tests use the event lock, not the plan-like probe, so they hold with #8076's probe change.


Generated with xum • Model: anthropic:claude-sonnet-5-5 • Thinking: xhigh • Cost: $56.01

… own report is never read as inherited

The status rule cannot tell an attempt's own report from an inherited one when a failure turned a
reactivated reported row interrupted and another backend's report turned it back. The row now
carries the attempt that wrote its report (taskReportAttemptId, written with reportedAt), and the
ledger counts a report that names the attempt as its own on top of the status rule. A binding can
only add a refusal. Load drops a malformed value.
Write the binding unconditionally (an absent attempt id writes undefined), and check the row's
attempt id and its binding with one predicate before the load heal.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T17:14:42.305278Z 46d1213 Manual request
🔒 Security Review ✅ Completed 2026-11-10T17:15:52.751668Z 46d1213 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.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 4ec30ca644

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 4ec30ca644

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.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 47.3k tokens (27% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

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

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

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (32% 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.0s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 7.0s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 7.4s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 7.4s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 6.9s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 6.9s

e2e 0.20.0 · 24.4s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

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

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

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

Merged main (#8076 and later) into this branch. Head: 46d1213

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 46d1213436

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 46d1213436

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.

This branch has not been deployed

No deployments
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