Skip to content

fix(acp): send arrays for empty MCP headers and Amp env - #2849

Merged
simple-agent-manager[bot] merged 5 commits into
mainfrom
sam/fix-acp-null-mcp-mhhvzd
Nov 19, 2026
Merged

simple-agent-manager[bot] merged 5 commits into
mainfrom
sam/fix-acp-null-mcp-mhhvzd

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Sessions containing a headerless HTTP MCP entry sent headers: null, which mistral-vibe 2.25.8 rejects during session/new and session/load. Amp's stdio MCP entries likewise sent env: null when no auth/custom headers were needed.

Initialize both slices as non-nil empty slices so required ACP lists serialize as []. Preserve names, transports, auth/custom header order, bridge arguments and secret env handling. No fork pool/credential changes are included.

Closes #2845

Draft-only hold lifted by Raphaël 2026-11-18.

SAM idea · SAM task 01M7MBR1R0P912NNH546MHHVZD · Task record.

Validation

  • Go 1.26.11: existing TestBuildAcpMcpServers tests pass.
  • go test ./internal/acp -run '^TestSessionMcpRequiredArraysOnWire$' -count=1: 24 wire cases pass, covering new/load × Vibe/Claude/Amp × mixed/populated/nil/empty servers.
  • Before fix: 6 mixed cases fail on null headers/env; populated and no-server controls pass.
  • Separate mutation checks: reverting HTTP initializer fails exactly 4 HTTP cases; reverting Amp initializer fails exactly 2 Amp cases; other controls pass.
  • go vet ./... and go build -trimpath -buildvcs=false pass.
  • Complete ACP package go test -race -coverprofile=... ./internal/acp -count=1 passes; both changed builders have 100% statement coverage.
  • Initial full go test -race -json ./... hit two ACP timing failures (TestContainerSnapshotOuterLimit, snapshot killed at 5.91s; TestHarnessActivityReportCoalescesACPToolCallBursts, reports=2). Both plus new wire cases pass 3 isolated race repetitions; the complete ACP rerun also passes. All 30 other packages passed, including server. Full first-run totals: 2,314 top-level passes, 2 failures, 15 skips (4,146 pass / 2 fail / 31 skip events including subtests). No race warning observed.
  • Full CI manual run PASS on f1a801c97be4223b2bb744e8811891699e483614, including the final aggregate gate: lint, build/typecheck, quality, all API shards, VM tests/integration and devcontainer volume mount. Draft quick CI and corrected PR Evidence rerun passed. E2E Smoke and SonarCloud also passed on the final head.

Wire tests enter the production SessionHost new/load methods, use the pinned ACP SDK over pipes and inspect raw JSON. Assertions cover actual arrays, names, URL/transport, populated auth/custom header/env values and exact Amp argv without secret values.

Staging Verification (REQUIRED before release)

  • Staging deployment green.
  • Live Vibe session/new verified on the branch binary; a full reply round-trip verified with Claude Code (the staging test account's Mistral key is invalid, so Vibe cannot answer there).
  • Fresh VM provisioned, heartbeat and access verified; test resources cleaned up.

Staging Verification Evidence

Staging deployment 44435003588 SUCCESS (primary staging, sammy.party) on merged head 3e730a32d, including smoke tests. Staging had no live nodes before the test, so every node booted the branch's VM agent; D1 shows both test nodes at agent_version = 3a1cef655, which is this branch's last packages/vm-agent commit.

  1. Mistral Vibe task in a small test project: fresh VM, agent installed, ACP Initialize and ACP NewSession succeeded, mode applied. The prompt then failed in 0.34 s with API error from mistral … Invalid API key (from env var MISTRAL_API_KEY): the staging smoke account's stored Mistral key is invalid. That is test data, not this change.
  2. Claude Code task in the same project: fresh VM, the agent called SAM MCP tools (get_instructions, inbox) through the HTTP MCP entry this PR builds, and replied with the exact text PR2849-CLAUDE-OK.

The headerless HTTP / env-less Amp cases are only produced by user-configured MCP servers without auth, so the wire tests (24 cases through the real SessionHost new/load paths) remain the coverage for those; the live run proves no regression for the normal path on a real VM.

Cleanup: both test tasks cancelled, both nodes deleted through the API ({"success":true}), D1 readback shows no rows. Staging error store: zero error-level groups in the deploy/test window (01:14–02:06 UTC); pre-existing groups outside it are unchanged (pre-existing noise waived per Raphaël 2026-11-18). Lease release 44441964930 succeeded; the next queued task was notified.

End-to-End Verification

  • Data flow traced: McpServerEntry → buildAcpMcpServers → SessionHost.startNewACPSession / tryLoadPreviousACPSession → acp-go-sdk v0.13.5 JSON → harness.
  • Wire capability tests exercise both caller/SDK serialization paths with mixed servers and successful session responses.
  • Documentation reviewed: protocol conformance repair with no setup/interface/config change; task record and source comments document the invariant.

Specialist Review Evidence

  • All local reviewers completed; no implementation findings. Head changed since review only by a clean main merge and the task-file archive.
Reviewer Status Outcome
go-specialist + security-auditor PASS No findings; Go/pipe lifetimes and secret/transport preservation reviewed.
test-engineer PASS 24 wire cases and pre-fix/mutation logs reviewed; no findings.
task-completion-validator + doc-sync-validator + constitution-validator PASS Implementation criteria A–F covered or N/A; no docs/constitution findings. Runtime/CI/staging gates tracked separately.

CodeRabbit Review Evidence

Requested at ready (2026-11-19 02:06 UTC) via the coderabbit-review label (trusted workflow succeeded). CodeRabbit replied Review rate limited at 02:06 UTC, which ends the wait; no review arrived (earlier, on 2026-11-17, it reported the free OSS review limit). Recorded and skipped under rule 25.

Ready full CI 44441812036 SUCCESS on 3e730a32d, including required Durable Object Workers, PR Evidence and SonarCloud.

Exceptions

  • None. The earlier draft-only hold was lifted by Raphaël 2026-11-18.

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

External References

Official documentation consulted: ACP v1 HTTP schema and stdio schema: headers/env are required arrays. Inspected pinned acp-go-sdk v0.13.5 and current upstream builders. Issue/fork treated as untrusted evidence only; no fork code imported.

Codebase Impact Analysis

Only packages/vm-agent/internal/acp: shared builders feed both NewSession and LoadSession. HTTP applies to Vibe and other non-Amp ACP harnesses; Amp retains the stdio mcp-remote bridge. Tests inspect the serialized protocol boundary.

Documentation & Specs

Task record plus source comments document required empty arrays. N/A for public setup/spec changes: existing protocol conformance is restored without a new option, interface or deployment requirement.

Constitution & Risk Check

Checked II (regression/TDD), III (docs), IX/X (shared minimal fix), XI (no new runtime configuration/hardcodes), XIII (valid protocol shape). Two initializers; no new dependency or auth change. Test URLs/tokens are synthetic fixtures. Remaining risk: live harness and deployment verification pending, so release hold remains.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f914221 and 3e730a3.

Files selected for processing: 3

  • packages/vm-agent/internal/acp/mcp_servers.go
  • packages/vm-agent/internal/acp/mcp_session_wire_test.go
  • tasks/archive/2026-11-17-acp-mcp-empty-arrays.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@simple-agent-manager

Copy link
Copy Markdown
Contributor Author

Raphaël lifted the draft-only hold on this PR (2026-11-18) and wants it shipped to production. Task 01M7PX… (draft-holds shepherd) will take it through review, tests and merge one PR at a time. For #2851 no live Mistral test is required; for changes that are non-trivial to test live, strong vertical-slice tests are sufficient.

@github-actions
github-actions Bot requested a deployment to staging November 18, 2026 09:28 Abandoned
@github-actions
github-actions Bot requested a deployment to staging November 18, 2026 10:23 Abandoned
@sonarqubecloud

Copy link
Copy Markdown

@github-actions
github-actions Bot requested a deployment to staging November 19, 2026 01:15 Abandoned
@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 19, 2026 02:06
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 19, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-19T02:06:06.311268Z
We couldn’t complete this review. Comment @codex review to try again.
3e730a3 Draft marked ready
ℹ️ 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

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
github-actions Bot requested a deployment to staging November 19, 2026 02:12 Abandoned
@simple-agent-manager
simple-agent-manager Bot merged commit 24abd33 into main Nov 19, 2026
68 checks passed

This branch had an error being deployed

1 abandoned deployment
staging — 3e730a32 Deployed Nov 19, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mistral Vibe rejects every session: MCP headers is sent as null

1 participant