fix(server): settle completed delegated tasks left working#32284

draft2
main
issue-watch/32235
opened4d agobySshivam
View on GitHubTwo-way sync enabledPR last imported 11h ago

Refs https://github.com/pingdotgg/t3code/issues/32235

A completed delegated child can leave its parent's Agents row marked Working. Row Stop skipped original tasks and tasks with a bound child run, even when that run had finished, while task_cancel reported completed from the child.

Stop now uses the existing finalizer to settle the task, node and turn item with the child's actual result. Startup recovery also repairs an active original task whose result transfer already exists. Both paths release a disposed task's reserved parent wake, cancel an undelivered queued wake when appropriate, and preserve deliveries for remaining sibling tasks without publishing the result again.

At head 20c0daa0ce1dca6da55965ee4714c6416f9057c3 against base 0bba3684b83ed359b465cd39c53ff2fb797841ad, Boat ran the repo's check:changed successfully: format, lint, knip, GraphQL checks, typecheck of three packages and six test files, with 120 tests passing. Full GitHub CI also passed at that head. A fresh second review found no remaining code findings and independently passed 86 tests in ThreadStop and DelegatedCompletionDelivery. The original regression had four failures before the fix. The reserved-wake regression also failed before its correction, and the final tests cover an already queued wake. Ten neighbouring suites passed 173 tests on the corrected tree before rebasing over two unrelated mobile fixes.

This is a draft. Required iOS before/after evidence is missing. The last device_open attempt on shiv failed because Simlock had reached its two-device capacity; this task owned no session to close. The initial missed-completion trigger and its relationship to compaction remain unproven. Full task IDs remain opaque. Reading task_status or stopping the whole parent alone does not perform this repair; row Stop, task_cancel or startup recovery does.

Implemented with Claude Opus 5.5 in T3 Code's Claude harness. Investigated and tested with GPT-6.1 Sol in T3 Code's Codex harness.

Checks

20 successful · 7 skipped
All checks passed
20c0daa

Added 2 commits

  • fix(server): settle finished delegated tasks left working1b49888
  • fix(server): release reserved wakes when repairing delegated tasks20c0daa
Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
CodexLive turn WebSocket decoded21.5 KiB21.5 KiB0 B (0.0%)24.4 KiB✅
CodexLive turn messages110 (0.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
ClaudeLive turn messages110 (0.0%)8✅

Baseline: 0bba368 · PR result: 20c0daa · 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.