Repository navigation
fix(watch): sync the checkouts agents work in on a machine set up for hosted MCP - #167
Merged
Merged
Conversation
… hosted MCP A machine set up for hosted MCP never linked a checkout it had not linked before. The sync bridge watches only folders listed in mappings.json with a verified .contextstream/config.json. Hosted init cannot write local files, the background link audit only re-checked folders already in mappings.json, and connect needs a dashboard token. On a fresh install the bridge ran with target_count 0 for six days, nothing on the machine was uploaded, and agents got search results from other machines' copies (another branch, 131 hours old) and fell back to grep. - The link audit also checks the Git checkouts agent sessions worked in (session-scopes.json). It still links only on strong evidence: the Git repository names the project, not an isolated workspace, not pinned, not a temporary path or an agent's task worktree. - A hook that sees an agent working in an unlinked checkout asks the bridge for that audit at once (watch.link-audit marker, 10-minute cooldown) instead of waiting up to six hours. - A folder linked by link or the audit gets one covering full scan, so the server receives its branch and edits, not only edits made afterwards. - SessionStart says whether the checkout is synced, not linked (with the link --fix command) or linked with no bridge running, instead of "Project index not found yet" for every repository on hosted MCP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
escott-
added a commit
that referenced
this pull request
Oct 12, 2026
Bumps the workspace, npm package, MCP Registry metadata and the boundary self-test to 1.0.21. Adds the 1.0.21 changelog: the hosted gateway no longer reads or writes its own disk for a caller's path (339f5d5) and never replaces its own binary (ddcae54); per-request tool surfaces on the gateway (5c42d4b); hosted search rooted at the session's checkout (#168); the hooks lose the hidden attribution block (4879e0b); the sync bridge links the checkouts agents work in (#167); entity visibility, filing and reply fixes (901a2fc); whole-word skill matching (6bbf26b); stdio resume and closed-pipe fixes (#166); the setup review-card gap (074c45f); opt-in coaching turns (053d961; its API route eb4430485 is in the live backend); and quinn-proto 0.11.19 in Cargo.lock (87d6488). No open PRs were left out. Checked on ovh-desktop against main 87d6488 plus this change: - cargo fmt --all --check - cargo clippy --locked --workspace --all-targets -- -D warnings - cargo test --locked --workspace --all-targets: 3223 passed, 0 failed, 21 ignored - account_connection_smoke: 9 tests - cargo audit --deny warnings (403 crates, no advisories) and cargo deny --locked check (duplicate warnings only) - on a clean archive: release_contract metadata and resolve-version for tag v1.0.21, public_boundary, the four script tests, the adoption and grounding tests, npm test (6 passed) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: escott- <escott05@gmail.com>
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.
Problem
On a machine set up for hosted MCP, the sync bridge never watched a checkout the machine had not linked before. It watches only folders in
~/.contextstream/mappings.jsonthat also carry a verified.contextstream/config.json, and nothing in hosted mode creates those for a new folder:initcannot write local files,link.rs) only re-checked folders already inmappings.json,connectneeds a token minted in the dashboard.Seen on 2026-10-12 after a fresh install on Oct 6: the bridge heartbeat showed
target_count: 0for six days, so nothing on the machine was uploaded. Claude Code on the contextstream repo reported "The ContextStream index is 131 hours stale and from another branch, and it has no exact hit for the gate's wording" and fell back to grep. SessionStart said "Project index not found yet" for every repository, because it readsindexed-projects.json, which hosted mode never writes.contextstream-mcp linkon the folder showednot linked, with a strong match (same Git repository).Change
link.rs):known_folders()also includes the Git checkouts agent sessions worked in, fromsession-scopes.json. The automatic repair rules are unchanged: link only when the Git repository names the project, never into an isolated workspace, never a pinned folder. Temporary paths and agents' task worktrees (.claude/worktrees/) are skipped.watch.rs,post_tool_use.rs): when aninit/contextresult lands for a checkout with no verified link to the resolved project, the hook writes a one-shotwatch.link-auditmarker. The bridge takes it on its flush tick and runs the audit then, not at the next six-hourly tick. It skips while an audit is running and keeps a 10-minute cooldown, because a folder no project matches asks on every turn. Like the reload marker, it holds no path or scope.link.rs):relink()marks the root for one durable full scan. Before this, a newly watched target uploaded only paths edited after linking, so the server kept other machines' copies of everything else.session_start.rs): when the legacy registry knows nothing, it reports whether this checkout is synced, not linked (withcontextstream-mcp link --fix, or--project-idwhen nothing matches), or linked with no bridge running (with the doctor repair command).Behaviour change to review
The bridge will now link a Git checkout an agent works in when its repository matches a project with strong evidence, and upload it, without anyone running
linkorconnect. Before, the automatic audit applied the same rule only to folders that had been linked before. Ambiguous matches are still left alone; in the live check, coflow and contextcode stayed unlinked because several projects fit.Verification
cargo clippy -p mcp-server --all-targets -- -D warnings: clean.cargo test -p mcp-server: all suites pass (1075 lib tests plus the integration suites), including the new tests:link::tests::{registry_folders_come_from_mappings_and_the_local_index, session_folders_are_where_agent_sessions_worked, agent_task_worktrees_are_recognised}watch::tests::link_audit_request_needs_a_running_bridge_and_waits_out_a_running_audit_or_cooldownhook_handlers::post_tool_use::tests::a_git_checkout_without_a_verified_link_asks_the_bridge_for_an_audithook_handlers::session_start::tests::an_unlinked_git_checkout_is_reported_as_not_syncedlink --allon the affected machine: 1.0.17 checks onlycontextmailandcontextstream; this build also findscoflow,contextcodeandcontextmail-mobilefrom agent sessions.link --fix, bridge reload, hosted refresh): the bridge went totarget_count: 1, and the index moved to this machine and branch (11,926 → 12,089 files).Release
Owner decision cc199133 holds mcp-server releases until the Agent Coach Kit work is done; this PR does not change that.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.