481359ddb2
Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2.4 KiB
2.4 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 09-per-org-filesystem-roots | Per-org filesystem roots | todo | 4 |
|
plan.md | ../../specs/multi-tenancy/spec.md |
Task 09: Per-Org Filesystem Roots
Acceptance
- One resolver owns org storage-root resolution:
orgs.storage_rootwhen set, the legacy flat tree when''. No caller builds an org path by string concatenation. - A new org's root is
<home>/orgs/<org_id>/created mode0700, containing worktrees, clones, attachments, and the agent credential home. - An upgraded instance's default org keeps
storage_root = ''permanently. The upgrade moves no files, and a test asserts the file count and mtimes under<home>are unchanged across the migration. - Worktree creation, repository clones, attachment storage, task environments, and quick terminals all resolve through the resolver.
- Storage maintenance, GC, quarantine, and temp-artifact sweeps run per-org and
never traverse another org's root. Containment checks reject a path that
escapes the resolved root, using the carried
FileInforather than a re-stat. - A missing or unwritable org root fails task creation and session launch in that org with a storage error and leaves other orgs working. There is no fallback to the shared tree.
Verification
go test ./internal/worktree/... ./internal/repoclone/... ./internal/system/...go test ./internal/tenancy/... -run 'TestStorageRoot|TestUpgradeMovesNoFiles'go test ./internal/task/service/... -run TestAttachmentOrgRoot
Files Likely Touched
apps/backend/internal/tenancy/storage.goapps/backend/internal/worktree/,internal/repoclone/apps/backend/internal/task/service/attachment_service.goapps/backend/internal/system/storage maintenance, quarantine, temp artifactsapps/backend/internal/quickterminal/
Inputs
- Spec: What (filesystem isolation), Persistence guarantees, Failure modes.
- Patterns: the path/security test conventions in
apps/backend/AGENTS.md(fake absolute roots undert.TempDir(), carry theLstatresult through, no re-stat before side effects); ADR 0045 install-wide storage maintenance.
Output Contract
Report the resolver's call sites versus a grep for direct <home> path
construction, the upgrade no-move evidence, RED/GREEN commands, and set this
task plus its plan checkbox to done.