Skip to content

feat(claude-code): enable task tools and replay their plan on reopen - #976

Merged
BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
ump45nose:pr/claude-code-todo-tools
Nov 21, 2026
Merged

BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
ump45nose:pr/claude-code-todo-tools

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Summary

Claude Code's SDK sessions don't get the native task tools, and when a Thread is reopened its plan disappears from Desktop.

  • Enable task tools. Claude Code is launched with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 unless the user already set it, so non-interactive sessions get TaskCreate / TaskGet / TaskList / TaskUpdate. CLAUDE_CODE_ENABLE_TASKS stays unset because it hides them again. These already feed the Codex plan panel live through the task tracker.
  • History. Replaying Claude history now runs root task tool results through the same ClaudeTaskTracker, projects them as Todo plan items, and a resumed Session continues the restored task list. TaskGet refreshes the read task like TaskList. An explicit empty list clears the plan.
  • Reopen. Desktop rebuilds a plan only from turn/plan/updated, never from Thread history. On thread/resume and thread/read with turns, the Host now replays the latest plan: the live plan if a Turn is active, otherwise the last plan in history (historicalPlanUpdate in protocol-core). The plan is kept off the Turn objects sent to clients.
  • No Harness name in the Host. Only Harnesses whose plan outlives its Turn should get this replay. A new optional session capability persistentPlan says so; Claude Code sets it, and other Harnesses keep plans with the Turn that made them.

Related issues

Builds on #917 (MCP tool and web search items), which touched the same history mapping.

Test plan

  • On current main: npx tsc -b passed; node tools/check-boundaries.mjs passed; prettier and eslint clean on the changed files.
  • npx vitest run --config tests/vitest.config.js on the Claude Code adapter tests, codex-ui-projector, app-server-host.projection-4 and shared-contracts: 912 passed, 3 skipped. New cases cover: the env default and a user override; task tools across Turns in history; a resumed Session continuing the task list; replay on reopen only when persistentPlan is set; replaying the active Turn's live plan; clearing from an empty list.
  • npm run lint reports 3 errors in antigravity/test/acp-transport.test.ts and app-server-host.background-output.test.ts, which this PR doesn't touch; they are on current main.
  • The feature has run in my fork's Desktop builds since v0.21.0; the persistentPlan capability is new in this PR.

Launch Claude Code with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 unless the user set it,
so SDK sessions get TaskCreate/TaskGet/TaskList/TaskUpdate. History replay now
feeds root task tool results through the shared task tracker and projects them
as Todo plan items, and TaskGet refreshes the read task like TaskList.

Desktop restores a plan only from turn/plan/updated, so the Host replays the
latest plan when a Thread is reopened. A new optional persistentPlan session
capability marks Harnesses whose plan outlives its Turn; Claude Code sets it.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

… clear, index by Turn ID

Side Chat now replays plans only from ownTurns so hidden inherited Turns are not exposed; empty Todo clear notifications fire only when the tool succeeds; historical plans are stored by Turn ID instead of a Turn-object WeakMap so shallow copies keep their plan.
@BytePioneer-AI
BytePioneer-AI merged commit 1152905 into BytePioneer-AI:main Nov 21, 2026
4 of 7 checks passed
@BytePioneer-AI

Copy link
Copy Markdown
Owner

Merged, thanks @ump45nose! Verified against real Claude Code 2.1.328 (Haiku 4.5): parallel TaskCreate calls, cold Host restart + thread/resume plan replay (including excludeTurns: true), task completion and empty TaskList clearing all worked cleanly. Added one follow-up commit before merging: Side Chat plan replay now filters to ownTurns, empty Todo clears only fire on succeeded tool completion (avoiding false clears on failed generic todo_write), and historical plans are indexed by Turn ID instead of a Turn-object WeakMap.

BytePioneer-AI added a commit that referenced this pull request Nov 21, 2026
…eview findings

Resolve conflicts with main (preserving dfe3d82 trailing background promotion alongside independent autonomous wake Turns, #944 live WAL fork, #996 legacy merged Turn identities, #976 Turn-ID plan replay, and #942 request-level TTFT); validate turn.autonomous.completed strictly in harness-broker; isolate autonomous Turn recording/projection failures from foreground Turns and retry stale history reads; keep wake-observer polling until the window deadline so a notified-but-uncommitted wake is not dropped after publishing an earlier wake.
BytePioneer-AI added a commit that referenced this pull request Nov 21, 2026
…sertions

Keep #976's historicalPlanUpdate export and historicalPlans/livePlan state plus #1001's retry loop in ExternalThreadRuntime.#refresh alongside live Item ID reconciliation; replace four non-null assertions in external-turn-item-ids.ts so ESLint passes.
ump45nose added a commit to ump45nose/codex-host that referenced this pull request Nov 27, 2026
Eleven manifest lines still carried fork copies of changes that upstream has
already released. Each one names a merged PR whose head commit is an ancestor
of v0.28.2, so the line only re-applies the pre-review copy of code that the
release tag already contains, and that duplication is what turns the manifest
replay into conflicts.

Removed lines and their merged PRs:

- thin/cursor-fast-selection (BytePioneer-AI#782)
- thin/delegation-inspect-fast-models (BytePioneer-AI#986)
- thin/delegation-catalog-parent (BytePioneer-AI#970)
- thin/settings-hide-desktop-envs (BytePioneer-AI#972)
- thin/settle-turns-after-session-fault (BytePioneer-AI#969)
- thin/external-thread-turn-recency (BytePioneer-AI#973)
- thin/claude-code-todo-tools (BytePioneer-AI#976)
- thin/reasoning-summary-parts (BytePioneer-AI#967)
- thin/shared-archived-thread-revival (BytePioneer-AI#988)
- fix/desktop-mcp-session-reap-v0.22 (BytePioneer-AI#981)
- fix/macos-descriptor-mode (BytePioneer-AI#1004)

For the two lines whose comments noted that the fork copy predated the PR's
review changes (BytePioneer-AI#969, BytePioneer-AI#976), the reviewed upstream version replaces it.

Checked with `scripts/vincent-release.sh audit` (ancestor and patch-cherry
checks) and by replaying the manifest onto v0.28.2 in a scratch worktree: these
eleven lines no longer merge, and the fifteen remaining lines are fork-only
changes that need re-cutting from the new tag.

Lines for fork-only additions are untouched: the extras documented for BytePioneer-AI#470,
BytePioneer-AI#987 and BytePioneer-AI#989 stay, and the lines for the closed PRs BytePioneer-AI#576, BytePioneer-AI#783, BytePioneer-AI#784, BytePioneer-AI#785 and
BytePioneer-AI#396 stay.
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.

2 participants