Skip to content

refactor: reuse deferred owners in Gateway and infra fixtures - #146809

Merged
steipete merged 1 commit into
mainfrom
codex/tenk-inline-deferred-refresh
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/tenk-inline-deferred-refresh

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway and infrastructure tests repeat deferred-Promise construction and resolver capture setup across unrelated scenarios.

User Impact

No user-visible change. Test cases, assertions, payloads, settlement behavior, and cleanup ordering are preserved.

Why This Change Was Made

Reuse the existing deferred helpers for 210 adjacent Promise capture pairs. This removes 534 code lines across 95 tests and five test-support files, without introducing a helper or changing production code. Effectful or mutable capture patterns remain at their existing owners.

Evidence

  • Original baseline and candidate: 119 files, 3,655 passed and two existing skips, with identical case/status inventories. The E2E file ran separately because the combined JSON reporter does not support its inline project configuration.
  • Prior overlapping-main refresh: four owning entrypoints passed all 349 cases. Combined integration with refactor: share current auth store test envelopes #146808 passed all 173 cases in the two overlapping authentication suites and their two compiler graphs.
  • Current-main refresh includes fix: stop repeated catalog reloads and cancelled-task recovery #146810. All inserted and deleted refactor lines are unchanged; 98 of 100 candidate files match the tested combined source exactly. The two newly changed wake suites pass all 18 existing cases, and their selected infrastructure compiler graph passes. Both deferred helpers are unchanged. Existing independent P2 review and full changed-code proof are retained for the unchanged refactor delta; raw patch-context identity is not claimed.
  • Structural comparison preserves all 8,715 assertions and 2,728 registration expressions, including new upstream regressions. Default cloc 2.10 counts repeat at 95,737 → 95,203 code lines, with blank/comment counts unchanged. Formatting, clean source-hash checks after the commit hook, and git diff --check pass.

CI Recovery and Final Proof

The old-head fallback run 34752495033 did not pass. Its UI run checked out source with the stale “Close Review” selector, already repaired on main by #146810. It also recorded a website “Service details” timeout and an SDK-report renderer OOM at its 6-GiB heap limit. These failures remain recorded. The SDK input audit followed 153 public roots and 11,950 source/declaration paths: none of the 100 changed files was reached, and consulted versioned inputs were unchanged. This supports existing renderer resource-failure attribution, not a passing API report or a reproduced base OOM.

The final branch includes #146810. Exact-head ordinary CI 34754652988 passed with 78 successful jobs, 16 skips, and no failures, including the required CI gate. Current selected CodeQL checks also pass.

The complete chat-file-links and dashboard-website suites passed all nine cases on the exact candidate in focused Linux proof 34754727114. Source identity and clean status were verified before and after; the lease is stopped. Testbox used Chromium 144/Node 24.19, while the failed hosted shard used Chromium 152/Node 24.20 and a broader workload. The website timeout did not recur, but its cause remains unresolved; this is not equivalent reproduction or a claimed race fix. Assertions, timeouts, memory caps, production behavior, and the SDK reporting script remain unchanged.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 06:51
@steipete
steipete requested a review from a team as a code owner September 13, 2026 06:51
@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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 7:59 AM ET / 11:59 UTC (Revision 5).

ClawSweeper review

What this changes

Replaces repeated Promise resolver setup in Gateway and infrastructure tests with existing deferred helpers while preserving test scenarios and settlement ordering.

Merge readiness

⛔ Blocked before merge - 2 items remain

No actionable correctness findings. This useful cleanup remains absent from current main, and the updated body records completion of the previous validation follow-up. The maintainer-authored PR should remain open for normal landing.

Priority: P3
Reviewed head: ecdbed33651c8e73120fcbce4fce567f038851d6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent use of existing helpers with preserved test behavior, passing pinned-head CI, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored fixture refactor changes no production behavior or authority boundary; retained test comparisons and verified pinned-head CI support the change.
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 fixture refactor changes no production behavior or authority boundary; retained test comparisons and verified pinned-head CI support the change.
Evidence reviewed 8 items Introduced scope: The complete local merge-base-to-head file inventory contains only tests and test support. Reviewed hunks replace resolver captures with existing helpers; production code, assertions, timeouts, workflows, dependencies, and persisted formats are unchanged.
Existing helper preserves Promise semantics: The test helper re-exports the shared owner, which returns native Promise.withResolvers(). The inspected response fixture retains its original completion calls and request-dispatch ordering. No Codex dependency contract is involved in this substitution.
Cleanup remains useful on main: Fetched main still constructs and captures the response-end Promise inline in the HTTP test harness. The related merged auth-envelope and catalog-recovery PRs address separate work.
Findings None None.
Security None None.

How this fits together

Gateway and infrastructure fixtures pause asynchronous operations so tests can check cancellation, ordering, and cleanup. The shared deferred helper supplies the Promise and its completion callbacks.

