Skip to content

test(gateway): consolidate deleted-agent session fixtures - #118549

Merged
steipete merged 1 commit into
mainfrom
codex/test-perf-deleted-agent-mocks
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-perf-deleted-agent-mocks

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move the two deleted-agent sessions.send / sessions.steer cases into the existing sessions-messaging owner suite
  • replace broad session-utils partial mocks with the exact lookup exports these handler tests consume
  • preserve all named assertions while removing one duplicate non-isolated module-graph rebuild

Root cause

On exact main run 30790046425, sessions.send-deleted-agent.test.ts ran two assertions in 2 ms but finished 53.42 seconds after the preceding gateway output. The file rebuilt the complete sessions-messaging graph in a fresh non-isolated module generation, and its shared helper also called vi.importActual() on the broad session-utils barrel. Vitest reported 65.29 seconds of gateway setup and the gateway-methods group took 128.28 seconds.

The same production handler graph was already owned by sessions.send-followup-status.test.ts. Consolidating the two cases there keeps the real handler, deleted-agent guard ordering, response assertions, and test count while paying that graph cost once.

Proof

  • focused owner: 15/15 passed, 7.33 s Vitest
  • affected handler siblings: 6/6 passed, 4.82 s Vitest
  • post-rebase combined proof: 21/21 passed, 4.80 s Vitest
  • full gateway-methods configuration: 144/144 files and 2,835/2,835 tests passed in 102.08 s; setup fell to 2.94 s and the terminal stall disappeared
  • formatting, direct targeted oxlint, git diff --check, and autoreview: clean
  • production LOC: 0; test LOC: +49/-67 (net -18)

Exact current-main baseline: https://github.com/openclaw/openclaw/actions/runs/30790046425/job/91612145536

Blacksmith Testbox was unavailable locally. Direct AWS Crabbox lease cbx_48dc9d8a7605 could not install dependencies after the required retry because postinstall could not resolve the TypeScript dev dependency, so the full-suite proof used the documented trusted-source local fallback and the lease was stopped cleanly.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 2:57 AM ET / 06:57 UTC.

ClawSweeper review

What this changes

Moves the deleted-agent sessions.send and sessions.steer tests into the existing session-messaging suite and replaces broad session-utils partial mocks with the specific lookup exports used by those tests.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR remains useful: current main still keeps the deleted-agent checks in a separate suite with a broad session-utils partial mock, while the branch moves the same assertions into the existing shared-handler suite and removes the duplicate module-graph setup. No correctness or security defect was found; the maintainer label requires explicit human merge handling after the remaining exact-head checks finish.

Priority: P3
Reviewed head: 9e874a4630479cbb76481c9a51e9114e59cbd4dd
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, net-reducing test refactor with preserved handler assertions and strong post-run performance evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides direct post-change terminal-style results for focused, sibling, combined, and full gateway-methods runs, including the reduced setup-time outcome claimed by this test-only refactor.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides direct post-change terminal-style results for focused, sibling, combined, and full gateway-methods runs, including the reduced setup-time outcome claimed by this test-only refactor.
Evidence reviewed 6 items Current main retains the duplicate fixture graph: Current main has a dedicated deleted-agent suite importing sessions-messaging, and its shared helper calls vi.importActual for the full session-utils barrel before overriding two lookups.
Shared handler and mock contract: sessions-messaging directly imports loadSessionEntry, loadSessionEntryReadOnly, and resolveDeletedAgentIdFromSessionKey; the guard rejects deleted-agent keys before the send/steer path continues. The PR mock supplies those imports, plus loadGatewaySessionRow used by the existing suite.
Branch preserves the assertions in the owning suite: The PR deletes the standalone two-method test and adds the same looped invalid-request assertions to sessions.send-followup-status.test.ts, resetting the added mocks for each case.
Findings None None.
Security None None.

How this fits together

Gateway sessions.send and sessions.steer requests share one session-messaging handler. It loads the requested session, rejects sessions whose owning agent was deleted, then either sends or steers a run; this PR only consolidates the handler's Vitest coverage and mock setup.

flowchart LR
  Request[Gateway session request] --> Handler[Shared session messaging handler]
  Handler --> Lookup[Session lookup helpers]
  Lookup --> Guard[Deleted-agent decision]
  Guard --> Reject[Invalid-request response]
  Handler --> Run[Send or steer session run]
  Tests[Consolidated owner test suite] --> Handler
Loading

Decision needed

Question Recommendation
Should this protected maintainer PR merge after its in-progress exact-head checks succeed, or is a refreshed gateway-methods benchmark required first? Merge after checks: Accept the consolidated owner-suite coverage once the remaining exact-head checks complete successfully.

Why: The patch is source-consistent and has strong reported proof, but the protected label requires a human merge decision rather than automated cleanup.

Before merge

  • Resolve merge risk (P1) - The branch is behind main; although GitHub reports it mergeable, merge review should refresh the exact-head check set after any rebase.
  • Complete next step (P2) - No repair is needed; the remaining action is protected-label human merge review after exact-head checks finish.
Agent review details

Security

None.

PR surface

Source -2, Tests -16. Total -18 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 9 -2
Tests 2 42 58 -16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 49 67 -18

Review metrics

Metric Value Why it matters
Production vs test LOC production 0; tests +49/-67 (net -18) The branch reduces test-only code while retaining the two deleted-agent assertions and does not modify production behavior.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/server-methods/sessions.send-deleted-agent.test.ts, serialized state: src/gateway/server-methods/sessions.send-followup-status.test.ts, unknown-data-model-change: src/gateway/server-methods/sessions.send-followup-status.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the deleted-agent assertions beside the shared session-messaging handler, preserve the narrow mock contract, and merge after the protected-label reviewer confirms the final exact-head checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the deleted-agent assertions beside the shared session-messaging handler, preserve the narrow mock contract, and merge after the protected-label reviewer confirms the final exact-head checks.

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

Not applicable to a user-facing bug: the claimed improvement is test-harness setup cost, and the PR body provides focused and full-suite post-change timing results.

Is this the best way to solve the issue?

Yes. Both RPC methods already share the session-messaging handler and its fixture infrastructure, so relocating the unchanged assertions there removes duplicate module setup without moving the production owner boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is low-risk internal test-performance cleanup with no runtime behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides direct post-change terminal-style results for focused, sibling, combined, and full gateway-methods runs, including the reduced setup-time outcome claimed by this test-only refactor.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides direct post-change terminal-style results for focused, sibling, combined, and full gateway-methods runs, including the reduced setup-time outcome claimed by this test-only refactor.

Label justifications:

  • P3: This is low-risk internal test-performance cleanup with no runtime behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides direct post-change terminal-style results for focused, sibling, combined, and full gateway-methods runs, including the reduced setup-time outcome claimed by this test-only refactor.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides direct post-change terminal-style results for focused, sibling, combined, and full gateway-methods runs, including the reduced setup-time outcome claimed by this test-only refactor.

Evidence

What I checked:

Likely related people:

  • Shakker: Available current-source blame attributes both the shared deleted-agent guard and owner-suite setup to the same commit. (role: current source attribution; confidence: medium; commits: 5d2cc051b407; files: src/gateway/server-methods/sessions-messaging.ts, src/gateway/server-methods/sessions.send-followup-status.test.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 8edfa5e into main Aug 3, 2026
103 of 115 checks passed
@steipete
steipete deleted the codex/test-perf-deleted-agent-mocks branch August 3, 2026 07:03
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
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: 🦞 diamond lobster Very strong PR readiness with only minor 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