Skip to content

fix(sessions): stop duplicating the kickoff prompt on native sub-agents#698

Open
brandonhawi wants to merge 1 commit into
omnigent-ai:mainfrom
brandonhawi:fix/native-subagent-kickoff-duplicate
Open

fix(sessions): stop duplicating the kickoff prompt on native sub-agents#698
brandonhawi wants to merge 1 commit into
omnigent-ai:mainfrom
brandonhawi:fix/native-subagent-kickoff-duplicate

Conversation

@brandonhawi

Copy link
Copy Markdown

Related issue

Closes #697

Summary

Creates an integration test to reproduce issue 697 and the very small fix to address it.

Type of change

  • Bug fix
  • Feature
  • Refactor / chore
  • Docs
  • Test / CI
  • Breaking change

Test coverage

  • Unit tests added / updated
  • Integration tests added / updated
  • E2E tests added / updated
  • Manual verification completed
  • Existing tests cover this change
  • Not applicable

Coverage rationale

Added a test.

A native terminal session (claude-native / codex-native) has a single
writer for its conversation history: the transcript forwarder, which
mirrors every user prompt the CLI logs back into the conversation. The
follow-up message path already respects this via the
_is_native_terminal_session bypass, but the session-create path forwarded
initial_items through _forward_event_to_runner unconditionally, which
persists the prompt AP-side. The forwarder then echoed the same prompt,
so the kickoff rendered twice.

Route create's initial_items through _dispatch_session_event_to_runner so
native sessions take the same single-writer bypass: the prompt is
delivered to the harness but not persisted AP-side, leaving the forwarder
as the sole writer. Non-native sessions still persist-and-forward.

Add an integration test that reproduces the duplication end-to-end: spawn
a native sub-agent with a kickoff, replay the forwarder's echo, and assert
the kickoff appears exactly once. Parametrized over claude and codex; a
non-native control proves the plain path is unaffected.

Signed-off-by: Brandon Hawi <brandonhawi1@gmail.com>
@github-actions github-actions Bot requested review from dbczumar and dhruv0811 June 18, 2026 17:15
@github-actions github-actions Bot added the size/M Pull request size: M label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Pull request size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Duplicate initial messages when spawning a native Claude agent

1 participant