Skip to content

test(gateway): use in-memory task registry - #118191

Merged
steipete merged 1 commit into
mainfrom
codex/test-perf-agent-task-store
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-perf-agent-task-store

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • run the 266-case gateway agent handler suite against the canonical in-memory task-registry test runtime
  • preserve real handler dispatch, task creation/finalization, indexes, terminal states, and detached lifecycle behavior
  • keep SQLite durability, reopen, failure, and atomic-write coverage in the dedicated task-registry store owner suite

No production code, test configuration, worker count, or sharding changes.

Performance

  • warm baseline: 81.82s Vitest / 77.95s test bodies
  • patched samples: 20.59–23.40s Vitest / 16.45–19.93s test bodies
  • final proof: 19.57s Vitest / 15.87s test bodies
  • conservative improvement: about 73% Vitest duration and 77% test-body time

The previous harness opened, wrote, finalized, persisted, and repeatedly closed the SQLite task ledger as fixture plumbing even though this suite asserts same-process handler semantics rather than database durability.

Proof

  • src/gateway/server-methods/agent.test.ts — 266/266 passed
  • src/tasks/task-registry.store.test.ts — 43/43 SQLite owner tests passed
  • targeted oxfmt, oxlint, and git diff --check passed
  • autoreview clean with no accepted/actionable findings

Test-only change; no changelog entry.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 4:51 PM ET / 20:51 UTC.

ClawSweeper review

What this changes

This PR changes the gateway agent-handler test suite to use the canonical in-memory task-registry runtime instead of SQLite fixture persistence, while leaving dedicated SQLite store tests in place.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for maintainer handling. The test-only optimization is not on current main, the PR keeps the task lifecycle exercised through the canonical in-memory store while the SQLite owner suite retains durability coverage, and the protected maintainer label rules out automated cleanup.

Priority: P3
Reviewed head: e6a99f16029f6302b80e5a9a551df4bb9cf8ea44

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-only refactor with a coherent owner-boundary split and concrete targeted run results.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body supplies after-change terminal evidence for the 266-case gateway suite, the 43-case SQLite owner suite, formatting/lint/diff checks, and measured improved test duration; this directly covers the test-only behavior changed here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body supplies after-change terminal evidence for the 266-case gateway suite, the 43-case SQLite owner suite, formatting/lint/diff checks, and measured improved test duration; this directly covers the test-only behavior changed here.
Evidence reviewed 5 items Canonical in-memory runtime: The shared test helper installs a cloned in-memory TaskRegistryStore through the normal task-registry runtime configuration seam, so handler tests continue exercising registry reads and writes without SQLite fixture I/O.
Lifecycle reset coverage: The PR resets registry memory without persistence and immediately reinstalls the in-memory runtime in both the ordinary handler cleanup and the abort-integration reset path, preserving per-test isolation across the two test groups.
Persistence owner remains separate: The dedicated task-registry store suite still imports the SQLite store functions and resets the default runtime after each test; the PR does not weaken its durability, reopen, or persistence coverage.
Findings None None.
Security None None.

How this fits together

Gateway agent-handler tests send simulated RPC requests through the real agent dispatch and task lifecycle. The task registry normally persists tasks to SQLite, while this test suite can use an injected in-memory store to verify same-process lifecycle behavior faster; dedicated task-store tests continue to cover persistence.

flowchart LR
  A[Gateway agent test inputs] --> B[Agent handler dispatch]
  B --> C[Task lifecycle]
  C --> D[Injected in-memory task registry]
  D --> E[Task and terminal-state assertions]
  F[Task-registry store owner tests] --> G[SQLite durability and reopen assertions]
  G --> E
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; GitHub currently reports it mergeable, but the focused test suite should be rerun after any rebase or conflict resolution.
  • Complete next step (P2) - The protected maintainer label and ordinary merge review are the remaining actions; no discrete automated repair is needed.
Agent review details

Security

None.

PR surface

Source +9, Tests +8. Total +17 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 34 25 +9
Tests 1 8 0 +8
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 42 25 +17

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused test-runtime refactor after refresh against current main, retaining the in-memory registry for handler semantics and the separate SQLite store suite for durability contracts.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused test-runtime refactor after refresh against current main, retaining the in-memory registry for handler semantics and the separate SQLite store suite for durability contracts.

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

Not applicable: this PR optimizes test fixture behavior rather than reporting a user-facing defect; the relevant verification is the targeted handler and store-suite evidence described in the PR body.

Is this the best way to solve the issue?

Yes. Reusing the existing injectable task-registry store preserves real lifecycle semantics in gateway tests while keeping SQLite-specific contracts in their owning suite, avoiding a second task-lifecycle implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded test-harness performance and ergonomics improvement with no production behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-change terminal evidence for the 266-case gateway suite, the 43-case SQLite owner suite, formatting/lint/diff checks, and measured improved test duration; this directly covers the test-only behavior changed here.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies after-change terminal evidence for the 266-case gateway suite, the 43-case SQLite owner suite, formatting/lint/diff checks, and measured improved test duration; this directly covers the test-only behavior changed here.

