Skip to content

fix(mcp): settle digest responses must retain refs for auto-pinning #1124

Description

@cursor

Follow-up from PR #1106 / #1101 code review. MCP ref auto-pinning breaks when responseLevel: digest is used with --settle.

Problem

interactionSettleView (digest level) drops settle.diff.lines and keeps only summary, but mergeSettleIssuedRefPins collects refs exclusively from lines. MCP clients receive settle.refsGeneration but never record pins for added-line refs, so the next @ref command goes out unpinned and stale-ref warnings return.

Snapshot digest already solved this: snapshotView retains a capped refs: [{ ref, label }] array when dropping node payloads (src/daemon/response-views.ts). Settle digest does not mirror that pattern.

Suggested fix

  1. In interactionSettleView, when dropping line texts at digest level, add a capped refs array from added diff lines (refs only, like snapshot digest).
  2. Update mergeSettleIssuedRefPins / readIssuedRefBodies to read settle.refs (or equivalent) when lines are absent.
  3. Add test: MCP merges digest-level settle refs too (analogous to existing MCP merges digest-level snapshot refs too in command-tools.test.ts).

Acceptance

  • press --settle with responseLevel: digest → subsequent press @<newRef> is auto-pinned with ~s<refsGeneration>.
  • Default response level behavior unchanged.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions