Skip to content

Run the start_agent test's server outside the suite's process tree - #1928

Draft
realtonyyoung wants to merge 5 commits into
mainfrom
tonyyoung/start-agent-test-desktop-ancestry
Draft

realtonyyoung wants to merge 5 commits into
mainfrom
tonyyoung/start-agent-test-desktop-ancestry

Conversation

@realtonyyoung

@realtonyyoung realtonyyoung commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

No GitHub or Linear issue

What & why

Start_agent_posts_once_and_returns_without_reading_the_agent_back failed whenever the suite ran from a coding agent, such as a Claude Code session in the Claude desktop app, while CI passed. The spawned kcap mcp flows finds KCAP_AGENT_ID and walks its ancestry for coding agents. It counts the desktop app and its claude as two, judges itself nested and sheds the id, so caller_agent_id went out null.

The test now starts its server through /bin/sh, which backgrounds the server and exits. The server is reparented to init, so its ancestry holds none of the suite's processes. The shell hands its pipes down, so the test talks to the server as before, and teardown kills the orphan by the pid the shell printed. On Windows the test spawns directly: Windows doesn't reparent, so the walk stops at the vanished parent anyway. No product code changes.

Verification

Run Result
The test from a Claude desktop session, before fails, caller_agent_id empty
Same, after 1/1 pass
McpFlowsServerTests 37/37 pass

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

The server walks its ancestry for coding agents once it finds a hosting variable, so a suite run from an agent made it shed the id under test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@realtonyyoung realtonyyoung changed the title Say why the start_agent test fails under the Claude desktop app Run the start_agent test's server outside the suite's process tree Oct 24, 2026
realtonyyoung and others added 3 commits October 24, 2026 19:57
dash points an asynchronous list's stdin at /dev/null before its redirections run, so the server read EOF and exited

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shell's stderr is the server's own, and a pid freed by an exited orphan can be reused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant