Repository navigation
fix(agents): keep provisioned workspaces usable without templates - #120943
Conversation
|
Codex review: needs maintainer review before merge. What this changesThis PR defers bootstrap template reads until a file needs creation and tolerates missing templates during comparisons. Example: A workspace contains user-authored AGENTS.md, SOUL.md, IDENTITY.md, and USER.md, but packaged templates are absent.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful and addresses both prior findings; no actionable introduced defect remains in the reviewed diff. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherReply preparation calls the workspace lifecycle owner, which checks persisted setup evidence and publishes missing bootstrap files before agent execution. flowchart TD
A[Reply preparation] --> B[Workspace lifecycle owner]
B --> C[Existing setup and attestation state]
B --> D[Bootstrap publication owner]
D --> E[Existing entry preserved]
D --> F[Strict template loader]
F --> G[Missing file published]
Technical reviewBest possible solution: Keep lazy loading in the existing publication owner while preserving strict creation failures, typed comparison errors, and recorded generated-file evidence. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the failure path, and the PR records a failing base regression through prepareReplyWorkspace; no target code was executed during this review. Is this the best way to solve the issue? This is a focused repair using existing owners, with strict provisioning and non-absence errors preserved and no unnecessary parallel implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44c71714097f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +14, Tests +78, Docs +3, Other 0. Total +95 across 7 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (12 earlier review cycles; latest 8 shown)
Reviewed October 24, 2026, 3:29 AM ET / 07:29 UTC (Revision 13). |
Load templates only when bootstrap publication needs their contents. Treat only absent comparison templates as unavailable, preserving user files and non-absence I/O failures.
c7ba61a to
2b541e7
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…enclaw#120943) * fix(agents): keep provisioned workspaces usable without templates Load templates only when bootstrap publication needs their contents. Treat only absent comparison templates as unavailable, preserving user files and non-absence I/O failures. * fix(agents): keep workspace template errors typed
…20943) * fix(agents): keep provisioned workspaces usable without templates Load templates only when bootstrap publication needs their contents. Treat only absent comparison templates as unavailable, preserving user files and non-absence I/O failures. * fix(agents): keep workspace template errors typed Release adaptation: the stable workspace module does not export fileDiffersFromTemplate, so the non-absence template error case is proven through prepareReplyWorkspace instead. (cherry picked from commit 1a76be1)
Adapt 28 audited units to the release-native ownership model. Preserve AgentsAPI/cron policy and actor-owned projection recovery. Source provenance and original contributor credit: #176852 342fea1 — yinx65588-boop <[email protected]> #180853 50f795a — Peter Steinberger <[email protected]> #184041 e356196 — Peter Steinberger <[email protected]> #184069 7739767 — Peter Steinberger <[email protected]> #182666 9ff9d88 — Stefan Stüben <[email protected]> #183884 112667f — Peter Steinberger <[email protected]> #184021 05010ed — Peter Steinberger <[email protected]> #183390 15a5706 — Masato Hoshino <[email protected]> #183282 24d7dd3 — pstarkgit <[email protected]> #164843 127f3c2 — PollyBot13 <[email protected]> #172959 30f88d3 — main object unavailable; stable source inspected #172959 eb2255b — johan-eilertsen <[email protected]> #120943 1a76be1 — Peter Steinberger <[email protected]> #178271 b3c8f8a — Wang Rui <[email protected]> #178271 7bd6895 — RJ <[email protected]> #177518 679980c — Masato Hoshino <[email protected]> #182454 a538efe — Peter Steinberger <[email protected]> #180042 bef193c — sunlit-deng <[email protected]> #179347 2405bf4 — Peter Steinberger <[email protected]> #179060 ccedbdc — Peter Steinberger <[email protected]> #118011 9596527 — Peter Steinberger <[email protected]> #182219 fade14f — Sukhdeep <[email protected]> #181871 b1b5f00 — Peter Steinberger <[email protected]> #178888 5125e3c — RoboClaw <[email protected]> #180075 c9c2d16 — Wang Rui <[email protected]> #181081 f223f77 — Jason O'Neal <[email protected]> #180236 d11c239 — Dallin Romney <[email protected]> #173921 af50fbd — Peter Steinberger <[email protected]> #174868 7034ca4 — Peter Steinberger <[email protected]> #172724 492c932 — Dallin Romney <[email protected]> Proof: targeted owner/sibling tests, supported fresh two-pass review clean. Known qualification gaps recorded in the release backport evidence. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes agent replies failing with “Missing workspace template” when an existing workspace is used with an installation whose packaged templates are unavailable.
User Impact
Established workspaces can keep replying without their user-authored files being changed. Creating a missing bootstrap file still requires its template, and other template I/O failures still surface.
Why This Change Was Made
On the current main base (
56d79851163cee1b83886d290f0c2b3f93036d83),src/agents/workspace.ts:762loads all four templates before publication checks whether the destination files exist. Template comparisons also use the same strict loader.Resolve template content lazily inside the existing bootstrap publication owner, after its existing-entry check. For comparisons only, treat the specific missing-template error as unavailable comparison data; preserve retired generated-file hashes and propagate other I/O errors. Custom-purpose consent checks and exclusive publication remain intact.
The replacement removes the previous catch-all fallback and status-only tests. The strict cached template reader is extracted to a small sibling loader; workspace lifecycle and comparison policy remain in their existing owner. Production delta: net +14; tests and test routing: +78; documentation: +3. The assertion-safety baseline decreases by one. Release-note context: provisioned agent workspaces continue to work when packaged templates are missing.
Evidence
prepareReplyWorkspaceregression on the main base: fails withMissing workspace template: AGENTS.md; fresh-workspace strict failure and an actual EISDIR comparison-error control pass.helper-unavailablebecause their unchanged fixture forcesFS_SAFE_NATIVE_MODE=off, while pinned fs-safe 0.26.11 requires native ACL inspection for private-directory creation. This limitation is recorded; no filesystem-policy or timeout changes are included. The separate Doctor check was stopped during prolonged startup so the mandatory loader extraction could be validated; it produced no test verdict.git diff --check, line-cap ratchet, and the final assertion-safety ratchet: clean.40069873817caught a moved unchecked type assertion in the extracted loader. The follow-up uses the existing typed filesystem-error helper and shrinks the now-lower workspace assertion baseline. Final exact-head CI is green for382c8e44599352a815463544a71617150195437e: run 40073321371.No live Gateway or model run was performed. This lane uses focused regression proof and PR CI for broad validation, as requested by the maintainer.