Skip to content

fix(coding-agent): bind spawn provenance to the selected branch - #145

Merged
Issacboy123 merged 2 commits into
fix/propagate-child-prompt-signalfrom
fix/bind-selected-branch-spawn-origin
Aug 29, 2026
Merged

Issacboy123 merged 2 commits into
fix/propagate-child-prompt-signalfrom
fix/bind-selected-branch-spawn-origin

Conversation

@Issacboy123

@Issacboy123 Issacboy123 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Spawn provenance searched all persisted entries, so reused tool-call identifiers could bind a child to an older or abandoned assistant turn. This PR resolves the origin from the newest matching spawn_agent call on the currently selected branch while retaining fail-closed behavior when no match exists.

Reasoning

The selected branch is the authoritative history for the active model call. Traversing it newest first handles identifier reuse without changing stored sessions or requiring globally unique IDs, and matching the tool name as well as the identifier prevents collisions with other tools. Keeping the no-match rejection avoids inventing provenance when current history cannot support it.

Changes

  • Replaced global persisted-entry matching with newest-first selected-branch traversal.
  • Required both the executing tool-call identifier and the spawn_agent tool name to match.
  • Preserved existing origin fields for matched calls and the invariant rejection for unmatched active spawns.
  • Added regressions for reused identifiers, same-ID calls to other tools, abandoned branches, and no-match rejection.
  • Recorded the provenance fix in the changelog.

Testing

  • node ../../node_modules/vitest/dist/cli.js --run test/suite/subagent-registration.test.ts
  • node ../../node_modules/vitest/dist/cli.js --run test/suite/agent-session-prompt.test.ts test/suite/subagent-services.test.ts test/suite/subagent-registration.test.ts test/suite/subagent-coordination.test.ts test/suite/subagent-parent-messaging.test.ts test/subagent-controller.test.ts
  • node ../../node_modules/vitest/dist/cli.js --run test/session-manager/tree-traversal.test.ts
  • npm run check

@Issacboy123 Issacboy123 self-assigned this Aug 28, 2026
@Issacboy123 Issacboy123 added bug Something isn't working coding-agent labels Aug 28, 2026
@Pepps233
Pepps233 self-requested a review August 28, 2026 15:34
@Issacboy123
Issacboy123 force-pushed the fix/bind-selected-branch-spawn-origin branch from c4bb46b to 215e46d Compare August 29, 2026 10:37
@Issacboy123
Issacboy123 merged commit 14a23bd into main Aug 29, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working coding-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants