vm-agent: read inbound ACP block _meta/annotations; guard SDK outward-strip#1531
vm-agent: read inbound ACP block _meta/annotations; guard SDK outward-strip#1531simple-agent-manager[bot] wants to merge 3 commits into
Conversation
…e SDK outward-strip parsePromptBlocks now preserves _meta/annotations on inbound text prompt blocks so a SAM origin marker is available in-process. Adds characterization tests proving acp-go-sdk v0.13.5 ContentBlock.MarshalJSON drops _meta/annotations outward (agent send + mirror broadcast), so the origin-tagging consumer must propagate origin via the vm-agent's own fields, not the ACP block.
…ations strip, sync acceptance criteria
|
|
Note on the red All other checks are green (19 pass, 3 skipping). Local specialist reviews completed: go-specialist ADDRESSED, task-completion-validator PASS (see the Specialist Review Evidence table above). Go build/vet/test/gofmt all green locally. To proceed, a human should: review, then delete all nodes on staging + deploy this branch to staging + verify a fresh workspace boots and prompts work (rule 27, since this touches |



Summary
First bounded slice of idea
01KWYF4H28MM5T679P55BMZXMT(hide SAM-injected prompt text from the chat UI). vm-agent-only change plus a design-de-risking test suite.parsePromptBlocksnow preserves the ACP-standard optional_metaandannotationsfields on inbound text prompt blocks (previously only{type,text}survived viaacpsdk.TextBlock). This makes a SAM "system-injected" marker available in-process for a future origin-tagging consumer.Key finding (surfaced by an in-session test)
acp-go-sdkv0.13.5'sContentBlock.MarshalJSON()for the text variant deliberately re-emits only{type, text}, dropping_metaANDannotationson every outward serialization — bothacpConn.Prompt(to the agent CLI) and the SDK-marshaled mirror broadcast. The marshaler is asymmetric (reads inbound, strips outbound).Design consequence: the origin marker cannot ride the ACP content block outward in this SDK version. The consumer slice must read the inbound marker (via
parsePromptBlocks) and propagateoriginthrough the vm-agent's own mirror/persistence fields (e.g.ExtractedMessage.Origin+ a distinct broadcast field), not the ACP block. The two characterization tests guard this and fail loudly if a future SDK bump preserves the fields.Deferred (documented in the task file)
ExtractedMessage.Origin+ additive DOorigincolumn (excluded from FTS/dedup).No new field was added to
ExtractedMessage/reporter/DO here (no dead cross-boundary wiring).Tests (green locally:
go vet+go test ./internal/acp/..., gofmt clean,go build ./...)TestParsePromptBlocks_PreservesMetaAndAnnotations— inbound preservation.TestParsePromptBlocks_PlainTextRegression— plain text unchanged.TestParsePromptBlocks_SkipsNonTextAndEmpty— existing skip behavior.TestContentBlockMarshal_DropsMetaAndAnnotations— root-cause constraint guard (SDK marshaler).TestInjectUserMessageNotifications_SDKMarshalStripsMarker— real mirror path drops the marker.The user explicitly asked to skip staging deployment because other important work is currently using staging. This touches
packages/vm-agent/, which normally requires infra verification (rules 13/22/27). Because that gate was intentionally skipped, this PR is labeledneeds-human-reviewand must NOT be self-merged — a human decides when/whether to deploy + verify.Specialist Review Evidence
79d01f4. Verdict: correct, nil-safe, concurrency-clean, plain-block behavior unchanged.79d01f4.🤖 Generated with Claude Code
Agent Preflight (Required)
Classification
External References
gh api repos/coder/acp-go-sdk/contents/types_gen.go?ref=v0.13.5):ContentBlockText(Meta/Annotations),Annotations.Audience []Role, andContentBlock.MarshalJSON(text variant re-emits only {type,text}). ACP extensibility: https://agentclientprotocol.com/protocol/extensibilityCodebase Impact Analysis
packages/vm-agent/internal/acp/session_host_prompt.go—parsePromptBlockswidened to preserve inbound_meta/annotations.packages/vm-agent/internal/acp/session_host_prompt_parse_test.go— new tests (inbound preservation + SDK outward-strip characterization). No change tomessage_extract.go, reporter, DO, API, or web (consumer deferred).Documentation & Specs
N/A: no www docs/specs affected. Behavior + design finding recorded in
tasks/active/2026-07-07-preserve-acp-contentblock-meta-annotations.mdand idea01KWYF4H28MM5T679P55BMZXMT.Constitution & Risk Check
"text"type literal matches the SDK's ownTextBlockhelper.needs-human-review, no self-merge.