Repository navigation
fix: reuse admitted worker transcript and cron stores - #190861
Conversation
Reuse retained transcript custody without a Gateway-thread database reopen and keep Cron scratch on the admitting scheduler partition. Co-authored-by: galiniliev <[email protected]>
|
🦞👀 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 changesReuse the retained transcript worker source and pass the admitting scheduler’s Cron store into session scratch reads. Example: A scheduled session turn retains an admitted Cron partition after configuration selects a different partition.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes two source-ownership failures still present on main; no actionable patch defect was found, and the maintainer-authored keep-open guard applies. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway worker admission prepares transcript identity before launching a turn; Gateway Cron dispatch prepares scheduled session prompts from the scheduler’s selected scratch store. flowchart TD
A[Worker turn admission] --> B[Retained history worker source]
B --> C[Live placement and transcript checks]
C --> D[Worker launch]
E[Cron scheduler selected store] --> F[Session event dispatch]
F --> G[Scratch read and session prompt]
Technical reviewBest possible solution: Retain the existing worker-owned transcript custody and scheduler-selected Cron partition through session execution. Do we have a high-confidence way to reproduce the issue? Current main still reopens the native transcript database and reselects the Cron scratch partition; committed regressions and supplied red/green evidence identify both failures, without a new execution during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete repair using existing owners: remove the unnecessary native reopen and carry the scheduler’s selected store through the existing dispatch call. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c1973b66d643. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -7, Tests +96, Other +2. Total +91 across 10 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 (1 earlier review cycle)
Reviewed November 2, 2026, 1:32 AM ET / 06:32 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…nclaw#190861) Reuse the admitted transcript worker context instead of reopening the database on the Gateway thread. Carry the scheduler-selected Cron store into scratch reads while retaining existing custody, authority, and fallback behavior. Verified red/green boundary regressions, real PostgreSQL launcher admissions, built Gateway Cron/scratch persistence, and required current-head CI. Co-authored-by: galiniliev <[email protected]>
What Problem This Solves
Fixes worker turns failing at the PostgreSQL thread boundary and Cron session runs reading scratch from a different partition than the scheduler that admitted them.
User Impact
Worker launch and scheduled session execution retain their admitted transcript and Cron sources. There are no schema migrations, configuration changes, permission changes, or required operator actions.
Why This Change Was Made
Reuse the transcript source already held by the history worker instead of reopening the native database on the Gateway thread. Thread the admitting Cron service’s selected store path into session execution; direct callers still resolve their configured store, and explicitly prepared scratch retains precedence. Existing source-custody checks, revocation, and release behavior remain in place. This removes seven net production lines rather than adding another owner.
Integration adapted from Galin Iliev’s requested fixes; commits credit @galiniliev. This PR is independent of the database portability and scheduled-widget changes.
Evidence
Actual PostgreSQL and native Gateway qualification (November 2, 2026)
Two additional product/owner-boundary cases passed on unchanged head
cd23fc527a2e9da4bb4f6972c286cebf795e23ef. The existing built Gateway's three native identity files matched this head. The canonical database-conformance runner retained its PostgreSQL preload, pool-root admission, thread restrictions, artifact checks, and cleanup. A fresh synthetic PostgreSQL 17.11 container was loopback-only; no operator database or Gateway was touched.Sanitized observed output:
Command:
node scripts/test-database-conformance.mjs --engine postgres --connection <owned-synthetic-loopback-DSN> -- test/e2e/qa-lab/runtime/worker-postgres-owner.e2e.test.ts test/e2e/qa-lab/runtime/cron-postgres-product.e2e.test.ts --maxWorkers=1 --reporter=verbose --silent=false. Used the supported Node/prebuilt-dist route, one serial test worker and bounded native compiler pools; the one required native generation completed in 167.765s. No test timeout, assertion, conformance, cache or authority rule was weakened.Earlier attempts stopped during missing compiled-worker preparation or host I/O-heavy setup. After reconciling all earlier processes and verifying existing runtime identity, the authorized controlled preparation completed and both actual cases passed. The proof-only Cron fixture explicitly enables its owned scheduler, correcting the generic helper's disabled default. Both fixture typechecks, formatting and diff checks passed; their additional lint attempt previously stopped in prerequisite compilation and is not counted passing. Original committed-source lint/type evidence above remains unchanged.
Limits: the Gateway proof uses the current selected partition and synthetic model transport; it is not an end-to-end partition-switch regression or live external inference. The committed red/green Cron regression independently proves admitted-versus-changed partition selection. No out-of-process writes to a serving Gateway database were used to manufacture drift. The launcher capacity boundary is deliberately not a full remote-worker turn. Owned Gateway/test processes joined, generated workers cleaned up, and PostgreSQL stopped with exact container absence verified. Current-head CI and requested overall-Platinum hosted review remain separate gates.