Repository navigation
fix(mcp): degrade a server whose bearer does not resolve instead of failing the run (OB9) - #148
Merged
Merged
Conversation
…ailing the run (OB9)
An HTTP MCP server declared with `bearer: Stored("name")` whose credential
is not registered on this machine used to fail plan compilation with an
authentication error for every run in the workspace. The bearer now
resolves into `McpBearer::{None, Token, Unavailable { reason }}`; an
unresolvable one keeps the server declared (grants, tool names) but never
connects, so the catalog reports it under `unavailable MCP servers: NAME
(credential `NAME` is not registered; run `qq auth set NAME`)` while the
other servers and built-ins run. Calls to it return Unavailable. The
registry cache key already includes the credential epoch, so the next run
after `qq auth set` resolves it without a restart.
`McpCatalog::unavailable` now carries `McpUnavailable { server, reason }`
and connection/list failures keep their text too. `qq doctor` gains an
`mcp` check that warns (never fails) with the same wording.
Closes ENG-861.
lg2m
force-pushed
the
fix/eng-861-mcp-credential-degrade
branch
from
September 23, 2026 22:29
ceb43a6 to
4b48c5a
Compare
This was referenced Sep 23, 2026
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.
Plan slice OB9 of
docs/plans/onboarding-ux.md. Linear: ENG-861.Problem
An HTTP MCP server declared with
bearer: Stored("linear/default")whose credential is not registered on this machine failed plan compilation (resolve_server→AuthError→RunFailureKind::Authentication), so every run in the workspace failed. A server whose connection failed was already degraded tounavailable MCP servers: NAMEand the run proceeded — the two cases now behave the same.User-visible behavior
qq auth logout NAMEthenqq auth set NAME; bound to a different endpoint →qq auth set NAME --endpoint <url>; keyring unavailable → start it or--allow-file; unsetEnv("VAR")→export VAR.Unavailableoutcome carrying the reason (notUnknownTool); itsallowgrants remain in effect.qq auth set NAME, the next run picks the credential up without restarting: the registry cache key already includes the credential epoch and plan sources include the credential-index fingerprint.list_toolsfailures now also carry their text in the readiness message instead of the bare server name.qq doctorgains anmcpcheck:none declared/N declared; every bearer resolves/ a warning (never a failure) naming each server and remedy, withruns proceed without this server.Design notes
qq-mcpstays free ofqq-auth:McpTransportSettings::Http { bearer: McpBearer }withMcpBearer::{None, Token(String), Unavailable { reason }}.ServerHandle::connectreturns the reason forUnavailablewithout building a transport; the handle takes the ordinarylast_failurepath so nothing else in the manager changes.McpCatalog::unavailableis nowVec<McpUnavailable { server, reason }>;ServerHandle::tools()returnsErr(String)instead ofErr(()). Both are public qq-mcp API changes (no external consumers).resolve_serveris infallible. TheAuthError→ wording mapping lives in oneBearerFailure { problem, remedy }insrc/mcp.rs, shared by the readiness message andqq doctorso both surfaces say the same thing. The match is explicit for every variantresolve_with_endpointcan produce; the ~20 store-level variants (corrupt index, unreadable state) fall through to theirDisplayplus a remedy keyed on the reference kind.qq config checkis unchanged: it never opened a credential store and still doesn't.Docs
docs/guide/mcp.md§ "When a server is unavailable" (the "planned (OB9)" paragraph is gone),docs/guide/troubleshooting.md(both MCP entries),docs/guide/cli.md(doctormcprow),docs/design/tools.md. Ledger: OB9 → In review; OB0 → Shipped (#128); OB6 → Shipped (#139).Verification
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace— 1780 passedan_unresolvable_bearer_keeps_the_server_declared_but_unavailablesrc/mcp.rs:an_unregistered_stored_bearer_degrades_only_its_server_until_it_is_set(two HTTP servers against the in-process MCP fixture: one degraded, one serving; thenset_with_metadata, new epoch →Readyand the token is sent);wired_mcp_adapter_passes_the_availability_subset_for_an_unresolved_bearer(qq-core host conformance suite)src/doctor.rs:mcp_check_passes_with_no_servers_and_with_resolvable_bearers,mcp_check_warns_about_an_unregistered_stored_bearer_without_failing,mcp_check_names_the_endpoint_when_the_stored_bearer_is_bound_elsewherePerformance / compatibility
Compile path: the credential lookup that happened before now happens the same number of times; a failure no longer aborts. The readiness message is part of the plan descriptor digest (as connection failures already were), so a degraded → resolved transition produces a new plan generation, which is the desired behavior.
HostSummary.readiness_messagealready flows to clients asToolHostSummary.message; the TUI does not render it yet — a follow-up if we want the degraded reason visible in-session rather than only viaqq doctorand logs.