Skip to content

fix(server): publish committed events before writer cancellation - #24836

Merged
Yash-Singh1 merged 1 commit into
mainfrom
fix/subagent-lineage-failure-publication
Oct 25, 2026
Merged

Yash-Singh1 merged 1 commit into
mainfrom
fix/subagent-lineage-failure-publication

Conversation

@Yash-Singh1

Copy link
Copy Markdown
Collaborator

Problem

If a writer was canceled after its database transaction committed but before it published the events, subscribers missed the committed events. A failed child run could then leave its parent task running.

Change

Keep the commit and event publication sequence uninterruptible while allowing cancellation during the transaction itself. Add regression coverage for transaction cancellation, transaction failure, and cancellation during publication, plus delegated task recovery after an unpublished child failure.

Scope and approval

This is a focused fix for an event consistency bug: cancellation could separate a committed transaction from its publication, leaving projections stale and delegated tasks unsettled.

Verification

  • Focused server tests passed: 124 tests across four files, including the persistence and delegated completion tests.
  • Server typecheck passed.
  • Formatting and diff checks passed. Targeted lint reported two polling-loop warnings in FoundationPersistence.test.ts.

- Keep event publication consistent when a committed write is interrupted
- Recover child failures whose completion delivery was disposed
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 25, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 9456348

Macroscope's review found this PR approvable — This is a localized server bug fix that preserves transaction cancellation while guaranteeing publication of already-committed events. Regression tests cover transaction failure, cancellation, publication ordering, and delegated-task recovery without introducing new production components or schema changes.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB +7 B (+0.1%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +7 B (+0.6%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: dca46e2 · PR result: 9456348 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c8231f9 and 9456348.

Files selected for processing: 3
  • apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
  • apps/server/src/orchestration-v2/EventSink.ts
  • apps/server/src/orchestration-v2/FoundationPersistence.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The event sink now limits interruptibility to the transaction, and persistence tests cover cancellation and failure around commit and publication. A delegated-task recovery test checks recovery of a committed child failure when live publication is absent.

Changes: Event persistence

Layer / File(s) Summary
Transaction and publication boundary
apps/server/src/orchestration-v2/EventSink.ts, apps/server/src/orchestration-v2/FoundationPersistence.test.ts
commitThenPublish restores interruptibility for the transaction and keeps lane acquisition, publication, and lane release uninterruptible. Tests cover cancellation or failure before commit and cancellation during publication, including event and projection consistency.

Delegated-task recovery

Layer / File(s) Summary
Recovery of an unpublished child failure
apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts
The test checks that recovery records a committed child failure and its result, preserves disposed delivery, creates one run and one subagent-result transfer, and does not change the projection on a second recovery.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code issue 23412: The test covers recovery of a failed delegated task, but it does not add carry-over of the child’s finished output described in the issue.

Suggested labels: bugfix, size:S

Suggested reviewers: macroscopeapp, juliusmarminge

Merge Risk: Minimal · up to 94563

The reviewed paths preserve publication after a committed write and recover the unpublished child failure. No merge-blocking issue was identified; proceed with normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title "fix(server): publish committed events before writer cancellation" follows conventional commit format and names the main change: committed events are published even when a writer is canceled…
Description check Passed The description follows the template structure with Problem, Change, Scope and approval, and Verification sections. The Problem and Change sections clearly explain the defect and the fix. The Verifica…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(server): publish committed events before writer cancellation" follows conventional commit format and names the main change: committed events are published even when a writer is canceled. The changeset makes commit-and-publish uninterruptible (EventSink.ts) and adds regression tests for transaction cancellation, failure, publication cancellation, and delegated task recovery. The title is specific and related to the main change, though it omits the delegated-task recovery aspect, which is expected.

Full details: Description check

Explanation

