Skip to content

test: own SQLite flip proof resource lifetimes - #136291

Merged
steipete merged 1 commit into
mainfrom
codex/test-perf-sixth-sqlite-fixture-lifetime
Sep 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-perf-sixth-sqlite-fixture-lifetime

Conversation

@steipete

@steipete steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The real SQLite session/transcript flip proof can leave a lock-holding child or an acquired client alive after an intermediate failure. Its local child stopper also leaves the losing two-second sleep timer referenced after successful shutdown.

Why This Change Was Made

Give the proof context ownership of every acquired child, client and concurrent request group. Register ownership before the next fallible operation, join cleanup before deleting state, and preserve both the original failure and any cleanup failure. Failed cleanup retains its state directory for diagnosis. Use the canonical child stopper and an abortable close deadline instead of the local timer race.

The existing two complete E2E tours, all 47 assertion sites, 21 checkpoints, concurrency and real timeout/lock/absence windows remain unchanged. Production delta is zero; test-support delta is +377/-311 (net +66, chiefly explicit resource ownership with surrounding lifetime indentation).

User Impact

More reliable internal validation and prompt process exit after cleanup. There is no product, database schema or persistence behavior change. Failed acquisition inside the shared connector before it returns a client remains a separate owner-level follow-up.

Evidence

Canonical real E2E runs passed both cases before, after and after restoring the original. Case-body totals were 56.48 s, 55.07 s and 54.77 s respectively; no whole-suite speedup is claimed. Cold artifact preparation differs between runs.

Private failure probes reproduced the original busy-child leak, mock-readiness leak and acquired-client leak, then passed against the candidate. Additional probes verified that a failed child stop retains state and both errors, and that all concurrent requests settle before cleanup. Native process observations confirmed the referenced losing timer fell from one to zero; natural exit after proof completion fell from 2065.9 ms to 57.2 ms.

The remote proof run completed with all named outer process groups and captured direct children joined, 53 source guards restored, temporary proof files removed and the exact Testbox stopped. This is evidence for those observed owners, not a blanket claim about escaped descendants. The published candidate adds only a mechanical block body to the proved Promise executor to satisfy lint.

Formatting, type-aware lint, diff checks and Codex P0 review passed. Exact-head CI remains the integration gate.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Sep 2, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 8:30 AM ET / 12:30 UTC.

ClawSweeper review

What this changes

The PR gives the SQLite session/transcript flip proof explicit ownership and ordered teardown for its Gateway clients, child processes, databases, environment, and temporary state.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open. This is a coherent maintainer-owned test-lifecycle repair, current main still has the older direct-finalizer structure, and the branch introduces no product, schema, or dependency-version change.

Priority: P3
Reviewed head: b8f1231ddede7c6fa5a509c7a473397daad4ed08

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported test-harness repair with supplied targeted E2E evidence and no actionable correctness or security finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored test-support PR is exempt from the external-contributor proof gate; its supplied body nevertheless identifies an after-fix remote E2E run covering the isolated Gateway, mock provider, SQLite lifecycle, and cleanup path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored test-support PR is exempt from the external-contributor proof gate; its supplied body nevertheless identifies an after-fix remote E2E run covering the isolated Gateway, mock provider, SQLite lifecycle, and cleanup path.
Evidence reviewed 6 items Introduced cleanup ownership: The introduced outer fixture registers and drains owned client and child cleanups before stopping the Gateway, closing databases, restoring the environment, and deleting temporary state; it aggregates a body failure with a cleanup failure.
Cleanup owner contract: The shared fixture executes every cleanup phase even after an earlier failure and reports all collected errors, so the new outer lifetime ordering preserves diagnostics rather than masking them.
Child-stop contract reuse: The changed proof reuses the existing child stopper, which performs bounded TERM/KILL handling and removes its exit listeners in a finally block; the proof additionally waits for stdio close before declaring release.
Findings None None.
Security None None.

How this fits together

The SQLite flip proof starts an isolated Gateway and mock provider, exercises session migration and lifecycle flows against temporary SQLite state, and emits checkpointed evidence. The changed harness now releases acquired resources before it destroys that temporary state.

flowchart LR
A[Temporary SQLite state] --> B[Gateway and mock provider]
B --> C[Session and doctor lifecycle proof]
C --> D[Checkpointed proof report]
C --> E[Owned cleanup registry]
E --> F[Clients and child processes stopped]
E --> G[Databases and temporary state released]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +66. Total +66 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 377 311 +66
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 377 311 +66

Review metrics

Metric Value Why it matters
Production vs test-support delta production 0; test support +377/-311 (net +66) The added code is confined to the E2E proof harness and replaces scattered cleanup paths with explicit resource ownership.

Technical review

Best possible solution:

Retain one explicit ownership path for every acquired proof resource and validate it through the existing source and built-CLI E2E entrypoints before merge.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR repairs an internal test harness rather than a reported user issue. The PR body supplies a targeted remote E2E run for the changed harness, while source inspection establishes the lifetime boundary.

Is this the best way to solve the issue?

Yes. Registering each resource immediately after acquisition and draining those owners before state deletion fixes the failure window that current main's nested direct finalizers leave open.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3c6169c63628.

Labels

Label changes:

  • add P3: This is internal validation-harness reliability work with no claimed user-facing, persistence, or configuration behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-support PR is exempt from the external-contributor proof gate; its supplied body nevertheless identifies an after-fix remote E2E run covering the isolated Gateway, mock provider, SQLite lifecycle, and cleanup path.

Label justifications:

  • P3: This is internal validation-harness reliability work with no claimed user-facing, persistence, or configuration behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-support PR is exempt from the external-contributor proof gate; its supplied body nevertheless identifies an after-fix remote E2E run covering the isolated Gateway, mock provider, SQLite lifecycle, and cleanup path.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Tak Hoffman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit d096bd6 into main Sep 2, 2026
331 of 333 checks passed
@steipete
steipete deleted the codex/test-perf-sixth-sqlite-fixture-lifetime branch September 2, 2026 12:47
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant