Skip to content

refactor: remove agent-step test registry - #155125

Merged
steipete merged 1 commit into
mainfrom
codex/agent-step-test-seam
Sep 21, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/agent-step-test-seam

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Nested agent steps keep a mutable dependency override and a global test registry in production code.

User Impact

No intended user-visible change. Inter-session message annotation, Gateway execution, direct transcript-preserving announcements, and reply handling keep their existing behavior.

Why This Change Was Made

Use the existing lazy agent-command import directly, capturing ingress arguments before awaiting it. Keep scoped module spies in test support, await their setup and restoration, and remove the retired global registry and its metadata entries. Production shrinks by 31 lines; test/support grows by 16 and metadata shrinks by 2, for 17 fewer lines overall.

Related: #150153.

Evidence

  • Fresh P2 review is clean on the exact final tree. All 17 setup/reset calls are awaited; assertions and test inventories are unchanged.
  • Retained proof passed 135 distinct cases: 5 direct-step, 82 session-tool, 33 child-coordination and 15 Gateway cases. The final import-order repair reran all 82 session-tool cases, and the final Gateway pair passed all 15 on each side.
  • The selected PRIVATE_QA runtime/declaration build, AI bundle, package import checks and built SDK ingress import passed. Production bytes are unchanged from that qualified revision; no full UI build is claimed.
  • Registered checks are complete across recorded revisions: type/export checks precede the repaired lint failure, followed by final lint, formatting, line-cap and remaining guards. Earlier line-cap and mock-import failures are preserved; no uninterrupted final full-gate invocation is claimed.
  • Isolated Linux qualification: final native execution and owned cleanup completed; independent provider status is completed. Exact source and result receipts are retained separately from the Actions lifecycle projection.

No production Gateway or external model-provider run is claimed. Exact-head PR CI remains required before landing.

Required Gateway before/after timing

The complete src/gateway/server.sessions-send.test.ts file passed all 15 cases on each revision using one isolated Linux host (Node 24.19.0, pnpm 12.4.0), independent frozen installs and fresh caches.

Revision Wall time Peak RSS
Baseline 46.253 s 2,678,560 KiB
Candidate 49.275 s 2,522,704 KiB

The case inventory is identical. These are single observations, not a statistical performance claim. Baseline d61156bb5cfa22e15d19121d6ab4c073bfeac33e; final candidate tree 5d73d65d657278328a4ff456d42ee58b29e37dd6.

@clawsweeper

clawsweeper Bot commented Sep 21, 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 agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 19:45
@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 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 3:54 PM ET / 19:54 UTC.

ClawSweeper review

What this changes

Removes the nested agent executor’s production test registry and moves dependency substitution into awaited Vitest spies while preserving session messaging behavior.

Merge readiness

✅ Ready for maintainer review

This remains useful, focused cleanup: pinned main and the latest release still contain the registry. No introduced correctness or security defect was found.

Priority: P3
Reviewed head: 5adae3162571667fb99c2077abc909e618fc75b4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving cleanup with retained assertions and source-bound validation context; no actionable defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a maintainer-authored internal refactor, so the external-contributor proof gate does not apply. Reported direct-step and Gateway tests cover the changed execution seam; no production Gateway or provider run is claimed, and the diff introduces no material authority change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored internal refactor, so the external-contributor proof gate does not apply. Reported direct-step and Gateway tests cover the changed execution seam; no production Gateway or provider run is claimed, and the diff introduces no material authority change.
Evidence reviewed 7 items Production behavior preserved: The introduced diff removes the mutable override and global publication. The direct path captures the same ingress fields before awaiting the same lazy import; Gateway dispatch and reply extraction remain unchanged.
Test substitution and cleanup: All 17 setup/reset calls await the asynchronous helper. The helper restores the preceding spy before replacement; the Gateway mock now separates direct ingress from the shared command mock. Existing assertions are retained, and repository-wide search found no remaining retired registry symbols.
Still necessary on main: Pinned current main still contains defaultAgentStepDeps, agentStepDeps, and the global test registry. The cleanup has not already been incorporated there.
Findings None None.
Security None None.

How this fits together

Nested agent steps carry messages between sessions and return assistant replies. Ordinary steps use the Gateway; transcript-preserving announcement steps call the agent command directly through a lazy import.

flowchart TD
  A[Session message flow] --> B[Nested agent step]
  B --> C{Transcript bookkeeping needed?}
  C -->|Yes| D[Lazy agent command]
  C -->|No| E[Gateway execution]
  D --> F[Extract assistant reply]
  E --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -30, Tests +14, Other -1. Total -17 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 2 6 36 -30
Tests 8 76 62 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 11 82 99 -17

Review metrics

None.

Technical review

Best possible solution:

Keep dependency substitution in test support while retaining the existing lazy execution boundary and session-reply contracts.

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

Not applicable: this refactor removes source-visible test machinery rather than addressing a reported runtime failure; no runtime reproduction was executed.

Is this the best way to solve the issue?

Yes. Reusing the existing lazy command import and scoped module spies removes production-only testing machinery without creating a competing execution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8c56f7239e98.

Labels

Label changes:

  • add P3: This is internal test-seam cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a maintainer-authored internal refactor, so the external-contributor proof gate does not apply. Reported direct-step and Gateway tests cover the changed execution seam; no production Gateway or provider run is claimed, and the diff introduces no material authority change.

Label justifications:

  • P3: This is internal test-seam cleanup with no intended user-visible behavior 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: The supplied repository state identifies a maintainer-authored internal refactor, so the external-contributor proof gate does not apply. Reported direct-step and Gateway tests cover the changed execution seam; no production Gateway or provider run is claimed, and the diff introduces no material authority change.

Evidence

What I checked:

  • Production behavior preserved: The introduced diff removes the mutable override and global publication. The direct path captures the same ingress fields before awaiting the same lazy import; Gateway dispatch and reply extraction remain unchanged. (src/agents/tools/agent-step.ts:67, 5adae3162571)
  • Test substitution and cleanup: All 17 setup/reset calls await the asynchronous helper. The helper restores the preceding spy before replacement; the Gateway mock now separates direct ingress from the shared command mock. Existing assertions are retained, and repository-wide search found no remaining retired registry symbols. (src/agents/tools/agent-step.test-support.ts:6, 5adae3162571)
  • Still necessary on main: Pinned current main still contains defaultAgentStepDeps, agentStepDeps, and the global test registry. The cleanup has not already been incorporated there. (src/agents/tools/agent-step.ts:22, 8c56f7239e98)
  • Latest-release comparison: The supplied latest release, v2026.9.5, also contains the production dependency override and registry. (src/agents/tools/agent-step.ts:22, ec9c1a13db89)
  • Verified merge scope: The test merge records pinned main first and the exact PR head second. Comparing that result against main preserves the same focused production change; unrelated endpoint drift is not attributed to this PR. (0129a7c11176)
  • Validation identity and limits: The captured PR body reports 135 distinct passing cases and a complete 15-case Gateway comparison: 46.253 seconds baseline and 49.275 seconds candidate. Its candidate tree 5d73d65d657278328a4ff456d42ee58b29e37dd6 matches HEAD. The linked qualification workflow is completed/cancelled, consistent with the body distinguishing retained execution receipts from Actions lifecycle status; it is not independently treated as a passing CI run. This review executed no tests or builds. (5adae3162571)

Likely related people:

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

@steipete
steipete merged commit 24b9d0f into main Sep 21, 2026
265 checks passed
@steipete
steipete deleted the codex/agent-step-test-seam branch September 21, 2026 20:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 21, 2026
Retain the real A2A completion promises until fixture cleanup can join them,
then reset admission, system events, adjusted tool parameters, and the command
spy. Finish the synthetic pending-error run during cleanup after its timeout
assertions. Keep all 82 sessions cases in their original registration order.

The production registry cleanup landed in #155125. This commit preserves the
original #147167 ancestry and addresses its remaining primary-suite lifetime
bug through the existing test fixture owners.

Proof: the actual-tool baseline exposed an unsettled callback after fixture
reset. The candidate handshake passed, as did all 82 original sessions cases,
5 AgentStep cases, and 33 child-coordination cases. All 21 selected checks,
including all 25 core-test type graphs, passed on Blacksmith Testbox. Fresh
Codex P2 review found no actionable findings.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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: 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