Repository navigation
fix: let hooks start the first agent session - #201103
Conversation
Retire completed native reads that found no database, while preserving logical borrowers and pending-opener protection. Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: e848074a-1ac7-8bc7-8f5f-bec901cb1222
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesRetire completed database generations that found no file so retained readers do not block first-session creation. Example: A retained reader finds no database for agent main, then an authenticated /hooks/agent request starts its first session.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current first-session failure through the existing database lifecycle owner. No actionable correctness or security findings were identified; exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe agent database execution owner coordinates logical readers, native worker generations, and session creation; callers retain their references while the owner replaces an empty native generation. flowchart TD
A[Authenticated hook request] --> B[Hook agent dispatch]
B --> C[Session writer]
C --> D[Agent database execution owner]
E[Retained session reader] --> D
D --> F[Native database worker]
Technical reviewBest possible solution: Use the existing native-close path to retire completed empty generations while preserving logical borrowers and genuinely pending preparation. Do we have a high-confidence way to reproduce the issue? Current main retains a successful absent-read generation, and creating admission rejects that generation; the PR records the matching installed-package failure and regression failure on the base, but this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs the shared lifecycle owner directly and extends an existing regression without adding state, helpers, retries, or a hook-specific workaround. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f8b68e647af. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +1. Total +6 across 2 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. 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 Reviewed November 18, 2026, 4:30 AM ET / 09:30 UTC. |
* fix: allow first hook session after empty database reads Retire completed native reads that found no database, while preserving logical borrowers and pending-opener protection. Co-authored-by: VACInc <[email protected]> * fix: let hooks start the first agent session Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: e848074a-1ac7-8bc7-8f5f-bec901cb1222 --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: VACInc <[email protected]>
Retire completed absent native reads without dropping retained logical borrowers or pending-opener protection. Companion audit: #201272 is selected next; no other later same-path or PR-reference fix exists in the pinned scan. Existing callers and fixture contracts remain unchanged. Release adaptation: none in the reviewed patch. Parent regression reproduces the retained-reader failure; the complete two-fix cohort passes 69 tests across creation and writer admission. Broader release qualification remains pending. (cherry picked from commit e25ad96) Co-authored-by: VACInc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Capture the inherited creation witness inside the admitted writer turn, check caller authority before and after capture, and release only the captured reference. Preserve queued cancellation and next-creator behavior. Companion audit: follows #201103; no later same-path or PR-reference fix exists in the pinned scan. Existing startup and session-writer callers retain their current interfaces. Release adaptation: none in the reviewed patch. Parent regression reproduces the retained-witness failure; both fixes pass 69 tests across creation and writer admission, with touched production and test type-aware lint and formatting green. Broader release qualification remains pending. (cherry picked from commit 24c2e74) Co-authored-by: RomneyDa <[email protected]>
* fix: allow first hook session after empty database reads Retire completed native reads that found no database, while preserving logical borrowers and pending-opener protection. Co-authored-by: VACInc <[email protected]> * fix: let hooks start the first agent session Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: e848074a-1ac7-8bc7-8f5f-bec901cb1222 --------- Co-authored-by: VACInc <[email protected]> (cherry picked from commit e25ad96) Release adaptation: Source backport applied without production adaptation; retained focused regressions. Proof logs and exact setup/failure gaps recorded per assessment; pending independent review. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
The first authenticated
/hooks/agentrequest for a fresh agent can return HTTP 500 before the agent run starts. An earlier read that found no session database can leave behind an empty native database generation, which blocks the first session write while that reader is still retained.User Impact
User impact: hooks can create the first session after an empty database read, without restarting the Gateway or releasing unrelated readers. No configuration, permission, schema, or migration changes are required.
Why This Change Was Made
Retire the completed empty native generation through the existing database owner. Keep its logical readers usable and preserve the guard against joining a genuinely pending opener. This extends the existing released-reader regression to cover a retained reader and verifies that it can read the newly written session.
The author simplification pass kept this at one existing lifecycle decision and one additional test variant: production +5 lines net, tests +1 line net. There is no new owner, state, helper, retry, or permission exception.
Evidence
The unchanged Night Clawer hook test now accepts an authenticated HTTP request and returns
ok: truewith a run ID on the installed repaired package. The previous installed-package replay returned HTTP 500 withAgent creation cannot capture another pending native opener.l1/hooks-agentreplay: installation passed in 14.559 seconds; hook acceptance passed in 9.679 seconds. Both runners exited, their process groups were absent, and the private test runtime was removed.This proves hook admission and retained-reader database behavior, not a model response or external message delivery. The broader Night Clawer suite still has separately tracked failures. Local independent automated review was not run under this task's no-subagent constraint; author source review is complete, and hosted ClawSweeper review and exact-head CI remain to be checked.
Reproduction and source binding
c8da4b7fbc408570a52f37529612a458a24acb5d.f7b6f3f9b785bf919065049516d5d84b91426f53; tree7e3eb3e8d08c274a25788474aafc1284b15da93a.f3707dafb937ac631ea5aa24f195f6243d5f41e7. The relevant hook/native-owner implementation is unchanged from this revision to the regression base.bf08117ab026cb82262c657b9621cbe7d6ec218d, tree-identical to the integrated harness used by Core run 44258661435.0b2510d01a516514b35bd6a82e1455c6d5a309e0b1c00f71b6288ec254307b49.Regression command:
node scripts/test-projects.mts src/state/openclaw-agent-execution.creation-witness.test.ts --maxWorkers=1.Native replay:
python3 scripts/qa.py core --source-root <repaired-checkout> --tarball <canonical-package> --runtime-root <private-runtime> --output <results> --evidence-dir <evidence> --test-id l1/hooks-agent.Contributor: @VACInc.
Work sessions
Linked for team reference; these sessions aren’t public.
Worked on by