fix(opencode): keep screenshot cleanup ahead of churn - #173
Merged
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
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.
A request with 100 new images per turn previously failed on its seventh turn, after only 600 successful lifetime uploads. The eight-file cleanup pass filled the retired-file queue even when every deletion succeeded. This follow-up to #172 drains healthy cleanup continuously with at most 16 concurrent deletions per cache.
Preparation shares a total one-second cleanup wait budget across both eviction passes. Cleanup continues after the caller returns, including after close; each deletion has its own one-second deadline. Failed batches stop and retain tombstones for explicit retry. Active request/stream pins, stateful history, the 300-image active cap, and the bounded retirement queue remain enforced. Sustained provider overload can still cause explicit backpressure.
Validation: both 1,000-lifetime/100-active regression variants failed against the previous implementation and pass with this change. The paced variant uses 200 ms DELETE latency, 20 ms upload latency, and inference pacing. All 50 focused provider tests pass, covering the shared wait budget, bounded concurrency, background failure/recovery, active pins, close/reopen, cancellation, and missing/expired references. Package typecheck and local Cubic review pass. Staging testing awaits the corrected prerelease.
Summary by cubic
Fixes screenshot file cleanup in
opencodeso requests with sustained image churn (100 new images per turn) no longer fail once the lifetime upload count passes ~600.Bug Fixes
Written for commit d8d404f. Summary will update on new commits.
How we tested in staging
Final staging API suite: 61 passed. Released BrowserCode
0.1.21-screenshot-files.4on AgentCore 288 passed owned OpenAI GPT-5.5 and direct Anthropic Fable-5 worker runs with 65 screenshot file references, then 66 in the same session, zero inline images, and SHA256-verified visual labels plus prior-label recall. Each native adapter also processed 325 unique generated PNGs across 14 requests with 25 active images, bounded body proofs, correct visual answers, and no duplicate uploads on reuse.All owned sessions/workspaces were cleaned up; adapter plus explicit fallback deletion left zero fixture files (OpenAI: 324 delete successes + 1 already deleted; Anthropic: 323 + 2 already deleted). These live cleanup counts are aggregate, not proof that the adapter alone deleted every file; local 1,000-image/100-active churn tests cover its background drain. Ten paid runs, including diagnosed harness/provider failures, cost $10.283591. Sonnet via Bedrock remains an intentionally unsupported file route with inline fallback.
Testing began with stable matched integration
406ea87a590fe32c55a0799df2beca571a310581, preserving staging’s existing migrations; backend and worker stayed there. Concurrent control-plane deployments later advanced to50a3ba0candb8f69adad, both retaining the screenshot gateway change; the latter has identical relevant gateway files and was still rolling at final inspection. Production was unchanged. Deployment evidence: backend, control plane, worker, verified release.