Skip to content

fix(profiles): close post-merge review gaps in connect rotation, offline guard, preview, attribution and CLI hints (Spec 108-retro-go) - #1454

Merged
github-actions[bot] merged 10 commits into
mainfrom
108-retro-sol-fixes-backend
Oct 1, 2026
Merged

github-actions[bot] merged 10 commits into
mainfrom
108-retro-sol-fixes-backend

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 1, 2026

Copy link
Copy Markdown
Member

Closes the seven verified post-merge review findings of Spec 108 PRs 108-c2, 108-e and 108-g. Spec: specs/108-profiles-v3 (Phase 14, tasks T140 to T146). Go only: no frontend or macOS change, and the generated TypeScript contract types are unchanged.

What changes for users, per surface

Connect (REST, Web UI, macOS, CLI)

  • A connect now holds a per-client in-flight claim from the moment the credential is staged until the config write is committed, aborted or released. While it is held, a second connect, rotate, rotate/finalize or binding change of the same client is refused with 409 connect_in_progress, and the staged-rotation reconciler leaves both secrets alone. Previously a reconcile or second connect landing between the stage and the config write could roll the new secret back and leave the client holding a dead secret while the call answered 200.
  • Commit now verifies that the secret it finalizes is still the record's pending (or, for a fresh mint, primary) secret. A credential that was revoked or replaced meanwhile fails with 409 credential_superseded; a deliberate forget is never blocked and wins.
  • An ambiguous write (the file was written but the verification re-read failed) now releases the claim so the reconciler can resolve it from the file, as FR-021a intends.
  • The reconnect preview (GET /connect/{client}/preview, and the Web UI and macOS reconnect dialogs that render it) now shows the binding the write will actually apply: a reconnect with no profile shows the client's recorded profile and mode instead of the defaults. Preview and write share one resolution rule.
  • The offline CLI (mcpproxy connect, no daemon reachable) refuses a re-point or mode change of an already bound client while require_mcp_auth is off, with the usual guard text and Fixes: list. A reconnect that keeps the recorded binding still works offline, so rotation does not need the daemon.

Activity (REST, SSE, CLI, MCP)

  • Activity records store the calling token's display prefix as an internal ownership proof. A scoped caller now sees its own policy_decision and prompt_get rows with their attribution and finds them by ?token=<own name>; before, those rows read as foreign and were filtered out or blanked. The prefix is never in any REST shape, export, CSV or SSE frame. Records written before this change keep reading as foreign to a scoped caller (fail closed); there is no backfill because the prefix was never stored.
  • internal_tool_call records and events take their attribution from the request context like the call they wrap, so a REST /tools/call record carries the same profile, token and client as its tool_call twin, and activity watch for a scoped caller keeps its own internal_tool_call events.

CLI and MCP

  • mcpproxy access explain prints mcpproxy upstream approve <server> <tool> for a tool-approval failure, so following the hint approves that tool only; the bare server form is kept for a quarantined server.
  • GET /profiles/{name}/effective-tools and the MCP profiles tool effective_tools operation gain an administrator-only stale_classification_reasons map (annotated or missing), computed over the unfiltered tool set. mcpproxy profile show --effective uses it, so a --server or --reason filter no longer mislabels an annotated tool as "not found"; against an older daemon a filtered request prints a neutral classification ignored.

Audit finding ids fixed

pr1430:F1, pr1430:F2, pr1430:F3, pr1436:sol:A.1+sol:C.1, pr1436:sol:B.1+sol:6.1, pr1441:F1.1, pr1441:F2.1.

Implementation notes

  • New error codes connect_in_progress and credential_superseded map to 409 {error, code} in the shared profiles error mapping, so the /clients/* routes, POST /connect/{client} and the MCP profiles tool agree; the CLI prints their text and exits 1. Swagger descriptions are updated and oas/ regenerated.
  • connect.CredentialMinter gains Release and PreviewBinding.
  • runtime.StrictOfflineBindingGuard is new and used only by the offline CLI. ConservativeBindingGuard is unchanged because other callers depend on its documented re-point allowance.
  • emitActivityInternalToolCall and its truncated variant take the request context as their first parameter; every call site passes its handler context (none needed a background context). No frozen golden changed.
  • Spec 108 text is updated: FR-021a, FR-029, the refusals, REST, CLI and MCP contracts, the data model, plan and tasks.

Tests

New tests were written before the code: the in-flight and race scenarios (including a full-stack test through a real connect service), commit verification, release on an ambiguous write, preview equals write for every record state, the strict offline guard and its CLI behaviour, owner-by-persisted-prefix, scoped caller finding its own policy and prompt rows, the prefix never appearing in any projection, REST and event attribution of internal_tool_call, the approve hint, and stale reasons with and without filters. Unit suites for the touched packages pass under -race (server also with the CI skip regex), the server edition builds, and both golangci-lint runs report only findings that already exist on main in files this PR does not touch.

Follow-ups

  • The Web profile editor and the macOS app should read stale_classification_reasons (needs cmd/generate-types, frontend/src/types/contracts.ts and ProfilesModels.swift, out of scope here).
  • Remaining review mediums owned by other PRs: pr1436:sol:E.1 (Activity.vue scope params) and the macOS findings of pr1442 and pr1427.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 80bd9ca
Status: ✅  Deploy successful!
Preview URL: https://decde729.mcpproxy-docs.pages.dev
Branch Preview URL: https://108-retro-sol-fixes-backend.mcpproxy-docs.pages.dev

View logs

A keyless connect mints nothing and so never reached connectMinter.Issue,
the only place the FR-021a in-flight claim was checked. It could rewrite a
client's config while another connect held the claim and answered 200 instead
of 409 connect_in_progress. Add CredentialMinter.CheckIdle (claim check
without taking a claim) and call it from credentialHandle.secret() on the
keyless path, right before the backup and write.

Lint note: the only golangci-lint finding (internal/runtime/event_bus.go
reflect.Ptr) is pre-existing and untouched.
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 108-retro-sol-fixes-backend

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (18 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (27 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (26 MB)
  • installer-dmg-darwin-arm64 (24 MB)
  • smart-mcp-proxymcpproxy-go1UYV6B.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 36846382636 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

codecov-commenter commented Oct 1, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 82.96943% with 39 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/server/mcp.go 53.33% 21 Missing ⚠️
internal/runtime/clients_service_connect.go 84.41% 6 Missing and 6 partials ⚠️
internal/httpapi/connect.go 50.00% 1 Missing and 1 partial ⚠️
internal/runtime/clients_service.go 88.88% 2 Missing ⚠️
internal/server/profile_evaluator.go 83.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved (Model B): Paperclip review verdicts = ACCEPT and qa-gate green at this head SHA. Arming auto-merge; GitHub merges when all required checks pass.

@github-actions
github-actions Bot merged commit e2da459 into main Oct 1, 2026
69 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants