Skip to content

fix(server): Claude /compact and Claude-initiated turns no longer end the user's turn; subagents show their own model - #973

Merged
rynfar merged 3 commits into
pylonfrom
upstream/2026-10-01-claude-turns-grok
Oct 1, 2026
Merged

rynfar merged 3 commits into
pylonfrom
upstream/2026-10-01-claude-turns-grok

Conversation

@rynfar

@rynfar rynfar commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Two Claude adapter bugs from upstream apply to Pylon:

  • After a resume, Claude can first run a turn of its own, such as a task notification for a background task the previous process left behind, and only then run the user's queued prompt. Pylon completed the user's turn on that first result. A queued /compact then ran with no turn open and the thread looked busy afterwards. Pylon's zero-turn handshake guard hides this only when the notification turn makes no model request. A notification that Claude answers ends the user's turn early.
  • A subagent with its own model showed the parent session's model in the Agents panel. The correction waited for the next task row, which could be minutes away. A task launched from inside a subagent never found its owner.

Fix

  • handleResultMessage ignores a result that answers a different Claude turn. A result for another turn echoes prompt uuids that do not include the active turn id, or it echoes nothing and has a non-human origin. Results from older CLIs with neither field still complete the turn. Synthetic turns are unchanged. Pylon steers send no uuid, but the SDK's user_message_uuids keeps the turn's own prompt uuid alongside any folded-in steer, so steered turns still complete.
  • When a subagent's assistant snapshot changes its model, Pylon emits a metadata-only task.updated at once. A bounded tool_use_id → parent_tool_use_id map lets task_started find the owning subagent and seed a nested agent with its owner's model. Pylon's resume carry-over (previousAgent.model) still ranks above the owner's model.

The Claude adapter edits stay out of startSessionInternal, except for two lines that add the new map to the session context. They merge cleanly with fix/claude-resume-unsaved-first-turn.

Sources (upstream cycle #967)

Source Subject Disposition
9da066dbe906310671b86290b09df0b56a88ffa5 (#14497) Claude /compact no longer ends early and leaves the thread busy Adopted. The upstream test was adapted so the notification turn makes a model request, because Pylon's handshake guard already covered the num_turns: 0 form. Added a steered-turn regression test.
7ab800a43c770b2c48a2d9306c89b6177f61ad4a (#14540) Claude subagents with their own model no longer show the parent's model Adopted. Pylon's offerRuntimeEvent(sessionIncarnationId, …) signature and resume model carry-over were kept.
bd89c1302026255c62cc09278207bfaf2664da4a (#14486) Grok CLIs older than 1.0.13 marked broken Skipped. The change edits only the manifest compatibility ranges. Pylon's manifest has no compatibility section because the version-compatibility pipeline (96c4bfa0a2, d4cd7d5c33) is still held, and Pylon has no Grok version floor. Pylon's only CLI floor is the provider-local MINIMUM_CODEX_CLI_VERSION in CodexProvider.ts. Follow-up candidate: a matching provider-local Grok floor (>=1.0.13, because xAI returns 426 Upgrade Required to older CLIs) in GrokProvider.ts.

Verification

  • vp test run src/provider/Layers/ClaudeAdapter.test.ts: 184 passed. Run with CLAUDE_CODE_ENABLE_TODO_TOOLS unset, since the harness host leaks it into one existing env test.
  • Fail-before checks:
    • With the other-turn guard disabled, keeps a turn open past the result of a Claude-initiated turn and completes a steered turn from a result that echoes its folded-in prompts fail.
    • With the pre-#14540 adapter, task.started carries model/effort; subagent snapshots refine the model fails.
  • vp run -F t3 typecheck passes. vp check on the changed files passes.
  • git merge-tree with fix/claude-resume-unsaved-first-turn: clean.

Backend only, no UI evidence.

Claude Opus 5.5 in Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

t3dotgg and others added 3 commits October 1, 2026 00:53
…ad busy (#14497)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 9da066dbe906310671b86290b09df0b56a88ffa5)
… parent's model (#14540)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 7ab800a43c770b2c48a2d9306c89b6177f61ad4a)
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 14.0 KiB 14.0 KiB +7 B (+0.0%) 15.1 KiB ✅
Codex Thread snapshot wire 7.3 KiB 7.3 KiB −13 B (−0.2%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.7 KiB 6.7 KiB +20 B (+0.3%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 58.0 KiB 58.0 KiB +44 B (+0.1%) 66.4 KiB ✅
Codex Live turn messages 9 10 +1 (+11.1%) 21 ✅
Claude Total thread wire 14.0 KiB 14.0 KiB +17 B (+0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.3 KiB 7.3 KiB −6 B (−0.1%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.7 KiB 6.8 KiB +23 B (+0.3%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 58.9 KiB 58.9 KiB +44 B (+0.1%) 66.4 KiB ✅
Claude Live turn messages 9 10 +1 (+11.1%) 21 ✅

Baseline: f677ed4 · PR result: 7087ffa · 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: 115.7 KiB
  • Claude decoded thread snapshot: 116.4 KiB

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

@rynfar
rynfar merged commit b03001a into pylon Oct 1, 2026
16 checks passed
@rynfar
rynfar deleted the upstream/2026-10-01-claude-turns-grok branch October 1, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 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