flowchart LR
 A[Test scenario] --> B[Shared deferred helper]
 B --> C[Pending Promise]
 C --> D[Gateway or infrastructure operation]
 A --> E[Resolve or reject callback]
 E --> C
 D --> F[Ordering and cleanup assertions]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep asynchronous test synchronization on the existing shared deferred owner while preserving effectful and mutable captures at their current sites.

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

Not applicable: this PR removes repeated fixture construction rather than fixing a reported runtime defect.

Is this the best way to solve the issue?

Yes: using the existing native-Promise helper removes repetition without adding an owner or changing the tested control flow.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 970992db26c8.

Labels

Label justifications:

  • P3: This is behavior-preserving test-fixture cleanup with no production or user-facing change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 fixture refactor changes no production behavior or authority boundary; retained test comparisons and verified pinned-head CI support the change.

Evidence

What I checked:

  • Introduced scope: The complete local merge-base-to-head file inventory contains only tests and test support. Reviewed hunks replace resolver captures with existing helpers; production code, assertions, timeouts, workflows, dependencies, and persisted formats are unchanged. (ecdbed33651c)
  • Existing helper preserves Promise semantics: The test helper re-exports the shared owner, which returns native Promise.withResolvers(). The inspected response fixture retains its original completion calls and request-dispatch ordering. No Codex dependency contract is involved in this substitution. (src/shared/deferred.ts:13, ecdbed33651c)
  • Cleanup remains useful on main: Fetched main still constructs and captures the response-end Promise inline in the HTTP test harness. The related merged auth-envelope and catalog-recovery PRs address separate work. (src/gateway/server-http.test-harness.ts:78, 970992db26c8)
  • Release comparison: The latest supplied release also retains the inline response-end Promise construction; this cleanup is not already shipped there. (src/gateway/server-http.test-harness.ts:78, 3a9d69db306c)
  • Pinned-head CI: GitHub independently reports ordinary CI success for ecdbed3: https://github.com/openclaw/openclaw/actions/runs/34754652988. (ecdbed33651c)
  • Previous follow-up addressed in captured body: The supplied body at sourceRevision 83272894fa2d0d71a6b04f57b47d249bae48d40db589063b0611ca95904b580c records all nine chat-file-links/dashboard-website cases passing on the candidate and the Testbox lease stopped. GitHub identifies the linked run as a cancelled workflow-dispatch Testbox session; that status alone neither proves nor disproves the interactive results. Raw-log inspection was blocked by the environment's blob-host allowlist, so the nine-case result remains author-reported. This reviewer limitation does not create a new contributor proof obligation. (ecdbed33651c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • RomneyDa: 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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-13T06:59:11.816Z sha 0bc31512b803a1702349a58824a356bfdbcb9ff3 :: blocked before merge. :: none
  • reviewed 2026-09-13T08:07:06.001Z sha a62164881ec911e04aa415179a214d9a3d14797b :: blocked before merge. :: none
  • reviewed 2026-09-13T09:37:26.726Z sha 750b873 :: blocked before merge. :: none
  • reviewed 2026-09-13T11:38:47.473Z sha ecdbed3 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/tenk-inline-deferred-refresh branch 2 times, most recently from a621648 to 750b873 Compare September 13, 2026 09:02
@steipete
steipete force-pushed the codex/tenk-inline-deferred-refresh branch from 750b873 to ecdbed3 Compare September 13, 2026 11:31
@steipete
steipete merged commit a67f462 into main Sep 13, 2026
154 of 155 checks passed
@steipete
steipete deleted the codex/tenk-inline-deferred-refresh branch September 13, 2026 12:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 3, 2026
Block: heartbeat wake test-reset residue and the moved lifecycle suite.

- resetHeartbeatWakeStateForTests / resetSessionEventWakeStateForTests were
  deleted upstream in d1684f4 (openclaw#106019); 2273ef6/5a6971fc3a revived them.
  Removed both production exports; no continuation test needs them (the
  existing afterEach drain with a disabled handler empties the queue).
- heartbeat-wake.test.ts restored to upstream b51feb9 bytes. This brings
  back the six lifecycle tests verbatim, including the createDeferred owner
  from a67f462 (openclaw#146809), and drops the lifecycle-file copy of
  "executes distinct targeted wakes ...", deleted upstream in 2bdf870
  (openclaw#158725), plus its four byte-duplicate tests.
- heartbeat-wake.lifecycle.test.ts deleted. The six continuation routing
  tests (trusted/untrusted slot separation, parentRunId forwarding) moved
  unchanged into heartbeat-wake.continuation-routing.test.ts so the upstream
  file stays within its line cap.

Home: restored to upstream (drift residue). Stayed: continuation routing
tests in their own sibling file.

Refs #1418

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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: XL 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