Skip to content

Put every artifact of a run in Download all - #436

Open
officialasishkumar wants to merge 1 commit into
useagenthq:mainfrom
officialasishkumar:fix/archive-every-run-artifact
Open

officialasishkumar wants to merge 1 commit into
useagenthq:mainfrom
officialasishkumar:fix/archive-every-run-artifact

Conversation

@officialasishkumar

@officialasishkumar officialasishkumar commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

By opening this pull request you agree to the Contributor License Agreement. On your first pull request a bot asks you to sign it with a one-line comment.

Fixes #401

GET /api/artifacts/runs/:runId/archive listed a run's artifacts through listArtifactsForOrg with ARCHIVE_MAX_ARTIFACTS = 100. A run with 101 artifacts got a normal 200 ZIP of its newest 100, and nothing told the viewer that the oldest file was missing.

The issue gives two choices: include every file within the size limit, or refuse with a clear error. This takes the first. The ZIP is already built in memory under a 100 MiB total size limit, and that limit is what keeps the build safe, so the count cap was only cutting files out.

What changed

  • New listRunArtifactFilesForOrg in backend/src/artifacts/repo.ts: every artifact of one run in the org, newest first. It selects only name, sizeBytes and storageKey, the columns the archive reads, so an uncapped list never loads workpiece state.
  • The archive route uses it, and ARCHIVE_MAX_ARTIFACTS is gone. The ZIP now holds every artifact of the run. If the run's files add up to more than 100 MiB, the route refuses with the existing 413 before reading any bytes. It never returns a partial ZIP.
  • listArtifactsForOrg and the Artifacts page list are unchanged (that list is Let the Artifacts page list files past the newest 100 #210).
  • docs-site/docs/api/artifacts.mdx now describes this behaviour instead of the old 100 artifact cap.

The Download all link in the UI needs no change: whatever it gets is now either every file or an error.

Tests

Two new cases in backend/test/artifacts.test.ts, through the real archive route:

  • a run with 101 artifacts gives a ZIP of 101 entries, including file-0.txt, the oldest one, which the old cap dropped
  • a run whose oldest artifact puts it over 100 MiB, followed by 100 small ones, gets 413 run artifacts exceed the archive size limit instead of a ZIP of the newest 100

Both fail on main (Expected length: 101, Received length: 100 and Expected: 413, Received: 200).

This change has no visible UI, so the tests above are the before and after. The Download all button itself was not clicked in a browser.

Checks with Bun 1.3.14, against pgvector/pgvector:0.8.6-pg16-bookworm:

  • cd backend && bunx -p typescript@5.9.3 tsc --noEmit: passes
  • cd backend && bun test test/artifacts.test.ts: 42 pass, 0 fail
  • cd backend && bun test test/ratchet.test.ts: 6 pass
  • bun test scripts/agent-docs.test.ts: 5 pass
  • cd backend && bun run test: 3562 pass, 28 fail. The 28 failures are all in engine runtime and sandbox config tests (src/engines/runtime-provider-bridge.test.ts, src/provider-gateway/sandbox-config.test.ts, src/engines/codex-subscription-runtime.test.ts and four others) that run the native runtime tooling on this machine. Running those seven files on unchanged main gives the same 28 failures, so they come from the machine, not from this change.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The run archive route listed artifacts through listArtifactsForOrg, which
caps a page at 100 rows, and passed ARCHIVE_MAX_ARTIFACTS = 100. A run
with more artifacts got a normal 200 ZIP of its newest 100, with nothing
to tell the viewer that older files were missing.

The archive is already built in memory under a 100 MiB total size limit,
and that limit is what keeps the build safe. So the count cap goes:

- listRunArtifactFilesForOrg in artifacts/repo.ts returns every artifact
  of one run in the org, newest first, selecting only the name, size and
  storage key the archive reads (no workpiece state, since the list is no
  longer capped);
- the archive route uses it, so a ZIP holds every artifact of the run,
  or the request is refused with the existing 413 when the run's files
  add up to more than the size limit. It never returns a partial ZIP.

The API reference now says the archive includes every artifact up to
100 MiB in total, instead of describing the old 100 artifact cap.

Fixes useagenthq#401
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.

Tell the viewer when Download all leaves out files past the newest 100

1 participant