# fix\(server\): settle durable native subagents from terminal receipts · PR \#21724 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/21724)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: open

Source repository: pingdotgg/t3code

Source branch: claude-13/native-task-reconciliation

Target branch: main

Head commit: ac83029f2f56a593085120c2ccacc3cae79ba57e

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/21724)

[Commits](https://git.cafe/pingdotgg/t3code/pull/21724/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/21724/diffs?format=markdown)

## Description

---

## Problem

A provider can report that an old native subagent ended after its process was replaced. Durable tasks and their child work then remain running because the replacement process cannot reconstruct the old task’s lifecycle rows.

## Change

Add an internal terminal receipt that the session pump persists even between runs. Reconcile the matching active native task, parent node/items, and child roots/items while preserving the original owner and leaving unrelated work alone. Republish the receipt so an active run releases inherited background tracking without ingesting it twice. This is the foundation layer; [#21725](https://github.com/pingdotgg/t3code/pull/21725) emits these receipts from Claude.

Rebuilt from @luke2x’s [original contribution](https://github.com/pingdotgg/t3code/pull/17921), with author credit in both replacement PRs and Co-authored-by attribution in the carried commits. Please preserve Luke’s release-note credit when this lands.

## Scope and approval

Addresses the accepted session-replacement gap in [#18877](https://github.com/pingdotgg/t3code/issues/18877), which prompted the maintainer to [reopen the original PR](https://github.com/pingdotgg/t3code/pull/17921#issuecomment-6136282276). Stop without a terminal receipt remains outside scope. Live authenticated handoff and native-client verification remain outstanding; the evidence below is integrated SDK replay. Prepared for review, unmerged. The foundation layer still requires human approval for its orchestration lifecycle changes; previous bot approval is not a substitute for that decision.

## Verification

[Current-head CI results](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/71a7cdb74d324a24/17921-final-ci-proof.json): latest complete validation passed on both heads; CodeRabbit completed, with all actionable threads fixed or explained and resolved. The upper layer has an older superseded run whose aggregate check failed solely because its dependencies were cancelled. Scoped optional jobs were skipped; cancelled duplicates are not reported as passing. Human lifecycle approval remains outstanding.

- Bottom independently: 155 focused tests passed. Full stack: [448 tests passed](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/fbe2f552990911cc/17921-implementation-r2-integrated-tests.log); targeted lint, formatting, and server typecheck passed.
- [Before-fix service failures](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/2a3b30d02aeb3cf6/17921-bottom-red.log): durable task and idle-pump task remain running, and inherited tracking does not release; all are assertion failures without sleeps or intended timeouts.
- Five added cases across the full stack replace eight original cases; an existing manager test was strengthened. Main’s tests remain. The original one-off integration file was replaced by cases in an existing suite. Baseline comparison: 451 cases across six executed files → 448 across five; the original baseline had one timeout in an unchanged main test, which passed in stable final runs.
- CI follow-up: the unchanged attachment HTML browser test failed twice while its lazy source module finished outside React `act`. The existing test now awaits that module inside `act`, preserving all assertions. [Three browser cases pass locally](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8e2f8ce221376dc4/17921-primary-web-r2.log); the historical CI failure was not reproduced locally; fresh full Web CI and Check now pass on this head. No production web change.
- [Primary proof and limits](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/dfaca8b99084e334/17921-proof-final.json): headless SDK replay through production services and SQLite. This is a backend state correction; screenshots do not prove it. The external SDK stream is stubbed. No live authenticated Claude handoff, macOS, Windows, Electron desktop, iOS, Android, or remote/tunnel verification was performed.

Models/harness: GPT-6 Astra for test reduction, GPT-6.1 Sol for implementation/integration (Codex); three independent full-stack review rounds by Claude Opus 5.5 (Claude Code) and GPT-6 Sol (Codex); both final reviewers found no code issues, including the replay and browser-test fixes.

