fix: synchronize MCP broker startup#1273
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a startup race in astrid mcp serve where an immediate client tools/list can be dropped if the authenticated (non-default) principal’s MCP broker capsule hasn’t subscribed yet. It adds a principal-scoped readiness gate that proves the generic broker request path responds before exposing MCP stdio, aligning behavior with the issue’s acceptance criteria.
Changes:
- Add a principal-scoped
tools/listreadiness probe that gates MCP stdio startup and replays the probe oncapsules_loaded(with a retry fallback). - Wire the readiness gate into the
mcp servestartup sequence (before starting the stdio transport). - Document the behavioral fix in
CHANGELOG.mdunder[Unreleased].
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/astrid-cli/src/commands/mcp/readiness.rs | Implements principal-scoped broker readiness probing (probe/retry/replay) plus deterministic unit tests. |
| crates/astrid-cli/src/commands/mcp/mod.rs | Calls the readiness gate before exposing MCP stdio during astrid mcp serve. |
| CHANGELOG.md | Adds an [Unreleased] entry describing the fixed cold-start race and new readiness behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2 tasks
joshuajbouw
added a commit
that referenced
this pull request
Jul 19, 2026
## Linked Issue Closes #1274 ## Summary Prepare Astrid Runtime `0.10.2` as the immutable patch candidate containing the MCP broker cold-start readiness fix from #1273. ## Changes - roll the reviewed MCP readiness fix into `0.10.2` - update the workspace and internal dependency versions to `0.10.2` - roll `[Unreleased]` into the dated `0.10.2` changelog section - keep the next nightly base unchanged ## Verification - `cargo fmt --all -- --check` - `cargo test --workspace --locked -- --quiet` - `cargo clippy --workspace --all-features --all-targets --locked -- -D warnings` - release CI on the exact version and changelog commit - no runtime code changes beyond the already reviewed and tested fix in #1273 ## Checklist - [x] Linked to an issue - [x] CHANGELOG.md rolled into the `0.10.2` release section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Closes #1272
Summary
Gate
astrid mcp serveon a real response from a named principal's generic MCPbroker path. This prevents an immediate client request from being dropped while
a non-default principal's capsules are still warming after global daemon
readiness. Explicit
anonymousremains the intentional transport-only,no-capability mode and does not wait for a broker it cannot own.
Changes
tools/listreadiness probe before MCPstdio is exposed for named principals.
capsules_loadedsignalarrives, with a wall-clock-driven three-second retry fallback that cannot be
starved by unrelated broker traffic and the existing 55-second reply budget.
readiness for any named agent principal.
principal-isolation, and anonymous-boundary tests and document the fix under
[Unreleased].Verification
cargo fmt --all -- --checkcargo test --locked -p astrid --bin astrid commands::mcp:: -- --quietcargo test --workspace -- --quietcargo clippy --workspace --all-features --all-targets --locked -- -D warningsgit diff --checksend MCP
initialize,notifications/initialized, andtools/listimmediately for
codex-code; readiness is confirmed andtools/listreturns instead of hanging.
Checklist
[Unreleased]— or[Unreleased]rolled into a version section for a release PR; not applicable to docs/CI-only changes)