Skip to content

fix: limit workspace archive size - #119

Merged
delete-cloud merged 4 commits into
mainfrom
feat-adr-0019-workspace-archive-limits
May 9, 2026
Merged

delete-cloud merged 4 commits into
mainfrom
feat-adr-0019-workspace-archive-limits

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add an ADR-0019 task packet for workspace archive size hardening.
  • Enforce an 8 MiB limit while creating archives, decoding uploads, and validating extracted tar payload totals.
  • Return existing HTTP 400 errors for oversized snapshot uploads and oversized workspace exports.

Verification

  • uv run pytest tests/coding_agent/environment/test_workspace_archive.py -v
  • uv run pytest tests/ui/test_http_server_workspace_transfer.py -v
  • lsp_diagnostics: no errors on changed files
  • Live HTTP QA: real local server returned 400 for valid oversized upload and oversized export from a provisioned Docker workspace.

Notes

  • Analyze-mode explore agents failed due account credit (402), so review proceeded with direct searches, ADR/task reads, AST-grep, LSP, tests, and live QA.

Summary by CodeRabbit

  • New Features

    • Workspace archives are now limited to 8 MiB.
    • Oversized uploads and downloads are rejected with clear error messages.
  • Tests

    • Added comprehensive test coverage for archive size limit enforcement.
  • Documentation

    • Added architecture decision record documenting workspace archive limits.

delete-cloud and others added 2 commits May 9, 2026 12:38
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Rate limit exceeded

@delete-cloud has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minute and 17 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b2af0b5-bb4a-4c2f-b1bd-0c1466d23528

📥 Commits

Reviewing files that changed from the base of the PR and between cd1a4e6 and f378a2e.

📒 Files selected for processing (2)
  • coding-agent/src/coding_agent/workspace_archive.py
  • coding-agent/tests/coding_agent/environment/test_workspace_archive.py
📝 Walkthrough

Walkthrough

This PR enforces an 8 MiB size limit on workspace archives during creation and extraction. It adds a size-tracking constant and centralized validation helper in workspace_archive.py, modifies both archive functions to check cumulative bytes, and adds unit and HTTP integration tests to verify rejection of oversized content.

Changes

Workspace Archive Size Limits

Layer / File(s) Summary
Design & Architecture Decision
coding-agent/.opencode/prompts/tasks/adr-0019-pr6-workspace-archive-limits.md
ADR document defines 8 MiB size limit scope, test targets, and implementation strategy for workspace archive enforcement across creation and extraction.
Core Size Limit Logic
coding-agent/src/coding_agent/workspace_archive.py
Introduces _MAX_WORKSPACE_ARCHIVE_BYTES constant, _raise_if_archive_too_large() helper, and modifies create_workspace_archive_base64() and extract_workspace_archive_base64() to track cumulative bytes and fast-fail on oversized content.
Unit Tests for Archive Operations
coding-agent/tests/coding_agent/environment/test_workspace_archive.py
Four tests covering creation rejection of oversized input directory, creation rejection before reading file, extraction rejection of oversized decoded archive, and extraction rejection of oversized tar member payload.
HTTP Endpoint Integration Tests
coding-agent/tests/ui/test_http_server_workspace_transfer.py
Session creation (POST /sessions) and workspace export (GET /sessions/{session_id}/workspace) both reject oversized archives with HTTP 400 and consistent error detail "workspace archive exceeds 8 MiB limit".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A rabbit hops through archives with care,
Eight mebibytes—a fair, sized square!
No bloated files shall pass the gate,
Fast-fail and swift—no room for weight. 🐰
Limits enforced, both near and far—
Workspace archives, now bijou! ⭐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: limit workspace archive size' directly summarizes the main change: enforcing an 8 MiB workspace archive size limit across creation, upload, and extraction.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-adr-0019-workspace-archive-limits

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 324b4f39-3484-43a1-8ff9-57959c819caf

📥 Commits

Reviewing files that changed from the base of the PR and between 388e522 and cd1a4e6.

📒 Files selected for processing (4)
  • coding-agent/.opencode/prompts/tasks/adr-0019-pr6-workspace-archive-limits.md
  • coding-agent/src/coding_agent/workspace_archive.py
  • coding-agent/tests/coding_agent/environment/test_workspace_archive.py
  • coding-agent/tests/ui/test_http_server_workspace_transfer.py

delete-cloud and others added 2 commits May 9, 2026 13:06
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@delete-cloud
delete-cloud merged commit cc9c95b into main May 9, 2026
1 check passed
@delete-cloud
delete-cloud deleted the feat-adr-0019-workspace-archive-limits branch May 9, 2026 08:29
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.

1 participant