Skip to content

test(gateway): isolate scheduled service timers - #119218

Merged
vincentkoc merged 1 commit into
mainfrom
beta8-gateway-hang
Aug 4, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
beta8-gateway-hang

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Resolves a release-validation failure where the full Gateway server test shard could wait about 62 seconds and then fail because warning-only tests leaked scheduled recovery timers into a later timer assertion.

Why This Change Was Made

The two warning-only cases now use fake timers, matching the rest of the timer-sensitive suite. This keeps their background scheduler handles test-local without changing Gateway runtime behavior.

User Impact

No product runtime behavior changes. Maintainers get deterministic release and CI proof for the Gateway server shard under load.

Evidence

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Aug 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 12:33
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 9:06 AM ET / 13:06 UTC.

ClawSweeper review

What this changes

Adds fake timers to two Gateway scheduler-warning tests so their background recovery timers cannot affect later assertions.

Regression provenance

Possible regression — probable (failure trace; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. This is a focused, source-backed test-isolation repair for a real shared-worker timer leak; no blocking finding was identified.

Priority: P3
Reviewed head: 9ec1771f3e7eeff12543a40f557be02667babdec

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A narrowly scoped, owner-correct test repair with concrete before/after shard evidence and no identified correctness or security concern.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies focused and full-shard after-fix output.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies focused and full-shard after-fix output.
Evidence reviewed 5 items Timer-owning runtime path: Activation creates the session-delivery recovery lifecycle, which schedules a 1,250 ms timeout and later schedules pending deliveries.
Exact affected tests and cleanup: Both warning cases activate scheduled services; the proposed fake timers match the suite’s existing timer pattern and the suite restores real timers after each case.
Shared-worker failure mechanism: The Gateway server Vitest shard runs with isolation disabled, so real scheduled handles can cross test-case boundaries; a later test already advances fake timers through this lifecycle.
Findings None None.
Security None None.

How this fits together

Gateway startup activates heartbeat, cron, and delivery-recovery services after sidecars are ready. The affected tests invoke that activation path to check warnings, while later cases advance the same scheduler timers.

flowchart LR
  A[Gateway startup] --> B[Scheduled services]
  B --> C[Recovery timeout and retry interval]
  C --> D[Warning-only tests]
  D --> E[Shared test worker]
  E --> F[Later timer assertions]
  G[Fake timers] --> D
Loading

Before merge

  • Complete next step (P2) - This open maintainer PR is already the narrow repair; no separate repair lane is warranted.
Agent review details

Security

None.

PR surface

Tests +2. Total +2 across 1 file.

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

Review metrics

Metric Value Why it matters
Production vs test LOC production +0, tests +2 The change confines scheduler isolation to the two test cases and does not alter runtime behavior.

Technical review

Best possible solution:

Merge the two test-local fake-timer calls, preserving the existing suite-level real-timer teardown and leaving Gateway runtime behavior unchanged.

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

Yes, source-reproducible: the non-isolated Gateway shard runs two real-timer activation tests before a later case advances the same 1,250 ms recovery path.

Is this the best way to solve the issue?

Yes. Fake timers at the two tests that create and discard scheduler handles match the established suite pattern and are narrower than changing production lifecycle behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a low-risk test determinism cleanup; the reported impact is CI and release-validation reliability rather than a product runtime regression.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies focused and full-shard after-fix output.

Label justifications:

  • P3: This is a low-risk test determinism cleanup; the reported impact is CI and release-validation reliability rather than a product runtime regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only PR is outside the external-contributor proof gate; its body nevertheless supplies focused and full-shard after-fix output.

Evidence

What I checked:

  • Timer-owning runtime path: Activation creates the session-delivery recovery lifecycle, which schedules a 1,250 ms timeout and later schedules pending deliveries. (src/gateway/server-runtime-services.ts:278, b4f01afa861b)
  • Exact affected tests and cleanup: Both warning cases activate scheduled services; the proposed fake timers match the suite’s existing timer pattern and the suite restores real timers after each case. (src/gateway/server-runtime-services.test.ts:145, 9ec1771f3e7e)
  • Shared-worker failure mechanism: The Gateway server Vitest shard runs with isolation disabled, so real scheduled handles can cross test-case boundaries; a later test already advances fake timers through this lifecycle. (test/vitest/vitest.gateway-server.config.ts:18, b4f01afa861b)
  • History and ownership: Blame ties the delayed recovery timeout and original warning cases to the lifecycle/test introduction commit; the PR head adds only the two timer-isolation calls. (src/gateway/server-runtime-services.ts:278, 2de88241a437)
  • Submitted runtime proof: The PR body reports the prior full-shard failure, an after-fix 2670/2670 Testbox pass, a focused 28/28 pass, and an exact-head changed-gate run. (9ec1771f3e7e)

Likely related people:

  • vincentkoc: Introduced the current runtime-service test/lifecycle surface and authored this focused isolation repair. (role: feature owner and recent area contributor; confidence: high; commits: 2de88241a437, 6c8e065e3b1b, 9ec1771f3e7e; files: src/gateway/server-runtime-services.ts, src/gateway/server-runtime-services.test.ts)
  • steipete: Earlier Gateway scheduler deferral work is directly adjacent to the scheduled-service lifecycle under test. (role: earlier scheduler contributor; confidence: medium; commits: 6a7961736a83; files: src/gateway/server-runtime-services.ts)
  • dallinromney: Prior Gateway timer-boundary cleanup is relevant to the suite-level cleanup invariant used here. (role: adjacent test-isolation contributor; confidence: medium; commits: a99cbf29bd9c; files: src/gateway)

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.

@vincentkoc
vincentkoc merged commit e2b90e6 into main Aug 4, 2026
102 of 104 checks passed
@vincentkoc
vincentkoc deleted the beta8-gateway-hang branch August 4, 2026 13:08
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main: (208 commits)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (#118575)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  fix(auto-reply): suppress false no-reply fallback during continuations (#119154)
  ...
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  chore(tui): add Gateway boundary PTY coverage (#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  chore(tui): add Gateway boundary PTY coverage (#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main: (23 commits)
  chore(tui): add Gateway boundary PTY coverage (#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (#118575)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  ...
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  chore(tui): add Gateway boundary PTY coverage (#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
vincentkoc added a commit that referenced this pull request Aug 4, 2026
…time

* origin/main: (177 commits)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (#118575)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  fix(auto-reply): suppress false no-reply fallback during continuations (#119154)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
* origin/main: (23 commits)
  chore(tui): add Gateway boundary PTY coverage (openclaw#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (openclaw#119218)
  test(qa): cover Canvas agent and node controls (openclaw#119047)
  fix(cli): avoid repeated migration scans during local agent turns (openclaw#119051)
  fix(gateway): keep agents list on prepared model facts (openclaw#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (openclaw#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (openclaw#118575)
  fix(agents): recover from invalid compaction summaries (openclaw#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (openclaw#119166)
  fix(plugins): preserve metadata reloads during models status (openclaw#119183)
  fix(test): bound direct gateway server runs (openclaw#119184)
  test(tui): prove command surfaces through PTY (openclaw#119165)
  fix(testbox): restore claims across path aliases (openclaw#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (openclaw#119164)
  fix(testbox): remove changed-gate sync residue (openclaw#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (openclaw#118998)
  ...
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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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