Skip to content

fix(mcp): sequant://install is computed once at server start and swallows errors — reports "not installed" after a later init or on any read error #1195

Closed

Description

@admarble

Epic: field-2026-09-28 (downstream non-Node adoption) Tier: mechanical Status: confirmed by code reading (2026-09-29), narrowed to AC-1 + AC-2 by owner decision Graph: tracker #1203

Problem. installed means only that a manifest existed when serve started (serve.ts:60-61, version-preflight.ts:110-113, resources.ts:178-181). The value is wrapped in .catch(() => null), so an error reads as "not installed". A manifest written after the server started is never seen until a restart. It also ignores whether skills are present.

Field evidence. Plausible, not reproduced. A downstream project wrote its manifest hours after the plugin MCP server likely started, and runs worked while the resource said "not installed".

Reproduce first. The symptom ("not installed" while runs work) was reported but not reproduced. Before exec: start sequant serve, then write .sequant-manifest.json, read sequant://install, and record the result here. If it can't be reproduced, close this issue, or narrow it to AC-2 (errors are swallowed as "not installed").

AC

  • AC-1: A manifest created after server start is reported installed on the next read without a restart. Evidence: npx vitest run src/mcp/install-resource.test.ts
  • AC-2: A read error is reported as {error}, distinct from {installed:false}. Evidence: npx vitest run src/mcp/install-resource.test.ts

AC-3: The resource reports which required phase skills are present under .claude/skills/. Dropped by owner decision (2026-09-29). It's a new feature, not the reported symptom.

Graph metadata

  • No dependency edges.

May touch

  • src/mcp/resources.ts
  • src/commands/serve.ts
  • src/commands/version-preflight.ts
  • src/mcp/install-resource.test.ts

Activity

  1. added
    bug
    graph-2026-09-field
    needs-verification
    and removed
    needs-verification
    on Sep 28, 2026
  2. admarble commented on Sep 30, 2026

    @admarble
    ContributorAuthor

    Context for the run (re-checked against main @ a12c441d, 2026-09-29)

    Owner decision: this issue is narrowed to AC-1 and AC-2, and AC-3 is dropped (see the body). The "reproduce first" gate is satisfied by reading the code:

    Shape of the fix

    • Compute the install body per read of sequant://install. For example, pass a function (a status provider) in ResourceContext instead of a precomputed value, and have the resource await it inside its read handler.
    • Keep the startup stderr warning (formatSkillsInstallWarning, serve.ts:65) as a one-shot at start. It's fine for that to stay a snapshot.
    • Error path: catch inside the read and return { error: <message> }. Never collapse it into { installed: false }.
    • The tests belong in src/mcp/install-resource.test.ts, which already exists. Extend it rather than creating a new file. AC-1's test must write the manifest after the server/context is created and then read the resource.
    • No changes outside the "May touch" list.

    Standard block

    • No full npm test in exec or in qa. This applies to the qa phase as well as exec. Run targeted suites in the foreground with a timeout: timeout 600 npx vitest run src/mcp/install-resource.test.ts (plus any existing resources/serve test you touch). Global setup runs npm run build first.
    • Commit WIP early, and always before any mutation.
    • A mutation marker's failedTest starts with the test file path.
    • PR body: Closes #1195. Use Refs only for the tracker, tracker(graph): field report 2026-09-28 — downstream non-Node adoption gaps (10 nodes) #1203.
    • Skill snippets that read .sequant/settings.json must handle JSONC (not expected to apply here).
  3. admarble commented on Sep 30, 2026

    @admarble
    ContributorAuthor

    Complexity: Simple (2 ACs, 2 directories)

    AC Quality Check

    Both AC pass lint (declared Evidence: clause, unambiguous description, no vague/unmeasurable language). ## Non-Goals heading not present, but the issue body's "Dropped by owner decision" line on AC-3 and the "May touch" list serve the same scope-boundary function.


    Scope Assessment

    Verdict: ✅ SCOPE_OK (trivial — 2 AC, 0 directories per feature-detection heuristic; touches src/mcp/ + src/commands/)


    Acceptance Criteria

    AC-1: Manifest created after server start is reported installed on next read, no restart

    Verification: Unit Test (declared evidence)
    Scenario: Given a server started with no .sequant-manifest.json → When the manifest is written after start, then sequant://install is read → Then response is {installed:true,...}, not {installed:false}.

    AC-2: Read error reported as {error}, distinct from {installed:false}

    Verification: Unit Test (declared evidence)
    Scenario: Given a status provider that throws/rejects → When sequant://install is read → Then response is {error:<message>}, never collapsed into {installed:false}.


    Implementation Plan

    Phase 1: Recompute install status per resource read

    1. src/mcp/resources.ts: change ResourceContext.install from a precomputed value to a provider () => Promise<SkillsInstallStatus | null>. Add { error: string } to InstallResourceBody. Make installResourceBody async: await context.install?.() in try/catch — success/null → {installed:true,...}/{installed:false}; throw/reject → {error: message}. Await it in the install resource's read handler (resources.ts:162-171).
    2. src/commands/serve.ts: keep the one-shot getSkillsInstallStatus().catch(() => null) call only for the startup stderr warning (unchanged — stays a snapshot). Pass a fresh provider to createServer's context: { install: () => getSkillsInstallStatus() } — no .catch, so a throw reaches the handler's try/catch instead of collapsing to null (today's bug).

    Phase 2: Tests (extend src/mcp/install-resource.test.ts, don't add a new file)

    1. Update existing connect()/STALE-based cases for the new function-typed install field (e.g. install: async () => STALE).
    2. Add AC-1 case: build server/context, then write the manifest, then read sequant://install — assert installed:true without reconnecting.
    3. Add AC-2 case: provider that rejects — assert {error: <message>}.

    No changes needed to version-preflight.ts — getSkillsInstallStatus already returns a fresh promise each call.


    Design Review

    1. Where does this logic belong? src/mcp/resources.ts keeps owning resource-body shaping; when status is computed becomes the caller's choice via an injected thunk, consistent with ResourceContext already being a DI seam (serve supplies real deps, tests supply fakes).
    2. What existing pattern does this follow? Same shape as StatusToolOptions in src/mcp/tools/status.ts (test(mcp): sequant_status tests reconcile and rewrite the checkout's real .sequant/state.json #1164) — test/production swap a dependency through the context object rather than a hardcoded value.

    Recommended Workflow

    Phases: spec → exec → qa
    Quality Loop: disabled
    Reasoning: bug label only, 2 AC, SCOPE_OK, owner decision already specifies the exact fix shape — no testgen (bug-only label short-circuits it), no security-review, no UI.


    Label Review

    Current: bug, graph-2026-09-field
    Recommended: + planned
    Reason: Plan accepted, ready for exec.
    Quality Loop: Won't auto-enable — SCOPE_OK, no complexity signal.

    → gh issue edit 1195 --add-label planned

  4. added
    planned
    on Sep 30, 2026
  5. admarble commented on Sep 30, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_NOT_MET

  6. admarble commented on Sep 30, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 2/2 met

    Gaps:

    • The production serve wiring that makes sequant://install recompute per read has no regression test; AC-1 tests build their own provider
    • Change outside the owner-specified May-touch list; justified for AC-2 but not called out
  7. added 3 commits that reference this issue on Sep 30, 2026
  8. admarble commented on Sep 30, 2026

    @admarble
    ContributorAuthor

    Fixed by #1225 (squash 66ce8c46 on main). Closed by hand: the PR's closing reference was dropped when its body was rewritten over the API, reappeared in closingIssuesReferences minutes later, and still didn't close the issue on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggraph-2026-09-fieldplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions