Skip to content

test: scheduled-command demotion case depends on test order - #180818

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:test/scheduled-turns-deterministic-hold
Oct 22, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:test/scheduled-turns-deterministic-hold

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Related: #180282

What Problem This Solves

Fixes: in the scheduled plugin-command tests, a requester demotion in one test was ignored whenever the authorized test ran first in the same file. Because of that, the queued-child authorization cases had been combined into a single test.

User Impact

No user-visible change. The tests now run deterministically: the demotion case fails only when the product check fails, not because of test order.

Why This Change Was Made

No authority cache or registry state was leaking between tests. The harness meant to keep the child queued, but it never did:

  • Its capacity blocker enqueued with maxConcurrent: 1, but every swarm reservation re-applies the configured lane limit (default 32), so the child's own reservation widened the lane and the child launched at once.
  • Whether the child was still queued when the test demoted the requester depended on timing. The first test in a file was slow because of cold module loading. Later tests were not, so the child had already passed admission before the demotion.

The fix:

  • A shared hold helper pins the configured swarm limit to one.
  • Before acting, the test asserts that the child holds a swarm reservation but has not launched.
  • The authorized and demoted queued-child cases are separate tests again.

Production code is unchanged.

Evidence

All runs used a private HOME, state, TMPDIR and handoff store.

Check Result
Reproduction before the fix, cases split, authorized test first the demotion test failed with published reply runtime missing instead of the authority refusal
Same demotion test run alone, before the fix passed
Full commands-plugin.scheduled-turns.test.ts, after the fix (re-run after rebasing onto current main) 25/25
Shuffled order, seeds 7, 1234, 99 25/25 each
Mutation: drop the configured-limit pin all 3 hold-dependent tests fail at the new "child is waiting" assertion (the child was already active)
Mutation: skip the queued channel-authority recheck in operator-run-recovery.ts only the demotion test fails
tsgo core test graphs, type-aware oxlint (including max-lines), oxfmt, check:test-mock-exports, git diff --check clean

The other S6 follow-ups need no code change. Their proof is in a separate comment on #180282: a real provider call by a scheduled child on an isolated Gateway, and an upgrade from v2026.10.5 through doctor --fix plus a rollback reader.

The capacity blocker in the scheduled-command harness enqueued with maxConcurrent 1,
but every swarm reservation re-applies the configured lane limit (default 32), so the
child's own reservation widened the lane and it launched immediately. Whether it was
still queued when the test acted depended on module-load timing: the first test in a
file was slow enough, later tests were not, so a demotion in a second test landed after
the child had already passed admission.

Pin the configured swarm limit to one in a shared hold helper, assert the child holds a
reservation without launching before acting, and split the queued-child authorization
cases back into separate tests.
@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR pins test swarm capacity, verifies children remain queued, and separates authorized and demoted requester cases.

Example: The authorized scheduled-child test runs before the requester-demotion test.

  • Before: The child's reservation can widen capacity from 1 to 32 and pass admission before demotion.
  • After: Capacity stays at 1 until the test confirms the child is queued, demotes the requester, and releases the blocker.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported test repair with useful reported mutation validation; execution evidence remains reported harness results rather than independently inspected runs.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only repair reports baseline, shuffled-order, and mutation validation of the changed harness; linked Gateway verification concerns the previously merged feature.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Order-dependent tests can obscure whether a queued child correctly refuses a demoted requester.
Reason: The maintainer-authored direction is established, and deterministic coverage protects an existing authorization contract without changing product behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes queued-child authorization tests deterministic, and the defective harness remains on current main; no introduced defects were found.

Priority: P3
Reviewed head: 02d3ce711a1b89533abdeafb7d3db0c521a585b9

Before merge

None.

Findings

None.

Agent review details

How this fits together

The test harness sends plugin commands through the real scheduler and native-child admission owners, then observes queued reservations and terminal authorization outcomes.

flowchart LR
  A[Plugin command fixture] --> B[Scheduled occurrence]
  B --> C[Native child reservation]
  D[Capacity blocker] --> C
  C --> E[Requester authority recheck]
  E --> F[Observed terminal outcome]
Loading

Technical review

Best possible solution:

Keep the shared configuration-backed capacity hold and separate authorization cases without changing production scheduling.

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

Source confirms that child reservations overwrite the blocker's lane limit; the author reports an order-dependent baseline failure and targeted mutation checks, but this review ran no tests.

Is this the best way to solve the issue?

The patch repairs fixture configuration at the existing capacity owner, shares repeated setup, and retains distinct lineage, authorized-admission, and demotion failures without production machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 827aae9c0bf1.

Provenance checked

  • Scheduled-child capacity setup and queued authorization cases keeps the original intent (ad40743: The merged feature used capacity blockers to test children launching after occurrence settlement under current requester authority; this PR preserves that intent and fixes the blocker configuration.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit ad40743 adds src/auto-reply/reply/commands-plugin.scheduled-turns.test.ts:694 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ad407430c464; files: src/auto-reply/reply/commands-plugin.scheduled-turns.test.ts)

PR surface

Tests +26. Total +26 across 2 files. Added test files: 1.

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

Labels

Label changes:

  • add P3: This is a focused test-harness repair with no user-visible runtime change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a focused test-harness repair with no user-visible runtime change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 22, 2026, 1:35 PM ET / 17:35 UTC.

@fuller-stack-dev
fuller-stack-dev merged commit a8be68f into openclaw:main Oct 22, 2026
130 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…ly (openclaw#180818)

The capacity blocker in the scheduled-command harness enqueued with maxConcurrent 1,
but every swarm reservation re-applies the configured lane limit (default 32), so the
child's own reservation widened the lane and it launched immediately. Whether it was
still queued when the test acted depended on module-load timing: the first test in a
file was slow enough, later tests were not, so a demotion in a second test landed after
the child had already passed admission.

Pin the configured swarm limit to one in a shared hold helper, assert the child holds a
reservation without launching before acting, and split the queued-child authorization
cases back into separate tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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