Repository navigation
feat: give tasks durable project-optional workspaces - #15749
Conversation
|
@greptileai review Please review the full task workspace ownership change, including authorization retention, admission transitions, repository preparation, migration replay, and native persistence. The maintainer requested a single PR for this cross-layer change. Live local and Daytona verification is in progress. |
[Critical impact] This head appears safe to merge; no blocking code issue was found. SummaryAdds durable task workspaces independent of project assignment, with channel defaults, authorized repository preparation, and sparse file recovery.
Reviews (52) · Last reviewed commit: "fix: share canonical project workspace d..." · Reviewed by Greptile |
|
@greptileai review Please review the updated source at d7ff016. The null source-project fallback is fixed, with a two-admission chat regression. Workspace discovery and selection now share one lifecycle predicate, tested through the native tool/API/database path. Persisted default workspace mode is normalized in session fingerprints; the actual Slack fresh-to-resume regression passes. The private-file finding is already prevented transactionally by migration 0313: The local UI-created projectless task has completed and its exact file bytes were independently verified. The three-cell legacy local/native local/native Daytona campaign is running at https://github.com/paperclipai/paperclip/actions/runs/37997836442. Full CI and remaining fixture repairs are still in progress; this remains a draft. |
d7ff016 to
85d86b2
Compare
|
@greptile please review the latest head 85d86b2. The branch is rebased onto current master. Continuation source-project handling, workspace eligibility, and the E2E timing race are fixed. Full source authorization now covers retained workspace provenance and scoped access across entry points. Please also reassess the privacy-source finding in light of the existing transactional database trigger in migration 0313 and the fresh-database regression tests. |
|
@greptile please review head 18f982a. Live testing found and fixed the project picker sending legacy workspace-reset fields; it now changes only project organization and passes the browser retest. Native immutable task-root validation now preserves the existing ownership hold before filesystem work. E2E header and normalized tool-receipt matching were corrected from actual local/Daytona evidence. Authorization fixtures now contain real scoped user identities. Focused checks pass; full CI and the corrected three-environment campaign are running. |
|
@greptile please review b39a7f6. All three latest findings are fixed with focused regressions: explicit sources cannot fall back, ordinary workspace PATCH updates invalidate older intent atomically and preserve active owners, and channel defaults use the canonical active/idle eligibility filter. Server typecheck and targeted tests pass. The live three-environment continuation campaign remains pinned to 18f982a and has not been interrupted; these later edge-case fixes have separate test provenance. |
|
@greptileai please review the latest head a7acba6002. The three findings from the rebased review are fixed with regressions (b39a7f6, reviewed 5/5). The real three-environment E2E campaign then found that repository admission attempted to lock a checkout before cloning it. The latest commit locks its validated existing parent; the real-lock/real-Git regression verifies fresh publication, concurrent admissions, and retained dirty files (6/6 persistence tests pass). The corrected bounded E2E campaign is being rerun. |
|
@greptileai please review the latest head 9036e3f74. The checkout publication lock is now per canonical repository target (a93e8b68d), addressing discussion_r4235911942 with real concurrent clone/reuse coverage. All 52 lock/persistence tests pass. The remaining CI fixture failures are fixed without production or assertion changes: comment batching 28/28, responsible-user invariants 13/13, and callback bridge 66/66 pass. Full build and workspace typecheck passed; fresh full-suite/CI validation is running. |
Separate task organization from filesystem ownership. Add channel defaults, workspace and repository tools, safe admission transitions, and sparse native workspace persistence. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add three full-stack workspace and repository resume journeys, synchronize operation documentation, and enforce non-enumerating task route authorization. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Keep organizational projects separate from source ownership, align workspace discovery with selection, normalize persisted defaults for session reuse, and preserve typed setup diagnostics. Add privacy provenance regressions and synchronize API/tool contracts. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Seed active memberships for reused task workspaces, respect retained-source deletion order, and remove a provider-speed race from the E2E oracle while preserving deferred-preparation checks. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Authorize every retained task and source project independently from organizational assignment, including native child creation, selection, reopening, and repository preparation. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Keep project edits organizational, validate immutable native task roots before materialization, align authorization fixtures, and correct live E2E evidence collection. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Fail closed for an unavailable configured source, invalidate superseded workspace intent atomically on ordinary task updates, and reuse canonical workspace eligibility in channel settings. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
9036e3f to
6195c98
Compare
Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
@greptileai apex review Please review exact head 753680b. The configured-default/primary precedence finding is repaired through the shared task creation/bulk/provisioning resolver. Existing validation and deny-only restrictions remain intact. Final 79 affected checks and full repository typecheck/build pass; fresh CI and security scans are running. |
…16194) ## Thinking Path > - Paperclip uses versioned PostgreSQL migrations to preserve application data. > - Drizzle uses schema snapshots to generate future migrations. > - The database package already prunes snapshots to the five newest files. > - PR #15749 added three snapshots but left eight in the resulting tree. > - This PR removes the three excess files and documents the retention requirements. > - Coding agents and Greptile receive the same scoped rule for future migration changes. ## Linked Issues or Issue Description Refs #15749. Related: #16191 includes overlapping snapshot cleanup with its new migration. This PR isolates the existing excess and the repository rule; it has no dependency on that feature. **What happened?** The migration metadata directory contains snapshots 0331–0338. The existing pruning script retains only the newest five, but the older three were left in master. **Expected behavior** Keep snapshots 0334–0338. Commit snapshot pruning alongside additions and recheck the combined tree after rebases or merges. Preserve all SQL migrations and journal entries. **Steps to reproduce** At master commit e3029c6, list `packages/db/src/migrations/meta/*_snapshot.json`. There are eight files. Run `pnpm --filter @paperclipai/db prune:snapshots`; snapshots 0331–0333 are removed. **Paperclip version or commit** e3029c6. Repository maintenance; deployment mode is not applicable. ## What Changed - Remove snapshots 0331–0333 using the existing pruning script. - Add `rules/database-migration-snapshots.mdc` with retention, generation, rebase, preservation, and review requirements. - Register the rule in `.greptile/files.json` with matching scope patterns. ## Verification - Existing `prune:snapshots` script completed successfully via `npm run --prefix packages/db prune:snapshots`. - Existing migration numbering and safety checks passed, run with the available tsx loader. Safety reported only baseline-covered historical findings. - A local assertion check confirmed exactly snapshots 0334–0338 remain, with retained snapshots and journal byte-for-byte equal to the base. SQL migrations are unchanged. - A local assertion check verified that rule globs equal the Greptile scope, all manifest paths exist, representative migration/schema files match, and unrelated server/UI files do not match. - `node scripts/check-maps.mjs` and `git diff --check` passed. - Full application typecheck, test suite, and build were not run for this metadata and review-rule-only change. No runtime code, schema, SQL, or dependencies changed. ## Risks Low risk. The five newest schema snapshots remain unchanged. Database migration history is preserved. The rule supplies agent and review guidance; it does not add a new CI enforcement gate. Recheck retention if another migration merges first. ## Model Used OpenAI GPT-6 via Codex, with reasoning and shell/file tools. The exact runtime model ID and context-window size are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge Co-authored-by: Paperclip <noreply@paperclip.ing>
…16095) ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Each task must have an isolated workspace that its agent can read. > - Older project checkouts can contain worktrees for restricted tasks. > - The source access check correctly rejects these shared checkouts. > - A fresh task then fails even when its agent can clone the project remote. > - This pull request gives fresh default tasks a separate clone of the same remote. > - The task can start while the restricted task files remain protected. ## Linked Issues or Issue Description **What happened?** Fresh tasks fail with `Task workspace access is no longer available` when their default project checkout contains a restricted task worktree. The caller has access to the new task and its remote repository. The shared local Git source is unsafe to copy. **Expected behavior** Use a separate clone of the same authorized remote for a fresh default task. Keep source access checks and responsible-user Git credentials in force. **Steps to reproduce** 1. Put a restricted task worktree inside a project checkout. 2. Assign a new default task to an agent that cannot read the restricted task. 3. Start the new task. The current source check fails before workspace creation. 4. With this fix, the task uses a separate remote source. The restricted files are absent. Later runs reuse the same owned source. Related work: Refs #15749, Refs #15528. This change keeps their source retention and workspace ownership checks. ## What Changed - Add a remote source path scoped to the company and task. - Clone through the run’s Git connection after the shared source fails its access check. - Reject reused workspaces, explicit selections, pinned branches, local sources, credential-bearing URLs, and symlink paths. - Check source access again before publishing the workspace. - Resolve later runs from the verified recorded source. Ignore leftover clones that the saved workspace does not own. - Record provenance for new implicit Git defaults. Read the current task binding before fallback. Preserve explicit, inherited and ambiguous legacy checkout choices. - Keep the effective task strategy during startup validation of matching implicit defaults. Preserve the existing explicit-selection write check. - Add regression coverage and document the fallback. ## Verification - Merged master `c8efdbfba43` and resolved both rounds of catalog/index conflicts. All upstream suites, classifications, source references and story IDs are preserved. Both fix branches combine cleanly in either merge order, with no catalog fingerprint drift. - Passed locally: 313 focused source-isolation, preparation, task-creation, binding and trust tests before the final startup fix. The final fix passes all 100 source-trust, task-binding and environment-selection tests. Earlier workspace-resolution and persisted-source suites also passed. - Real-Git regressions cover all three review findings. Reconstruction ignores an unrecorded clone and preserves unpublished commits/files. Explicit and parent-inherited checkout IDs without typed selections retain their denial and branch tips without cloning or acquiring an environment. A protected-project heartbeat completes and resumes using the task’s Git strategy with read access. Explicit selection still requires writes, and a mismatched default is rejected. - Passed: the complete Storybook catalog check with no drift errors, feature and agent map structure checks, and all 17 catalog/index script tests. The generated index counts match the merged catalog. The current upstream verification-route inventory remains unchanged. The catalog contains all 262 authored suites and 2,481 story IDs. - Passed: full workspace typecheck and build after the final guard changes, on latest head `79d2adadcb6d3d7a04b9943a91bdb8b0b6abea6d`. - Latest head `79d2adadcb6d3d7a04b9943a91bdb8b0b6abea6d`: complete CI passed (54 successful checks, two intentional skips), including the full general/serialized suites and all eight browser shards. Fresh Greptile Apex review is 5/5 on this same commit, with no unresolved findings or recommendations. The full local test command was attempted earlier without a complete aggregate result; the complete suite result is from CI. - Manual check: configure a shared project checkout with a restricted task worktree. Admit a fresh default task using the authorized remote. Confirm separate Git storage and no restricted local branch or file. Reuse, close and reopen the task workspace. Confirm that explicit, literal branch and low-trust selections retain the denied source. ## Risks - A clean remote clone excludes unpublished local work. The fallback applies only to fresh default tasks and rejects existing workspace or branch selections. - A private remote can fail to clone when the responsible user lacks Git credentials. The run then reports the failure; access checks are not bypassed. - Older untyped checkout bindings cannot prove default provenance. They keep the source denial instead of silently dropping unpublished work. - New implicit Git defaults use the existing workspace-intent contract. The source directory uses existing instance storage. No schema migration is required. ## Model Used OpenAI GPT-6, model ID `gpt-6`, through Codex. Used reasoning, repository inspection, code editing, terminal tools, and test execution. The API session does not expose an exact context window size. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - A stopped sandbox can hold workspace files that still need a durable copy. > - File recovery must reopen the exact allocation and directory recorded by the run. > - Workspace preparation can place that directory below the allocation root. > - Daytona resume returned the allocation root even when recovery needed the recorded child directory. > - This pull request lets the file-recovery owner request that exact directory. > - Ordinary resume keeps its allocation-root behavior. The recovery source checks stay strict. ## Linked Issues or Issue Description **What happened?** A stopped native run had a prepared remote workspace. The recovery service stopped and retained its allocation. The next file-recovery step failed with `source_binding_invalid` and `reopened_cwd_mismatch`. Daytona resumed the correct allocation and matched its sentinel, but returned the allocation root instead of the workspace directory recorded on the lease. **Expected behavior** The file-recovery owner must reopen its exact recorded directory without creating an allocation, an empty directory, or an agent turn. Ordinary execution resume must keep returning the allocation root for normal workspace preparation. **Steps to reproduce** 1. Prepare a task workspace below a Daytona allocation root. 2. Stop and retain the allocation with unsaved workspace files. 3. Request source-bound file recovery. 4. Before this change, the provider returns the allocation root and the strict cwd check rejects it. **Paperclip version or commit** Reproduced from `050365e09d88411960fc3bacc1c08c46c0d9b6fa`. **Deployment mode** Docker with the bundled Daytona provider. Local tests use synthetic provider boundaries and disposable PostgreSQL. Refs: #18517, #15749. Related retained-export work: #17916. That work does not change the Daytona resume handler. ## What Changed - Add an optional driver-only `requestedCwd` resume field to the SDK contract and existing host forwarders. - Set the field only after the owned file-recovery path verifies the recorded source. - Require Daytona to match the requested directory to the recorded lease directory. Require a normalized absolute path without NUL bytes. Keep the allocation and sentinel checks. - Keep ordinary resume unchanged when the field is absent. - Add provider, host, and real workspace-preparation regressions. Document the separate directory contracts. ## Verification - The original provider regression failed for reusable and ephemeral leases. The scoped regression also failed to read a real retained file from the wrong root. Ordinary resume controls passed before the fix. - Current provider handler: **345/345 passed**. This includes exact-directory, malformed, missing, foreign, sentinel, reusable, ephemeral, ordinary-root, and real-file cases. - Removing only the owned producer's cwd request makes its real PostgreSQL regression fail with the original `reopened_cwd_mismatch`; the source file was restored exactly afterward. - Current host selection: **10/10 passed** against disposable PostgreSQL 17. It covers the inspected owner, sandbox forwarding, generic plugin forwarding, normal resume without the field, same and later task workspace preparation, and ownership rejection. The same-workspace control retains saved bytes and does not append another workspace path. - Current SDK and Daytona builds, server build, module boundaries, maps, and diff checks passed. The server used its normal unchanged-Runner cache. Its canonical input digest matched the previously verified build, and the canonical assessor accepted the copied original stamp and outputs. The changed SDK and server compiled from current source. - Local package-wide validation exposed two unchanged 30-second timeouts in the 145,000-member tar-listing cases. A single-file control reproduced both timeouts. That test mocks this provider module. The failures remain recorded; no timeout changed. The earlier package run had 497 passes, two failures, and seven skips. It is historical evidence from the abandoned broader resume experiment, not final-source package acceptance. - Initial host attempts timed out during database setup before any assertion. The final host selection used the existing supported pre-migrated disposable template. No test timeout changed. - Greptile reviewed exact head `8d0e577d1234ad394887255f13707c010dee6d24`: **5/5, no actionable issues, zero review threads**. [Current review](#18527 (comment)). - The official [Ponytail review](#18527 (comment)) also assessed exact head `8d0e577d1234ad394887255f13707c010dee6d24`: **5/5, no findings**. Its check is terminal neutral; its completed source assessment is not a test-execution claim. - [Primary CI](https://github.com/paperclipai/paperclip/actions/runs/41286802674) initially lost its spot runner in the UI/CLI workspace lane. The log records an explicit shutdown signal and no test assertion result. UI, CLI, lane scripts and dependencies are unchanged; the adjacent identical-source baseline lane passed. The single failed-lane retry passed at the same source. The initial failure is retained. All exact-head CI gates are now green. - No live repair or image deployment is claimed by this PR. Commands: ```sh node packages/plugins/sandbox-providers/daytona/node_modules/vitest/vitest.mjs run --config packages/plugins/sandbox-providers/daytona/vitest.config.ts packages/plugins/sandbox-providers/daytona/src/plugin.test.ts node node_modules/vitest/vitest.mjs run --project @paperclipai/server server/src/services/workspace-recovery.test.ts server/src/__tests__/environment-runtime.test.ts -t 'recovers a protected retained source|owned export directory|prepares the (same|later) task workspace|does not reopen a retained source|resumes only the exact stopped sandbox lifecycle|explicit export directory' pnpm -C packages/plugins/sandbox-providers/daytona build pnpm --filter @paperclipai/server build node scripts/check-module-boundaries.mjs node scripts/check-maps.mjs git diff --check ``` ## Risks - A provider that does not support the optional field can still return a different directory. Recovery keeps failing closed on that mismatch. - Ordinary resumes omit the field. The tests cover the same workspace and a later task so that normal preparation does not gain an extra path prefix. - The field grants no source ownership, stop proof, file-persistence proof, or execution authority. Existing allocation, company, task, run, claim, and cwd checks remain in force. - No schema migration, retry-policy change, model replay, or historical-row repair is included. Existing failed attempts remain historical facts. Deployed file recovery still needs its normal admission and independent persistence and physical-stop receipts. ## Model Used - OpenAI GPT-6 through Codex. Used reasoning, source inspection, tool use, and code execution. The exact serving model identifier and context window are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge Co-authored-by: Paperclip <noreply@paperclip.ing>
…19311) ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Native agents discover reusable workspaces through `list_workspaces`. > - The tool returned every authorized workspace in one result. > - A large inventory exceeded the durable command journal limit. The result stayed pending, and session cleanup blocked the next turn. > - This pull request limits discovery in SQL and returns explicit continuation metadata. > - Agents can inspect every authorized workspace without sending the full inventory in one command. ## Linked Issues or Issue Description Related: #15749 introduced the task workspace tools. No duplicate pagination fix was found. **What happened?** A native workspace discovery call returned a multi-megabyte inventory. Persisting its result failed with `command_payload_too_large`. The preceding answer could still be saved, but cleanup retained the unsettled tool call. A later turn failed before provider work with `native_session_cleanup_quarantined`. **Expected behavior** Workspace discovery must return a manageable page. Agents must be able to request the remaining authorized rows. Existing visibility checks and journal integrity checks must stay effective. **Steps to reproduce** 1. Create 2,000 task-selectable workspaces with ordinary repository paths. 2. Call `list_workspaces` from an admitted native run. 3. On the old code, the real API regression returns 869,781 bytes. The command journal allows about 510 KiB. 4. On the repaired code, follow `nextCursor` to inspect all rows. Pages contain at most 100 rows and fit within 128 KiB. **Paperclip version or commit** Reproduced on source commit `7351a9d74f` before the repair. **Deployment mode** Isolated source checkout with real PostgreSQL and authenticated native agent APIs. Hosted deployment and incident recovery remain separate. ## What Changed - Validate workspace list limits and UUID cursors with a JSON Schema pattern supported by strict validators. Return `workspaces`, `limit`, `returnedCount`, `hasMore`, and `nextCursor`. - Apply company, visibility, lifecycle, and cursor conditions before the SQL limit. Order pages by workspace ID. Fetch one extra row to detect continuation without a count query. - Fit encoded pages within 128 KiB, including JSON escaping and Unicode. If one summary cannot fit, return explicit string previews with `truncatedFields`. The authorized detail API retains its full record. - Keep existing unpaged summary callers on their array response and recent-use order. - Update the native tool descriptor, generated contracts, catalog fixture, and execution documentation. - Add regression coverage for large inventories, complete pagination, stable pages, private and foreign rows, invalid inputs, and legacy summary behavior. Add an opt-in two-turn live Codex acceptance check. ## Verification - Red before repair: `task-workspace-api.test.ts -t "pages a large authorized workspace inventory"` failed because the result was 869,781 bytes instead of below 128 KiB. The transport regression also failed at 2,284,671 bytes. - Green after repair and review changes: 120 tests passed across the workspace API, transport, routes, native authority, coordinator, historical-question, and Codex vertical-slice suites. They cover complete discovery, byte-sized pages, oversized individual summaries, full detail retrieval, private/foreign/lifecycle exclusions, and strict schema compatibility. - Journal safety: two focused durable control-plane tests passed. Oversized result rejection and lossless valid result delivery remain effective. - Tool catalog and reconciliation: 30 tests passed. - `pnpm -r typecheck`: passed. - `pnpm build`: passed again on final commit `bc10880da6`. Server typecheck also passed after the review changes. The original affected suites passed on the rebased first commit (31 tests), and the expanded review regression set passed afterward (120 tests). - Real provider acceptance passed again on final commit `bc10880da6`: local macOS arm64, rebuilt native Runner, `gpt-6.1-sol`, high effort, per-turn lifecycle, and 2,000 persisted workspaces. Both turns succeeded. Persisted call inputs and results prove that the second page uses the first result’s cursor, both calls succeed, their IDs do not overlap, and the encoded results stay within 128 KiB. The second turn kept the provider conversation and file. Both task locks were clear after completion, and no recovered execution failure was recorded. Duration: 166.92 seconds. - Full local `pnpm test:run` stopped in the chat shard: 330 tests passed and one Slack registration test failed with `socket hang up`. That exact test passed in isolation without changes, and the final-head CI chat shards passed. A broader local managed-Slack follow-up produced no result after about eight minutes and was interrupted; it is not counted as a pass. The original full-suite failure remains recorded. - The first CI head failed native tool-schema compilation because strict validators did not recognize `format: uuid`. The revised descriptor uses a UUID pattern. The previously failing coordinator, native vertical-slice, authority, and history suites now pass locally. The stronger live cursor-receipt acceptance check passed. Final-head CI completed on `bc10880da6`: 57 checks passed and five optional checks were skipped, with no failures or pending checks. Greptile reviewed that commit at 5/5; both prior findings are resolved. - Dependency cost: paged discovery runs the existing visibility-scoped summary query with an ID cursor and at most 101 returned rows. It adds no count query, filesystem scan, provider call, or background worker. ## Risks - Native `list_workspaces` now returns a page object instead of an array. Individual summaries can be explicit previews when a single record exceeds the byte budget. Its advertised descriptor and generated contracts change together. Agents must follow `nextCursor` until null for a complete inventory. - Each page rechecks current visibility. Concurrent insertions, deletions, or access changes require a fresh scan when a complete point-in-time inventory is needed. - No migration or journal-limit change. An existing cleanup quarantine still requires normal recovery after deployment; this PR does not bypass it. ## Model Used OpenAI Codex, GPT-6 family, with reasoning, shell tools, code editing, and test execution. The exact served model revision and context window are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
…rectory (#19475) ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agent Chat returns delegated-task completions to the chat that started them, and the runner E2E `completion-updates` suite checks this with real providers > - The restart cell (`completion-updates.runner-codex.local.handoff-completion-restart`) failed before its server restart with "Timed out waiting for worker waiting while originating chat is idle" > - Since project-optional task workspaces (#15749), a task in a project without a workspace runs in its isolated task directory. A native chat runs in its isolated conversation directory. Native Codex can read only that directory. > - The fixture still wrote its brief wait scripts into the managed project workspace and the agent home. Codex got EPERM on both scripts, wrote the note from the task record, and finished. The worker never reached the gate, so the setup poll timed out. > - This pull request makes the waits name only cwd-relative files and publishes each brief into the run's own isolated task directory > - The benefit is that the restart cell reaches its real boundary again (durable Done, source provider held at the gate, server restart) and tests restart recovery instead of a stale fixture path ## Linked Issues or Issue Description **What happened?** The runner E2E cell `completion-updates.runner-codex.local.handoff-completion-restart` timed out in setup. The run ledger shows both agents report `permission_denied` (EPERM) for `node .../wait-for-brief-*.cjs`. The worker run cwd was `<instance>/isolated-workspaces/<company>/<issue>`. The fixture wrote the script to the managed project workspace and the agent home. **What did you expect to happen?** The worker waits at the brief gate while the chat is idle. Then the cell releases the brief, holds the completion reply at its gate, and restarts the server. **Steps to reproduce** `pnpm test:e2e:runner -- --max-automatic-retries 0 --id completion-updates.runner-codex.local.handoff-completion-restart` on master `6cafcaf89b`. **Classification** Test defect. The failure happens before the restart. Workspace isolation is the intended product behavior. ## What Changed - `tests/runner-e2e/chat-stories.ts`: add `workspaceChatBrief(nonce, timeoutMs)`. It returns a bounded `node -e` command that reads and writes only cwd-relative files, plus `at(dir)` to find the gate and ready files in a workspace. - `tests/runner-e2e/completion-update-flow.ts`: the worker and completion instructions use that command. The fixture reads readiness from, and publishes briefs to, `isolated-workspaces/<company>/<issue>` for each delegated task and the source chat. The setup poll state now records the worker run cwd. Cleanup releases every wait that is still open. - `tests/runner-e2e/chat-stories.test.ts`: regression test. It runs the command from a temporary cwd, checks that the command names no host path, and checks the nonce and timeout bounds. It was red before the helper existed. - `tests/runner-e2e/catalog.ts`: bump the `completion-updates` definition to version 28 and set `workerBriefWorkspace: "run-isolated-task-directory"`. - `tests/runner-e2e/README.md`: describe the new brief location. ## Verification - `npx vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/chat-stories.test.ts tests/runner-e2e/completion-updates.test.ts tests/runner-e2e/catalog.test.ts`: 108 passed. - Live cell, native Codex `gpt-5.6-sol`, local runner: `pnpm test:e2e:runner -- --max-automatic-retries 0 --id completion-updates.runner-codex.local.handoff-completion-restart`. Results are in the Verification comment below. - Two earlier local attempts in this worktree failed in setup with `harness_test_failed`. The worktree did not have a built `paperclip-runnerd`. After `pnpm --filter @paperclipai/paperclip-runner build`, the cell passed. ## Risks - Low risk. The change is in test fixtures only. No product code changes. - The idle, busy, and multiple cells share this flow. They now also use the isolated task directory. That is the same directory the product selects for these tasks. - The agent must run the inline command from its cwd. The instructions say this, and the command fails closed (no gate) if the agent runs it elsewhere. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, via Claude Code with tool use (shell, file edits). Default context window. Extended reasoning on. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Thinking Path
Linked Issues or Issue Description
Subsystem affected
Cross-cutting: task admission, execution workspaces, runner tools, native file persistence, chat settings, and database contracts.
Problem or motivation
Projectless tasks can inherit an agent fallback directory. A short task can then spend minutes copying unrelated files. Project assignment also does not clearly express which folder or repository a task should use.
Proposed solution
Keep one durable execution-workspace binding per task. Create a stable company/task directory when no source is configured. Resolve app and channel choices through the same domain service. Let agents inspect and select authorized workspaces and request contained repositories. Apply changes at the next safe admission. Reuse verified input seeds and transfer changed output contents.
Alternatives considered
A separate binding and realization subsystem would duplicate existing workspace and recovery ownership. The chosen design extends the existing workspace aggregate. Recovery delta chains are deferred; changed input generations still use full seeds.
Roadmap alignment
This extends existing workspace, sandbox, artifact, and experimental chat support. The maintainer requested this work and one PR for the full change. Related work: #10856, #9231, and #15662. These cover adjacent workspace and transfer behavior; this PR adds the cross-layer task ownership contract.
What Changed
doc/plans/2026-10-09-task-workspaces.md.Verification
753680b61c3fc51f7970fc0074f79e97d65fd9fc. Full CI,ci / verify,ci / e2e, Superagent and legacy Snyk passed. Greptile Apex completed at 5/5 on this same commit, with no unresolved review findings. Historical failed attempts and live acceptance qualifications remain recorded below.pnpm -r typecheckandpnpm buildpass on frozen source. Three complete suites pass 69 cases with zero skips: source trust 21, controller classification 9, reopen 39. Four existing task-default cases and the complete six-case import suite pass another 10 cases; 134 unrelated issue cases were intentionally filtered. Four real configured/built-in hook baselines failed before the fix. The first complete 69-case run passed 67 and failed two stale nondefault fixtures; correcting their primary flags preserves their strict no-marker assertions, and the final complete run passes. No deadlines were changed.EADDRINUSEbefore the security assertion; one evidence-based transient retry was used. Superagent and legacy checks passed. Apex completed at 4/5 with the default-source mismatch repaired here. Those results do not satisfy this new head’s merge gate.pnpm -r typecheckandpnpm buildpass on frozen production source. All 565 distinct affected cases pass across completed suites: runtime/preparation/classification/session/environment 441, source trust 17, reopening 39, project/source privacy 47, child trust 13 and persistence eight. These include standard local and sandbox marker denial, no/partial/full assignment grants, fresh/reused/rebuilt workspaces, metadata replacement and selection clearing, default local provisioning, and private-file revocation after both skipped and failed provisioning. Source comments, code size, maps and catalog checks pass. Fresh exact-head gates for the current commit passed as reported above; this older source proof remains separate.tsx; the installed CLI runtime then passed the isolated disposable proof. These failures remain separate from the final passing results.ci / verifyandci / e2epassed. The Greptile summary then reported 4/5 and the child-creation finding repaired here. Those checks do not satisfy this new head’s merge gate.document is not defined. Prose cleanup had removed their required Vitest environment annotation. Restoring that test-runner directive passes all three cases with the ordinary project configuration, without a command-line environment override. The failure remains recorded; no transient rerun was used.pnpm test:runattempt completed with 22 failures, 18,170 passes and 105 skips. Nineteen failures use feature tests added after that process started; their later frozen-source suites pass. No per-module source hash was captured, so the old failed result remains separate evidence. Fresh maximum-script audit and primary-agent reproductions pass their unchanged deadlines. The remaining macOS Git streaming timeout reproduced in per-file deletion; its repair and fresh result are reported above. This older invocation is not a clean final-head proof. Exact-head full CI must pass before merge.Risks
Copy-only sources that previously depended on controller provisioning now skip those hooks. Sandbox workspace staging has no new automatic remote provision or runtime-provision transport; provider setup must use its existing runtime tools. Runtime service execution retains its existing contract.
Child workspace choices from admitted agents must have a verified parent chain within the existing 12-level low-trust ancestry limit. Missing or changed lineage and conflicting policies reject creation.
Existing writable aliases that combine incompatible source trust now fail before admission or publication. Choose a workspace compatible with the task's containment policy; ordinary file reads retain their existing authorization rules.
Low-trust tasks cannot start new controller-backed repository acquisition, including in full-auto mode. They may reuse verified existing public checkouts without fetching. Trusted acquisition still requires a provider decision in restrictive modes; trusted full-auto acquisition currently has no cumulative disk quota.
Anonymous and managed acquisition policies are permanent for a physical directory within a company. A different policy requires a different directory. Workspace relocation or deletion does not release the reservation. An existing checkout at a company-managed receipt identity also requires a fresh anonymous root, even when that checkout may contain public bytes; writable ownership markers cannot prove an exception.
Migration and native descriptor v3 require compatible controllers before new admissions. Rollback must retain recovery state and route admitted work to compatible controllers.
Workspace source permissions must remain effective after task reassignment. Tests cover retained privacy and concurrent binding.
Explicit shared folders can still have external writers. Final host scans remain required.
Changed input generations still pay for full seed creation and verification. Cache publication is capped at 16 generations/1GiB per workspace and 256 generations/256 workspace directories/8GiB per company. Saturation uses per-run seeds; cache repair and eviction are deferred to preserve existing reader and recovery references.
The local two-turn Codex journey is qualified. All three runtime paths passed their acceptance journeys at the commits listed above; later edge-case fixes use separate regression coverage. Current-head CI is reported above; a clean full local suite result is not claimed.
Model Used
OpenAI Codex, based on GPT-6, with code execution, repository tools, and coordinated agents. The session does not expose an exact serving-model identifier or context-window size. All architecture workers used the inherited model.
Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template#NNN/github.com/paperclipai/paperclipURLs)docs/...,fix/...) and contains no internal Paperclip ticket id or instance-derived details