Repository navigation
Conversation
… agents Shares the provider-owned fi-core AttachmentManager through createTurnTracer, adds a bounded typed image-block helper, attachment status in inspectStatus, and Pi/oh-my-pi bindings for user prompt and tool-result images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- agent-core: one typed inline image boundary for Pi/OMP and Anthropic base64
source blocks; per-call budget counts only admitted bytes; status keyed by
real adapter ids (claude, kiro-cli, ...); drop unused policy helper.
- claude-code: prompt images on the final root and this prompt's tool-result
images on their tool spans; bounded bootstrap wait only when opted in.
- cursor-sdk: inline { data, mimeType } send images on the run span when
provider.attachments is passed and inputs are not hidden; URL images are
never fetched. Type contract pins the inline SDKImage variant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…attachments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ads, find tool spans by kind Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… follow-up message Pi forwards tool-result images as a separate user message, so the loopback model must stop calling the tool once any tool message exists. Also raise the JSON-mode stdout buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub runners export XDG_CONFIG_HOME, so the hook resolved state outside the fixture home and 25 existing hook tests failed there. Reproduced on a VM with a runner-style XDG_CONFIG_HOME (34/59) and fixed (59/59). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…redential to approved origin cursor-sdk: the instrumentation's resolved trace config now reaches captureCursorImages. Any of hideInputs, hideInputMessages, hideInputText, hideInputImages or piiRedaction (option or env) attaches with captureContent:false, so the provider-owned manager cannot upload prompt images that the instrumentation's own policy hides. agent-core: the attachment endpoint (options or FI_ATTACHMENTS_ENDPOINT) is used only when its origin equals the approved OTLP destination's origin. Otherwise no credential headers are returned and the manager gets a guarded transport that reports endpoint_unconfigured, so fi-core never builds its own transport from FI_ATTACHMENTS_ENDPOINT. agentAttachmentStatus applies the same rule. Regression tests: four instrumentation flag cases and four env cases for Cursor; status/runtime origin unit tests and a real TLS saved-profile test (unapproved origin receives nothing, approved origin is the positive control). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 5 tasks
…nsport union) Minimal adaptation forced by the merged core: the runtime ready state is now "ready" (was "queued"), and ManagerOptions.transport is the union of the legacy four-method shape and AttachmentTransportV1. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d runtime transport Adopt the ts-core f0a56b3 attachment API (SDK design sections 1 and 9): - agent-core captureAgentImages and cursor-sdk captureCursorImages now call manager.preflight (deny-wins policy, sampling, correlation, budget) BEFORE any base64 read. Only an admitted part is read, strictly validated, decoded and handed to ticket.attach. A budget denial (too_large or queue_full, which come only after the policy gate) re-preflights once at the part's exact decoded length, so a server cap below 256 KiB still captures smaller images. A malformed or throwing part releases its ticket and reports source_unavailable; an oversized one reports too_large (was source_unavailable). The legacy manager.attach getter path is gone. - agentAttachmentRuntime wraps the full AttachmentTransportV1 surface (all 11 calls re-check policy and route revalidation), built with createAttachmentHttpTransportV1, or the V1 member a caller transport carries. The unapproved-endpoint stub is V1-shaped. A caller-supplied four-method transport stays four-method, so fi-core still flags it once with FI_ATTACHMENTS_LEGACY_TRANSPORT instead of a silent upgrade. - Tests: in-process doubles are V1 (fi-core test/attachments-v1.cjs or an inline V1 double); the Pi and OMP HTTPS doubles return F01 status bodies with `reason`; suites assert no FI_ATTACHMENTS_* warning on the V1 path. New rows: preflight-before-read with exact-size retry under a small server cap, ticket release on malformed parts, guard coverage of all 11 V1 calls after revocation, and the legacy-transport warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tate after core shutdown The runtime-guard and legacy-transport rows used a config without a manifest path, so collectionEnabled() was false and the runtime stayed disabled. Give them a collectable config (no fence: ENOENT) and assert the allowed path reaches the V1 delegate before revocation. discard() invalidates with policy_denied, then shuts the provider down; ts-core f0a56b3's shutdown() overwrites the closed reason with incomplete. Assert the runtime is closed either way and that a later image is not uploaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of TH-2379 (Linear).
Coding-agent image attachments on top of the TypeScript attachment core (#677). Stacked on
feat/attachments-ts-core; keep as draft until the attachments reconciliation pass.What it does
Attachments stay OFF unless
FI_ATTACHMENTS_ENABLEDis set and the server session allows them. Every path goes through the provider-owned fi-coreAttachmentManager, so the deny-wins lattice applies: hide inputs/outputs/input images/error details, content capture off, private turns,FI_PII_REDACTION(givesredaction_unavailableat the core), and server scope. On the Cursor SDK path the instrumentation's own trace config is applied too: any ofhideInputs,hideInputMessages,hideInputText,hideInputImagesorpiiRedaction(option or env) attaches withcaptureContent:false(policy_denied), which the core cannot relax. agent-core sends FI credentials only to an attachment endpoint on the approved OTLP destination's origin. Every image is preflighted (manager.preflight) before its base64 is read; only an admitted image is read, strictly validated and decoded. Spans carry onlyfi.attachment.refs, never the bytes. No path, URL or file is fetched.createTurnTracer({ attachments })shares the provider's manager.TurnHandle.images()andChildHandle.images()take typed inline image blocks, and so doescaptureAgentImages(manager, span, blocks, options). Two shapes are read: Pi/OMP{type:"image", mimeType, data}and Anthropic{type:"image", source:{type:"base64", media_type, data}}. Each call has a 256 KiB budget that counts only admitted bytes.inspectStatus().attachmentsreports state and source readiness per adapter id.tool_call_id.attachments: provider.attachmentsoption. Inline{ data, mimeType }send images go on the run span. The package default (hidden inputs) still denies capture;{ url }images are never read. A type contract pins the inlineSDKImagevariant on 1.0.37 and 1.3.1.coding-agent-attachments-tests.yml, which runs on any base branch.Not supported (fails closed)
local_imageis a path (LocalFile). It is never read or exported.source_unavailable: Codex/Cursor hooks, OpenCode, OpenClaw, Hermes, Goose, Gemini, Copilot, Kiro, Antigravity, Augment, Devin, Grok and Muse.pi-coding-agentis not bound, because binding it as well as the Pi plugin would upload the same image twice.Qualification (private GCP VM, deleted afterwards; Node 22.19.0 unless noted)
The VM ran the 99ad622 source, then the two test-only fixes that are now in 5dd669e (the Pi harness, and the XDG fixture isolation).
XDG_CONFIG_HOME(was 34/59 before the fixture fix)@cursor/sdk1.0.37 and 1.3.1In the real-host scenario with attachments enabled, the upload is byte-exact, is parented to the tool span, and its occurrence appears in
fi.attachment.refs. Content and complete calls use only the write capability, never the FI keys. These scenarios uploaded nothing: disabled, hide inputs, hide outputs (tool image), hide input images, PII, content off, and scope denied. OTLP never contained the image bytes or the capability.GitHub CI: the
Coding-agent attachmentsworkflow passes on Node 22.19.0 and Node 24 at head 5dd669e. It runs every suite above, plus real Pi 1.5.0 and latest over HTTPS, and the OMP wire test.Fixture fix: the Claude Code hook tests now set
XDG_CONFIG_HOMEinside the fixture home. GitHub runners export their own value, which made 25 existing hook tests fail there.Not run: a real signed-in Claude Code host (BLOCKED, needs host login), a real OMP/Bun host, and product playback.
Fix pass 2026-11-11 (head 4ac7dc3)
Two review findings (P1, blocking), each with regression tests:
traceConfig, so an image could upload while the prompt text on the same span was masked. NowtracingContext()passes the generated trace config throughRunTracerintocaptureCursorImages.hideInputs,hideInputMessages,hideInputText,hideInputImagesandpiiRedactionall attach withcaptureContent:false, matching the OpenAI and Anthropic adapters. Tests: four instrumentation flag cases and four env cases (FI_HIDE_INPUT_IMAGES,FI_PII_REDACTION,FI_HIDE_INPUT_TEXT,FI_HIDE_INPUT_MESSAGES). Each asserts zero base64 reads, zero uploads and no broker calls after bootstrap.FI_ATTACHMENTS_ENDPOINTorigin.agentAttachmentRuntimenow uses an endpoint (from options or env) only when its origin equalsconfig.endpoint's origin. Otherwise it returns no credential headers, and the manager gets a guarded transport that reportsendpoint_unconfigured. That way fi-core never builds its own transport fromFI_ATTACHMENTS_ENDPOINT.agentAttachmentStatusapplies the same rule. Tests: status and runtime origin unit tests, plus a real-TLS child-process test. That test uses a saved profile fromsetup(configureOnly)and realresolveConfig. TheFI_BASE_URLcontrol givesDESTINATION_NOT_APPROVED. The unapproved origin received 0 requests and the state wasendpoint_unconfigured. As a positive control, the approved origin received the bootstrap carrying the saved key.Re-qualification (private GCP VM, deleted and verified gone afterwards; Node 22.19.0 unless noted):
@cursor/sdk1.0.37 and 1.3.1, plus the type contractuploads:0for all four flags (controluploads:1, byte-exact). Credential:savedSecretReceived:false,otherOriginRequests:[]Environment notes from the VM run:
umask 0002causedUNSAFE_DIRECTORY_MODEfailures in agent-core, pi-plugin and omp tests (the hardened file layer rejects group-writable dirs). The same code passes on the same VM underumask 022.integrations/coding-agents/fixtures, whichcore.test.cjsneeds. A rerun with the fixtures gave the 473/473 above.(Historical, fixed in the resync below.) GitHub CI was red at 4ac7dc3 because the base moved.
feat/attachments-ts-coremoved to 031178f at 06:14Z, after the last green run (5dd669e, 05:08Z). CI builds the merge ref, and the new core API breaks this lane's existing code:AttachmentRuntimeStatehasreadyand no longer hasqueued. The existingstatus().state !== "queued"checks in agent-coreattachments.tsand cursor-sdkattachments.tsfail to compile.ManagerOptions.transportis nowAttachmentTransport | AttachmentTransportV1. V1 has nouploadand takes akeyargument. The originaldelegate.bootstrap/uploadcalls would fail the same way.The resync below reconciles the lane to ts-core f0a56b3.
Resync to ts-core f0a56b3 (head bdce56b)
Merged the updated
feat/attachments-ts-core(f0a56b3, merge commit ca63722, clean). Never rebased."ready"(was"queued") in agent-core and cursor-sdk, plus thetransportunion type. There is no behaviour change. This is the VM control ("ctl").captureAgentImagesandcaptureCursorImagescallmanager.preflight(deny-wins policy, sampling, correlation, budget) first. Only an admitted part is read, strictly validated (exact decoded length, computed without decoding), decoded and handed toticket.attach. Theget data()getter throughmanager.attachis gone.too_largeorqueue_fulldenial comes only after the policy gate passes, so the adapter reads the part's length and re-preflights once at its exact size. A servermax_upload_bytesbelow 256 KiB therefore still captures smaller images.source_unavailable. An over-budget part now reportstoo_large(it wassource_unavailable).agentAttachmentRuntimewraps the fullAttachmentTransportV1surface. All 11 calls re-check collection policy and route revalidation; before, the four legacy calls did. The transport is built withcreateAttachmentHttpTransportV1, or comes from a V1 caller transport or the V1 member a legacy-shaped one carries. The unapproved-endpoint stub is V1-shaped, so it no longer triggersFI_ATTACHMENTS_LEGACY_TRANSPORT.AttachmentTransportV1. The Pi and OMP HTTPS doubles return F01 status bodies withreason. Suites assert that the V1 path emits noFI_ATTACHMENTS_*warning.discard(), ts-core f0a56b3 reportsincompleterather thanpolicy_denied(see the core note below), so the test now asserts that the runtime is closed and that a later image is not uploaded.Public signatures are unchanged.
Core note (ts-core lane, not changed here):
AttachmentManager.shutdown()setsclosedReason = "incomplete"even afterinvalidate("policy_denied"). Adiscard()(invalidate, then provider shutdown) therefore reportsincomplete. The control build fails the originalpolicy_deniedassertion the same way (472/473).Qualification (private GCP VM
fagi-omega-staging, loopback only, deleted and verified gone)Every tree was rebuilt from public refs plus patches, and the tree hashes matched the pushed commits.
FI_ATTACHMENTS_*warnings on the headFI_ATTACHMENTS_LEGACY_TRANSPORTfires because the old wrapper dropped the V1 member. The OMP wire also showsFI_ATTACHMENTS_WIRE_REJECTED.discardstate change above)enableduploaded 0). With the head's harness (F01reasonbodies plus a stderr check), the same control build passes 8/8. The mechanism was not traced: uploads are counted at initialize, which runs before the changed responses.Mutation detail:
release()putContentMutations ran on the round-2 tree, where the
discardrow was still failing for an unrelated reason. That row is excluded from the counts above, and the round-3 fix only touches that test. After the mutations were restored, the head passed again.GitHub CI at bdce56b is green:
Coding-agent attachmentspasses on Node 22.19.0 and Node 24, as does n8n (run 43027104507). On the first attempt, the Node 22 job failed one timing row intest/forks/claude/tracer.test.cjs(a shutdown-deadline race). This lane does not touch that file. The rerun of the failed job passed.Not run here: real
@cursor/sdk1.0.37/1.3.1 contract rows (captureCursorImagessignature unchanged), a signed-in Claude Code host, a real OMP/Bun host, product playback.🤖 Generated with Claude Code