`/workspace/<sessionId>/` directories accumulate on sandbox pods for workload runs
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend, infrastructure
Research direction
Read harness/src/select-sandbox.ts and trace how workload sessions set workspaceKey; compare that path with remote-worker/internal/exec/workspace.go, where the workspace directory is created. Reproduce with a workload run and inspect /workspace/ on the sandbox pod. Done means workload runs no longer leave an unused per-session directory, while ordinary workspace behavior still works.
Written by the indexing model from the issue text.
Description
Summary
For a session dispatched with --workload, the leaf's cwd is correctly set to /workspace/.moca-context/runs/<sid>/ (per #534), but the sandbox worker still also creates an empty /workspace/<sessionId>/ directory on first Exec, which the leaf never uses.
To reproduce
Dispatch a leaf with --workload, let it finish, kubectl -n moca-sandbox exec moca-sandbox-0 -c sandbox -- ls -la /workspace/. The <sessionId>/ directory is present and empty; .moca-context/{cache,runs,used} have correctly cleaned up.
Trace
harness/src/select-sandbox.tspasses{ workspaceKey: sessionId }on every Exec, regardless of whether the session has a workload.remote-worker/internal/exec/workspace.goWorkspaceRunnercreates<WorkspaceRoot>/<key>/on first use of a new key (the workspace-subdir capability).DefaultWorkspaceIdle = 30 * time.Minutesweeps these eventually, but between runs the pod visibly carries empty session dirs:
drwxr-xr-x b38c63c3-1dcb-45cb-a29c-10adba32ca5c (empty)
drwxr-xr-x ea4bc0e4-cde7-40ac-a01c-747d494ee371 (empty)
Potential fixes
- Skip
workspace_keyfor workload runs: if the session carries aworkloadId, the leaf'scwdis the workload mount, and the per-session/workspace/<sid>/serves no purpose. - Sweep eagerly on session end: remove
/workspace/<sid>/when the session's final/v1/runscompletes, instead of waiting 30 minutes idle. - Create lazily: don't mkdir
/workspace/<sid>until the first Exec targeting that cwd (and workload runs never target that cwd)
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 12
- Avg merge
- 9h 42m
- Merged PRs (30d)
- 168
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rossoctl/moca
-
P6 async fan-out: point the migration guide and ADR-0041 at the tracking epicPossibly taken A pull request linked to this issue is open or already merged. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rossoctl/moca#421 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-javascript#26203 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bytedance/flowgram.ai#1235 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
devswha/herdr-web-ui#3325 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100