Label justifications:

  • P3: This is a bounded test-harness performance and ergonomics improvement with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies after-change terminal evidence for the 266-case gateway suite, the 43-case SQLite owner suite, formatting/lint/diff checks, and measured improved test duration; this directly covers the test-only behavior changed here.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-change terminal evidence for the 266-case gateway suite, the 43-case SQLite owner suite, formatting/lint/diff checks, and measured improved test duration; this directly covers the test-only behavior changed here.

Evidence

What I checked:

  • Canonical in-memory runtime: The shared test helper installs a cloned in-memory TaskRegistryStore through the normal task-registry runtime configuration seam, so handler tests continue exercising registry reads and writes without SQLite fixture I/O. (src/test-utils/task-registry-runtime.ts:20, e6a99f16029f)
  • Lifecycle reset coverage: The PR resets registry memory without persistence and immediately reinstalls the in-memory runtime in both the ordinary handler cleanup and the abort-integration reset path, preserving per-test isolation across the two test groups. (src/gateway/server-methods/agent.test-harness.ts:940, e6a99f16029f)
  • Persistence owner remains separate: The dedicated task-registry store suite still imports the SQLite store functions and resets the default runtime after each test; the PR does not weaken its durability, reopen, or persistence coverage. (src/tasks/task-registry.store.test.ts:1, b35b8e286df0)
  • Still needed on current main: The PR head is not an ancestor of current main; its merge base with current main is the PR base commit, so current main does not already contain this test-runtime optimization. (src/gateway/server-methods/agent.test.ts:1, e6a99f16029f)
  • Feature-history routing: History shows the surrounding harness behavior dates to the gateway restart-lease handoff work, while the submitted commit introduces the in-memory task-registry test runtime adoption; shortlog also shows Peter Steinberger as the dominant contributor across these test paths. (src/gateway/server-methods/agent.test-harness.ts:981, 1704ea591820)

Likely related people:

  • steipete: Peter Steinberger authored the proposed runtime change and is the dominant historical contributor across the affected gateway task-registry test paths. (role: recent area contributor; confidence: high; commits: e6a99f16029f; files: src/gateway/server-methods/agent.test-harness.ts, src/gateway/server-methods/agent.sessions-and-models.test-utils.ts, src/test-utils/task-registry-runtime.ts)
  • Vincent Koc: The current integration-reset neighborhood is attributed to the gateway restart-lease handoff commit, making Vincent Koc a useful adjacent routing contact for lifecycle isolation questions. (role: introduced surrounding test-harness behavior; confidence: medium; commits: 1704ea591820; files: src/gateway/server-methods/agent.test-harness.ts)

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.

@steipete
steipete merged commit b095faf into main Aug 2, 2026
102 of 110 checks passed
@steipete
steipete deleted the codex/test-perf-agent-task-store branch August 2, 2026 21:04
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 2, 2026
* origin/main:
  feat(gateway): track event-loop degradation persistence and add concurrency benchmark (#118193)
  fix(config): preserve secret ownership when configuration rows move (#118149)
  fix(cron): deliver failure alerts after persistence (#118200)
  chore(lint): clear 172 lint:all baseline violations in five batches (#118098)
  perf(gateway): remove streaming hot-path rescans (#118192)
  test(gateway): use in-memory task registry (#118191)
  test(macos): fix three races in the bounded process suites (#118196)
  refactor(migrate-hermes): consolidate test fixtures (#118182)
  test(android): share Wear transport fixtures (#118177)
  test(ui): deduplicate control UI e2e setup (#118180)
  fix(plugins): unblock prerelease validation (#118103)
  test(cli): reduce redundant process launches (#118141)
  test(gateway): compact terminal observer fixtures (#118179)
  fix(agents): make requested threads sidebar-visible (#118073)
  test(plugins): canonicalize native resolver fixtures (#118174)
  test: deduplicate agent runner fixtures (#118176)
  refactor(policy): consolidate doctor test fixtures (#118173)
  fix(plugins): remove disabled channel plugin configuration on uninstall (#118127)
  refactor(matrix): consolidate monitor test fixtures (#118175)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* origin/main:
  feat(gateway): track event-loop degradation persistence and add concurrency benchmark (openclaw#118193)
  fix(config): preserve secret ownership when configuration rows move (openclaw#118149)
  fix(cron): deliver failure alerts after persistence (openclaw#118200)
  chore(lint): clear 172 lint:all baseline violations in five batches (openclaw#118098)
  perf(gateway): remove streaming hot-path rescans (openclaw#118192)
  test(gateway): use in-memory task registry (openclaw#118191)
  test(macos): fix three races in the bounded process suites (openclaw#118196)
  refactor(migrate-hermes): consolidate test fixtures (openclaw#118182)
  test(android): share Wear transport fixtures (openclaw#118177)
  test(ui): deduplicate control UI e2e setup (openclaw#118180)
  fix(plugins): unblock prerelease validation (openclaw#118103)
  test(cli): reduce redundant process launches (openclaw#118141)
  test(gateway): compact terminal observer fixtures (openclaw#118179)
  fix(agents): make requested threads sidebar-visible (openclaw#118073)
  test(plugins): canonicalize native resolver fixtures (openclaw#118174)
  test: deduplicate agent runner fixtures (openclaw#118176)
  refactor(policy): consolidate doctor test fixtures (openclaw#118173)
  fix(plugins): remove disabled channel plugin configuration on uninstall (openclaw#118127)
  refactor(matrix): consolidate monitor test fixtures (openclaw#118175)
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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