The description follows the template structure with Problem, Change, Scope and approval, and Verification sections. The Problem and Change sections clearly explain the defect and the fix. The Verification section lists focused test counts, typecheck, and lint results. The Scope and approval section describes the fix as focused but does not link a triaged bug issue or maintainer approval, which the template asks for. The template also asks for an explanation of why a very small fix qualifies without a prior issue. That gap is non-critical for this assessment, so the description is mostly complete.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Yash-Singh1
Yash-Singh1 merged commit 30fd973 into main Oct 25, 2026
29 checks passed
@Yash-Singh1
Yash-Singh1 deleted the fix/subagent-lineage-failure-publication branch October 25, 2026 10:11
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 25, 2026
## What's Changed
* fix(mobile): one way to select a page, so split view stops pushing by @juliusmarminge in pingdotgg/t3code#24742
* fix(mobile): Settings pages no longer flicker when switching beside the list by @juliusmarminge in pingdotgg/t3code#24749
* fix(server): use Codex native collaboration modes by @t3dotgg in pingdotgg/t3code#24737
* fix(clients): threads no longer flash in the inbox before they settle by @t3dotgg in pingdotgg/t3code#24760
* fix(mobile): the iPhone compose icon matches the tab icons' size by @juliusmarminge in pingdotgg/t3code#24650
* feat(infra): share Vite task cache with Axiom savings telemetry by @juliusmarminge in pingdotgg/t3code#24693
* fix(mobile): screen lists register with their header, enforced by lint by @juliusmarminge in pingdotgg/t3code#24710
* feat(mobile): search Settings, and keep its sidebar header clean by @juliusmarminge in pingdotgg/t3code#24766
* fix(mobile): threads open with less waiting, and the Threads tab remembers drafts by @juliusmarminge in pingdotgg/t3code#24750
* fix(mobile): reduce diff entry and source highlighting delays by @juliusmarminge in pingdotgg/t3code#24770
* perf(client): skip unchanged shell and config cache writes by @juliusmarminge in pingdotgg/t3code#24266
* fix(mobile): remove perpetual reconnect indicator animation by @juliusmarminge in pingdotgg/t3code#24273
* feat(mobile): close the keyboard from the Duo's side bar by @t3dotgg in pingdotgg/t3code#24696
* fix(mobile): dispatch native toolbar actions to current handlers by @juliusmarminge in pingdotgg/t3code#24271
* fix(server): PR watch wakes say the PR stays linked and watched by @t3dotgg in pingdotgg/t3code#24781
* feat(server): thread tools return a ready t3-thread link by @t3dotgg in pingdotgg/t3code#24784
* fix(server): running task results tell the agent to end its turn by @t3dotgg in pingdotgg/t3code#24782
* fix(server): mobile push no longer says "completed" between runs by @t3dotgg in pingdotgg/t3code#24769
* fix(server): delegated children no longer see pull request watch tools by @t3dotgg in pingdotgg/t3code#24808
* fix(mobile): search stays open after going back from a thread by @t3dotgg in pingdotgg/t3code#24748
* feat(server): request_secret can save a CLI token to a private file by @t3dotgg in pingdotgg/t3code#24809
* fix(server): threads settle right after a shell merge of an unlinked PR by @t3dotgg in pingdotgg/t3code#24830
* fix(server): worktree setup no longer hangs when a shell startup prompt eats the command by @t3dotgg in pingdotgg/t3code#24775
* feat(server): link pull requests agents create from the shell by @t3dotgg in pingdotgg/t3code#24813
* fix(mobile): queue Steer button no longer opens the editor on a near miss by @t3dotgg in pingdotgg/t3code#24832
* fix(usage): Gemini 4 Argon usage from Antigravity now has a price by @t3dotgg in pingdotgg/t3code#24834
* fix(server): publish committed events before writer cancellation by @Yash-Singh1 in pingdotgg/t3code#24836
* fix(web): shared dev servers no longer crash on lazy routes by @t3dotgg in pingdotgg/t3code#24839
* fix(web): chat tables and subagent rows line up by @t3dotgg in pingdotgg/t3code#24835
* perf(shell): cold connects skip older settled threads, 93% of the shell JSON by @t3dotgg in pingdotgg/t3code#24723
* test(server): restart replay tests no longer hang on a leftover checkpoint capture by @t3dotgg in pingdotgg/t3code#24851
* feat(web): Settings and Usage open as large modals over your thread by @t3dotgg in pingdotgg/t3code#24847
* fix(server): forked threads get titles from the history they inherit by @t3dotgg in pingdotgg/t3code#24857
* fix(release): desktop builds pass again after the vite-plus 1.4 upgrade by @t3dotgg in pingdotgg/t3code#24867
* feat(server): cut T3's agent instructions and tool copy by 60% by @t3dotgg in pingdotgg/t3code#24850


**Full Changelog**: pingdotgg/t3code@v0.1.3-nightly.20261025.3655...v0.1.3-nightly.20261025.3669

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.3-nightly.20261025.3669
Pipyakas pushed a commit to Pipyakas/t3code that referenced this pull request Oct 25, 2026
@zainmitchell

Copy link
Copy Markdown

Factory catalog cross-reference — 2026-10-26. Already-upstream foundation: publishing committed events before writer cancellation matters to durable native coordination. This merged support is already in the factory’s official nightly 3669 base.

Factory Ideas · Pinned fork source/guide · Source release. Version-pinned community experimental source preview; full lifecycle acceptance remains open. No upstream endorsement or current-PR-head test acceptance is claimed.

Prepared with GPT-6.1 Sol through Codex in T3 Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants