Repository navigation
fix(test): initialize context readers before worker launch assertions - #145657
Conversation
|
🦞👀 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. Reviewed September 12, 2026, 2:14 AM ET / 06:14 UTC (Revision 2). ClawSweeper reviewWhat this changesInitialize the real conversation-context reader during setup in two Gateway worker test suites so cold worker startup does not consume their launch-observation deadline. Merge readiness✅ Ready for maintainer review The PR remains useful: current main lacks this fixture initialization, and the change preserves the tests’ behavioral assertions. No actionable correctness or security findings remain. Priority: P3 Review scores
Verification
How this fits togetherGateway worker preparation reads the selected conversation history before preparing a remote turn. These tests exercise that preparation using real transcript readers and controlled transport endpoints. flowchart TD
A[Test fixture setup] --> B[Initialize context worker]
B --> C[Seed conversation history]
C --> D[Observe worker turn preparation]
D --> E[Read fresh selected history]
E --> F[Check history and authority outcomes]
F --> G[Join operations and clean up]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +4. Total +4 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep cold reader initialization in fixture setup while preserving fresh per-turn reads, unchanged launch deadlines, and separate worker-lifecycle coverage. Do we have a high-confidence way to reproduce the issue? Yes for the conditional failure mechanism: a cold context-worker startup exceeding five seconds consumes the fixture observation budget and triggers cancellation. The supplied body reports that scenario; this review inspected source without executing it. Is this the best way to solve the issue? Yes. Initializing the existing real reader before measurement isolates the intended launch behavior without extending deadlines or weakening assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a0946936c485. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Prevent healthy Gateway worker preparation from failing a test-only five-second observation deadline on loaded hosts. Await execution completion and credential readiness while preserving early-settlement errors and unjoined-owner cleanup guards. Extend the existing replay case to cross the former deadline without changing its base-leaf or history assertions. Use two concurrent worktrees for stale-retention reconciliation, preserving the upload barrier, real manifests and Git operations, binary result checks, journals, and released claims. Production code is unchanged. CI run 34679294250, job 103514926295 failed six detached-context cases and timed out the 50-turn reconciliation case; #145349 was blocked on this shard. https://github.com/openclaw/openclaw/actions/runs/34679294250/job/103514926295 Recorded proof: controlled regression failed before and passed after; the reduced reconciliation case failed the historical retention mutation; the contention suite passed all 13 tests; the full agentic-gateway-core-2 shard passed 255 files and 5,038 tests. Exact-head CI run 34680987053 is green for b3edad9 and was reverified with the native watcher before preparation. https://github.com/openclaw/openclaw/actions/runs/34680987053 The lead's P1 autoreview is scoped-clean. ClawSweeper found no actionable findings on the approved head; no fixups or skips were needed. Refs #145349, #145379. Follow-up to #145657.
…5770) Prevent healthy Gateway worker preparation from failing a test-only five-second observation deadline on loaded hosts. Await execution completion and credential readiness while preserving early-settlement errors and unjoined-owner cleanup guards. Extend the existing replay case to cross the former deadline without changing its base-leaf or history assertions. Use two concurrent worktrees for stale-retention reconciliation, preserving the upload barrier, real manifests and Git operations, binary result checks, journals, and released claims. Production code is unchanged. CI run 34679294250, job 103514926295 failed six detached-context cases and timed out the 50-turn reconciliation case; openclaw#145349 was blocked on this shard. https://github.com/openclaw/openclaw/actions/runs/34679294250/job/103514926295 Recorded proof: controlled regression failed before and passed after; the reduced reconciliation case failed the historical retention mutation; the contention suite passed all 13 tests; the full agentic-gateway-core-2 shard passed 255 files and 5,038 tests. Exact-head CI run 34680987053 is green for b3edad9 and was reverified with the native watcher before preparation. https://github.com/openclaw/openclaw/actions/runs/34680987053 The lead's P1 autoreview is scoped-clean. ClawSweeper found no actionable findings on the approved head; no fixups or skips were needed. Refs openclaw#145349, openclaw#145379. Follow-up to openclaw#145657.
Related: #145591. Detected in CI for #145612.
What Problem This Solves
Fixes intermittent worker-history test failures during cold source-worker initialization. The fixtures placed their five-second launch observation timer around initialization of the real model-context worker, which has its own existing 60-second task deadline. On a slow cold start, the observation timer aborted the reader before its module or query handler became ready, then later cases started another cold worker.
Why This Change Was Made
Initialize the real empty model-context reader in each fixture's existing setup, before seeding the conversation and starting the launch observation. Each test still performs its fresh context read and keeps every history, payload, persistence, authority, and cleanup assertion.
The five-second observation, 60-second worker task, and existing hook deadlines are unchanged. There are no retries, sleeps, new mocks, assertion changes, or production-code changes. Initialization failures still fail setup; real cold loading, cancellation/replacement, and snapshot behavior remain covered by the existing owner suites.
User Impact
No runtime behavior changes. CI's worker-history assertions no longer depend on cold TypeScript worker startup finishing within their unrelated launch-observation window.
Evidence
An instrumented local reproduction on CI merge
1657840776c5f9aa95657b1650270c388963fbcafailed six asynchronous cases: each five-second observer aborted and joined its worker before module readiness or SQL handler entry. The two synchronous recorder cases passed.With real initialization in setup, the same eight-case suite passed. The first worker took about 8.7 seconds from online to module readiness, its first SQL handler took 13 ms, and the first actual launch observation took 48 ms. This diagnoses the fixture boundary; it is not a production-latency or host-contention claim. Historical CI did not retain these stage timestamps.
All 36 uninstrumented tests passed on the current main-based candidate across the two worker fixtures, real WorkerTaskPool/source-loader suites, and SessionManager snapshot suite. Independent P0-P2 review is clean. Native changed checks and exact-head CI passed. The Linux Testbox proof also passed all36 tests against the exact source tree, and its owned lease is completed. An initial remote preflight stopped before tests because it compared the capsule carrier commit with the source commit; the corrected check verifies source content-tree identity and tracked bytes under the native source attestation.