# Agent9 Binary Attachment Delivery

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "agent9-binary-attachments-2026-08-28",
  "problems": [
    {
      "problemId": "agent9-workspace-rejects-small-binary-attachment",
      "summary": "The Agent9 adapter rejected a 1.31 MiB CDC ZIP before analysis because workspace files were limited to 1 MiB and binary files had no delivery path into the Agent9 sandbox.",
      "status": "optimized_verified",
      "applicability": "Auto-oncall workspaces containing customer attachments up to 64 MiB that cannot be represented by the 4 MiB UTF-8 session-file batch API.",
      "issueKeys": ["NAID-12187"],
      "sourceRefs": ["https://tidb.atlassian.net/browse/NAID-12187#problem:agent9-workspace-rejects-small-binary-attachment"],
      "signalTextIncludesAny": [
        "agent9_workspace_file_too_large",
        "agent9_workspace_binary_file_unsupported",
        "0813_cdc_lag.zip"
      ],
      "observedThrough": "2026-08-28",
      "effectiveAt": "2026-08-28T07:29:49.000Z",
      "verifiedAt": "2026-08-28T08:05:01.285Z",
      "attemptedAction": "Raise the workspace per-file limit to 64 MiB and send binary or over-4-MiB files through Agent9 user-file raw-byte or multipart upload so the Turn receives a read-only sandbox file path.",
      "evidenceUrl": "https://tidb.atlassian.net/browse/NAID-12187?focusedCommentId=23731672"
    }
  ]
}
-->

- Owner: Agent9 Codex adapter in auto-oncall-services
- Source: NAID-12187 attachment `0813_cdc_lag.zip`, 1,369,702 bytes
- Implementation status: merged in AOS PR #1142 and deployed in staging image `e7c9f1a31e3047830bc57dfcbd1195fcaab3664c`
- Effective status: `optimized_verified`

## Bounded problem

The adapter accepted only UTF-8 workspace content up to 1 MiB. The CDC ZIP was
therefore rejected before Agent9 created a usable Turn. Raising only the size
constant would still have reached the separate binary-content rejection.

## Intended change

Workspace files up to 64 MiB are accepted. UTF-8 files that fit Agent9's 4 MiB
session-file contract keep their relative workspace paths. Binary files and
larger UTF-8 files reuse Agent9's existing user-file protocol: inline plans
receive exact raw bytes, larger plans use the returned multipart upload, and
the resulting `userFileId` is selected on the Turn. Agent9 mounts that file
read-only under `/home/user/uploads/...` inside the sandbox. Images continue
through the same user-file protocol and additionally receive Agent9 visual
materialization.

## Verification

Local adapter tests deliver an exact 1,369,702-byte ZIP without putting binary
content in the session-file JSON API, select the ready file on the Turn, and
exercise both inline and multipart upload plans. The staging Deployment was
read back `1/1 Ready` on image
`e7c9f1a31e3047830bc57dfcbd1195fcaab3664c`.

NAID-12187 read replay `9e76e9d2-d122-4681-89e1-5b79330cffd8` completed
without `agent9_workspace_file_too_large` or
`agent9_workspace_binary_file_unsupported`. Agent9 console readback showed the
same selected user file in all four relevant Sessions:
`0813_cdc_lag-cf143002132c.zip`, `application/zip`, 1,369,702 bytes.

Write replay `d83e42d4-4171-48d3-a7d5-7836cdd7d9d9` persisted run DB id
`150149`, retained the correct `human_required` boundary, and again exposed the
ZIP as a 1,369,702-byte Agent9 user file. Jira internal comment `23731672` was
read back through the Jira API with `public=false` and a normalized body match.

## Next validation action

Monitor later attachments near the 64 MiB AOS boundary and Agent9 multipart
plans. A malformed or unusable binary remains a task failure inside the
sandbox; no archive parser or runner-side extraction fallback is planned.
