Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
@clawsweeper review The final head is |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesRecord managed-worktree activity at execution boundaries and prevent refused turns from recreating removed checkout directories. Example: A nine-day-old session checkout is used yesterday and idle cleanup runs today.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a concrete worktree-retention bug; no actionable introduced defect was found, including in the admission-test repair. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAgent workspace preparation and run leases feed activity into the shared SQLite worktree registry, which cleanup reads to determine idle eligibility. flowchart TD
A[Session turn] --> B[Workspace preparation]
A --> C[Run lease lifecycle]
B --> D[Registry activity writer]
C --> D
D --> E[SQLite worktree registry]
E --> F[Idle cleanup]
Technical reviewBest possible solution: Keep activity publication in the existing registry worker and directory creation after the existing removed-binding validation. Do we have a high-confidence way to reproduce the issue? Current-main source shows the missing execution-boundary timestamp updates and premature mkdir; the submitted regressions target both paths, but this read-only review ran no tests. Is this the best way to solve the issue? The patch fixes the producer through existing registry and workspace owners, removes the duplicate mkdir, and adds no competing state or lifecycle owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1f01208d101. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +30, Tests +67, Docs +1, Other +200. Total +298 across 11 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label 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 (1 earlier review cycle)
Reviewed November 18, 2026, 11:53 AM ET / 16:53 UTC (Revision 2). |
|
@clawsweeper re-review Please review final head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…#201333) * fix(worktrees): retain recently used session checkouts * test(agents): decouple admission proof from workspace creation
Replace the workspace mkdir barrier left stale by #201333 with the real transcript-target preparation boundary. Preserve both admission closure and replacement checks before routing publication and backend dispatch.
…2068) Replace the workspace mkdir barrier left stale by openclaw#201333 with the real transcript-target preparation boundary. Preserve both admission closure and replacement checks before routing publication and backend dispatch.
…#201333) * fix(worktrees): retain recently used session checkouts * test(agents): decouple admission proof from workspace creation Release adaptation: Preserve reviewed individual adaptation; source bytes unchanged. (cherry picked from commit f5d35bc) Co-authored-by: RomneyDa <[email protected]>
Replace the workspace mkdir barrier left stale by #201333 with the real transcript-target preparation boundary. Preserve both admission closure and replacement checks before routing publication and backend dispatch. (cherry picked from commit 200bd90) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 1b9ddd1bd4ffe007a47407815e69118759b4fad6)
* fix(worktrees): retain recently used session checkouts * test(agents): decouple admission proof from workspace creation (cherry picked from commit f5d35bc) Release adaptation: reuse the beta.3 adaptation aef0b19dc08b for the stable workspace owner: add existing reader/error imports and the minimal #200691 removed-checkout preflight so activity marking never recreates a removed checkout. Omit only the changed assertion in the Gateway test file absent on this branch; retain existing Gateway readiness and owner coverage. Companions: #202074 is selected next. #202068 is present-equivalent (5631d96); #202204 changes later main-only GC owner-census behavior; #203057 is an independent probe optimization. Other later overlap concerns unrelated worktree refresh/reclamation, policy, restore UX, or the later absent removed-checkout fixture; not prerequisites (enumerated in lane audit). Release adaptation: reuse the sibling path-specific realpath spy and no-recreation regression (abce9babd5cab). The original one-shot spy closed authority at the preflight read instead of the target workspace boundary. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e3495dac6afc80bd3fe36110008dec96013d2514)
Baseline adaptation: Use the shipped guarded registry update at Git-lock acquisition and final release, preserving the five-minute write limit and unrelated leases. Exercise activity timestamps and idle collection through the managed worktree service. (cherry picked from commit f5d35bc) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit ba06dc3157f85e1a8f359c96d784c2050123a1ff)
What Problem This Solves
A session can use an old managed worktree without refreshing its recorded activity. Once the run finishes, idle cleanup can still treat the checkout as unused since creation. Returning to a removed checkout also recreated an empty directory before reporting the removal.
User Impact
Recently used worktrees retain their idle-retention window. Returning to an already removed worktree keeps its path absent and reports the worktree ID alongside the existing Restore guidance. Previously removed worktrees still require explicit restoration.
Why This Change Was Made
Actual run boundaries now record activity through the existing registry writer: native/plugin workspace preparation, run-lease acquisition, and final lease release. The persisted timestamp coalesces updates over five minutes across processes, using existing live-row and observed-timestamp conditions. There is no new cache, configuration, schema, or per-tool-call write. Directory creation belongs to workspace preparation after binding validation; the earlier duplicate mkdir is removed.
The explicit worktree acquire service already recorded activity, but ordinary execution did not use it. GC also considers session-owner activity and live custody, so this change does not imply that every historical removal was caused by the timestamp omission.
Production delta: +30 lines, including the shared bounded-write operation and its callers, with two redundant lines deleted. Tests add 67 net lines; the rerunnable synthetic measurement script adds 200 lines.
Evidence
pnpm check:changedon the final committed head passes every gate except two unrelated export failures. Those failures reproduce on clean exact parent0aafe6691b818c24ac00a2172e57819b21632554:OPENAI_CODEX_CLIENT_VERSION_FLOORwas introduced unused in production by1680f54504807(fix(openai): new ChatGPT subscription models missing until an OpenClaw release #201130); the last barrel consumer ofwatchSelectedAgentwas removed byd33473385623a(improve: choose an automation's model and reasoning with the chat composer's pickers #201218). These are main regressions. Benchmark lint and all other checks pass on this head.Measurement acceptance: recent use must advance activity, the next 20 short runs must keep that timestamp, and coalesced owner cost is compared with A/A noise; the first required durable write is reported separately. Exact-head CI 44350917733 passed for
aace1b071df88f1f157ad48c87bd002458b2253d, includingopenclaw/ci-gate. Final-head ClawSweeper review reports zero findings and zero open items. Runtime proof uses an in-process real Gateway/agent runner with a synthetic provider; no standalone shipped-CLI or live external-provider proof is claimed.Synthetic owner measurements
Warm filesystem caches; setup/imports excluded. Each sample is a fresh Node 26.12.1 process. Coalesced values are per operation (20 operations per sample). CPU includes process threads, excludes Git/state-broker children; allocation is main-isolate V8 allocation. The first write is necessary new durable work, not a speedup.
The first workspace write adds 2.19 ms median wall, 18.01 ms process CPU and 556 KiB main allocation; it occurs at most once per five minutes through these boundaries. Coalesced lease wall/CPU increased 5.7%/16.3%; main allocation decreased 6.7%. Coalesced workspace wall held steady, CPU decreased, and allocation increased 4.7%. This correctness fix explicitly pays for recording use; no claim of an overall speedup. A/A controls and all raw samples are retained locally; five-sample p95 is the maximum sample.
Reproduction: seed with
scripts/perf/agent-startup-inspection.ts seed --state-dir <new-root>/state --gib 35; prepare usingscripts/perf/worktree-activity-measure.ts --prepare <root>; then run<root> <new-result.json>undernode --expose-gc --import ./scripts/tsx.mjs. For baseline,OPENCLAW_BENCH_BASELINE_DIRpoints to the three owner modules (registry.ts,run-lease.ts,workspace-sandbox.ts) extracted from0aafe6691b818c24ac00a2172e57819b21632554.CI repair
The first CI run found one PR-caused test fixture failure: the image-admission test used the removed early mkdir as a stop hook. The final test-only follow-up stops through its existing admission callback after evaluating the real image policy. Both image-support cases pass locally; the filesystem spy, mock-order assertion, and unnecessary mock cleanup are removed. Codex autoreview of the repair is clean. Production code and the measured owner files are unchanged from the measured head. The failed run is retained as evidence; fresh exact-head CI and ClawSweeper re-review both completed successfully. No CI rerun or inherited-failure exception was used for this PR-caused fixture failure.