Skip to content

feat(workbench): user-initiated live MCP probing with consent + redaction (#105 stage 5) - #299

Merged
ScriptedAlchemy merged 2 commits into
mainfrom
wave/105-s5
Sep 2, 2026
Merged

ScriptedAlchemy merged 2 commits into
mainfrom
wave/105-s5

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

#105 stage 5 — the final stage: user-initiated live MCP probing from the Hosts page, under the #107 G6 gate (read-only; anything that executes is user-initiated; no mutation ever enters the Workbench).

  • Probe targets from discovery: the discovery report's bundle findings now enumerate the installed bundle's declared MCP servers (DiscoveryBundleFinding.mcpServers, read-only via each adapter's MCP runtime manifest; absent = honestly not enumerated, empty = declared none).
  • Server: session-authorized POST /api/discovery/probes (AB8219–AB8223, registered in docs/diagnostics.md). The body is only { host, serverName } — browser input never becomes a launcher, path, env, or JSON-RPC frame; the server re-resolves the bundle root from disk and reuses the existing MCP session launch machinery (resolveMcpSessionLaunch + @modelcontextprotocol/client transports). The probe is structurally read-only: exactly initialize + tools/list + capability snapshot, then close — the wire admits no operation selection, never tools/call. Strict 10 s total budget, named 16 MiB response budget, bounded tool/instruction text, per-target single-flight with no caching past settlement, plugin-data tempdir always removed.
  • Redaction before anything renders: launch summaries ship only the existing inspector projection (command allowlist, [REDACTED] args, env allowlist, sanitized URLs); all server-reported text passes credential redaction (redactCredentialText) plus absolute-path redaction per the dev-log wire precedent (bundle paths become <bundle>/…, other absolute paths fail closed to [REDACTED]).
  • Consent, per probe: no probe on page load, ever. Probe → explicit consent copy (read-only handshake, starts the server process on this machine, nothing stored) → Cancel sends nothing / confirm sends exactly one POST.
  • Honest states: endpoint down or timed out is an HTTP-200 report rendered as a structurally neutral Unreachable/Timed out badge — no error wall, role="alert" only for real request/decode failures (client decode is strict zod with AB8235, enforcing the ok⇔snapshot / down⇔failure invariants).
  • Ephemeral: results live in the sanctioned discovery-atoms.ts browser-state module keyed to the current report view; re-running discovery drops them; in-flight probes abort on unmount (disposal-tested). Nothing persisted.

Test plan (all run locally, green)

  • lint 0/0; typecheck across all three projects
  • unit 2533 ✓ (one pre-existing native-claude-contract load-flake, 17/17 green in isolation), route-unit 19 ✓, projection 57 ✓
  • probe service/routes/enumeration units 32 ✓ (redaction incl. secrets/home paths, budgets, single-flight, honest failures, auth, 413, 404)
  • real dev-server integration: authenticated probe launches the example's real prebuilt stdio server — initialize + tools/list ✓, env allowlist ✓, 403 without session ✓
  • real-Chrome e2e at 1440×900 (discovery.e2e): consent flow (zero probe requests before confirm; Cancel sends nothing; exactly one POST), populated live probe of the real timeline server, honest neutral down state for a dead stdio server, re-run clears ephemeral results, stale→repair regression, zero page errors
  • regressions: overview.e2e 13 ✓, runtime-playground.e2e 3 ✓, lifecycles.e2e ✓, host-discovery-dev-server ✓, lifecycle-replay-dev-server ✓, all three atom-disposal suites ✓

Changeset: agent-bundle patch.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9cb6d76

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-02T07:22:09.398574Z 5ce9596 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ce959612e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
return report;
} finally {
await Promise.allSettled([client.close(), transport.close()]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep cleanup from defeating the probe timeout

When an unresponsive stdio child or Streamable HTTP endpoint causes transport.close() or client.close() not to settle, the timeout race creates a timed-out report but this unconditional Promise.allSettled still waits forever before returning it. Consequently the documented 10-second total budget does not bound the route response and the Workbench remains stuck on “Probing”; cleanup needs its own bounded or detached teardown path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 4cf4aaa3a via #316. Final teardown now waits at most 50 ms while the Promise.allSettled close path continues running, preserving StdioClientTransport.close() through its TERM/KILL sequence. The regression proves a timed-out probe returns while client and transport closes are still stalled.

Comment on lines +128 to +129
const hasAbsolutePath = (value: string): boolean =>
/(?:file:|(?:^|[\s"'([{])\/[^\s,;{}()[\]<>"']+|(?:^|[\s"'([{])[A-Za-z]:[\\/]|\\\\)/u.test(value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Detect absolute paths after common separators

If server-controlled metadata or an error formats a path as config=/home/alice/private.json or cwd:C:\Users\alice\private, this expression does not recognize it because the path is preceded by = or : rather than one of the permitted boundary characters. redactProbeText therefore returns the full absolute path in instructions, tool metadata, or failure details despite its fail-closed redaction contract; include common key/value separators in the boundary detection.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 4cf4aaa3a via #316. Absolute-path boundary detection now includes =, :, and ,, with regressions covering config=/home/alice/private.json, cwd:C:\Users\alice\private, and a comma-delimited POSIX path.

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@299
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@299
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@299

commit: ae9aec9

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.

1 participant