fix(daemon): reclaim superseded open-issue workdirs - #6256
Draft
violinhost wants to merge 1 commit into
Draft
Conversation
|
Someone is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
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.
What does this PR do?
Bounds daemon-host disk growth for issues that stay open across many runs.
Today GC preserves every terminal task root while its issue is open, even though only the current healthy
(agent, issue)resume candidate and workdirs referenced by non-terminal tasks can be reused. A single long-lived issue can therefore retain hundreds of full repository copies.This change makes the server return an authoritative protected-workdir set and lets the daemon remove completed, TTL-expired task roots that are no longer protected. The daemon fails closed when the server is old or the protection lookup fails.
Thinking path:
(agent, issue).MULTICA_GC_TTL.Related Issue
Refs #1636
Type of Change
Changes Made
workdir_protection_known/protected_work_dirscontract to both daemon issue-GC endpoints.(agent, issue), workdirs pinned by non-terminal tasks (including deferred tasks), and exact sources of non-terminal manual reruns.<taskDir>/workdiris not protected.No database migration is required.
How to Test
go test -race ./internal/daemongo test -race ./internal/handlergo vet ./internal/daemon ./internal/handlergo build ./cmd/server ./cmd/multicago test ./...The affected packages, race tests, vet, and builds pass. The full suite passed except the pre-existing
internal/metricspg_sleep assertion on this local Homebrew PostgreSQL setup: the driver returnscontext deadline exceededinstead of the test-required*pgconn.PgError. Temp-database backfill tests pass when the local test role has the requiredCREATEDBprivilege; that privilege was removed again after verification.Rollout / risk
Deploy server first, then daemons. Until both sides support the protection contract, open-issue full cleanup stays disabled. Deletion remains constrained to known task env roots and is rechecked against the daemon active-root reservation immediately before mutation.
local_directorytasks retain the existing no-full-delete override.A manual rerun of a terminal task older than the full-cleanup TTL remains best-effort: if its superseded workdir was reclaimed before the rerun was requested, the existing claim path starts fresh.
Checklist
AI Disclosure
AI tool used: OpenAI Codex
Prompt / approach: Diagnosed production daemon-host disk growth from live GC logs and workspace samples, minimized the retention rule to resume-authoritative state, added red/green daemon and database-backed handler regressions, then ran package, race, vet, build, and compatibility checks.
Screenshots (optional)
Not applicable; no UI change.