Skip to content

fix: bound Claude subagent startup and daemon MCP requests - #728

Merged
ScriptedAlchemy merged 5 commits into
ScriptedAlchemy:codex/tracedecay-total-redesign-plan-reopenedfrom
BleedingDev:codex/subagent-start-fail-open
Aug 26, 2026
Merged

fix: bound Claude subagent startup and daemon MCP requests#728
ScriptedAlchemy merged 5 commits into
ScriptedAlchemy:codex/tracedecay-total-redesign-plan-reopenedfrom
BleedingDev:codex/subagent-start-fail-open

Conversation

@BleedingDev

@BleedingDev BleedingDev commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make Claude Code SubagentStart resolve only local workspace boundaries, avoid direct global-registry access, and fail open within 1.5 seconds
  • add a 5-second outer Claude hook timeout
  • bound daemon project warm-up, MCP handler execution, MCP proxy waits, and CLI one-shot RPC waits
  • prevent a user-profile or filesystem root from becoming an implicit project, watcher target, PR auto-track target, or unscoped CLI project
  • let MCP calls launched from a non-project directory route an absolute project_path through the daemon, consuming the selector before project-local tool dispatch
  • preserve background warm-up, TraceDecay enrichment, and normal concurrent tool use

Root cause

SubagentStart performed a daemon status RPC through the global project resolver. A connectable but saturated daemon could wait forever in the response-line liveness loop because it had no total deadline. Same-route project opens also bypassed the existing writer-contention grace period, allowing a warm-up queued behind the daemon writer gate to hold clients indefinitely.

A stale registry entry for the user-profile root could also start a watcher and project freshness work across the entire profile. That work could hold the daemon-wide writer coordinator and starve unrelated project MCP calls. MCP sessions inherited the broad launch directory even when a tool supplied an explicit project path. Unscoped CLI tools additionally wrapped their cwd fallback as an explicit project, producing a misleading disconnect instead of a projectless error.

Safety

Timeouts cancel handler futures and never retry requests automatically. Mutating-tool timeout errors state that the outcome may be unknown. Project warm-up continues detached and returns the existing retryable warming error. No database or index fallback was added. Ambient registry rows are preserved but ignored by implicit routing and background services. Explicit CLI and MCP project selectors keep their existing behavior.

Tests

  • hook timeout, daemon-error, malformed input, non-project cwd, nested project, and global-only project routing
  • connectable-but-silent daemon deadlines for CLI RPC and MCP proxy
  • MCP handler cancellation on execution timeout
  • same-route writer contention and detached project warm-up
  • user-profile discovery, watcher rejection, and projectless unscoped CLI dispatch
  • real daemon broker round trip from an ambient handshake to an explicit project path
  • packaged Claude hook timeout generation
  • cargo check and focused unit/integration suites pass

Repository-wide clippy and cargo test currently expose unrelated failures already reproducible on the untouched base branch.

@changeset-bot

changeset-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bd2d2f9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f64b45e994

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/daemon.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 060d518c41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/daemon.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b114f3b150

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/doctor.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94fb411586

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/daemon.rs Outdated
@ScriptedAlchemy

Copy link
Copy Markdown
Owner

#707 port of this branch is #732 (codex/integrate-pr728-into-pr707-20260826), rebased onto the #722 relocated crate layout. This master-targeted PR is unchanged.

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Pushed CI unblock 47143c8eff to this fork branch:

  • rustfmt src/tracedecay/lifecycle.rs and tests/storage_suite/storage_resolver_test.rs
  • collapse identical parent.parent() arms in path_layout.rs (clippy::if_same_then_else)

Backup on ScriptedAlchemy: cursor/fix-728-ci. The #707 port remains #732 (format already green there).

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Retrigger CI on 47143c8; reopening immediately.

@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/subagent-start-fail-open branch from 47143c8 to 8d99714 Compare August 26, 2026 22:35
@ScriptedAlchemy
ScriptedAlchemy changed the base branch from master to codex/tracedecay-total-redesign-plan-reopened August 26, 2026 22:35
@ScriptedAlchemy
ScriptedAlchemy force-pushed the codex/subagent-start-fail-open branch from 8d99714 to bd2d2f9 Compare August 26, 2026 22:39
@ScriptedAlchemy
ScriptedAlchemy merged commit f191a79 into ScriptedAlchemy:codex/tracedecay-total-redesign-plan-reopened Aug 26, 2026
2 checks passed
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