Skip to content

test(agents): await fixture-owned runtime cleanup - #165379

Open
vincentkoc wants to merge 1 commit into
mainfrom
test/agent-fixture-cleanup
Open

vincentkoc wants to merge 1 commit into
mainfrom
test/agent-fixture-cleanup

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #156269

Stack 1/19. Base: main; source reviewed on the frozen 0a188c4 prefix.

What Problem This Solves

Runtime test fixtures expose synchronous teardown contracts even when their owners must finish asynchronous cleanup. That makes the admission-settlement change difficult to review independently.

Why This Change Was Made

Give fixture-owned cleanup a Promise contract and await it in the existing callers. Production admission behavior changes in the next slice.

User Impact

No user-visible behavior change; this is the independently usable test preparation for joined admission cleanup.

Evidence

  • Source-reviewed, including independent review; git diff --check passed. AI-assisted changes.
  • Authored regression coverage: Fixture close ordering and retained gate-release assertions were source-reviewed.
  • Pending on this head: focused tests, type/lint checks, and required build validation. Existing results from earlier stack heads are not claimed as exact-head proof.

Production LOC: +2/-2 (net +0); tests/helpers: +229/-208.

Published for review with validation pending. No merge, auto-merge, or deployment is requested.

@clawsweeper

clawsweeper Bot commented Oct 5, 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 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

The PR makes agent test-fixture cleanup return promises and updates test callers to await teardown before resetting shared state or disposing resources.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused cleanup conversion has no identified correctness defect; integration and recorded validation remain unfinished.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR changes repository-local fixture cleanup and test ordering; contributor runtime proof is exempt, while focused teardown validation remains pending. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this member-authored preparation remains useful, and current main still exposes synchronous fixture cleanup. No concrete introduced defect was found, but integration and focused validation remain incomplete.

Priority: P3
Reviewed head: 8031c7d095b7a393aed14691ed893295071b90a2

Before merge

  • Complete next step - Resolve the reported merge conflicts and record focused teardown tests and applicable validation on the integrated head, including wall time and available CI cost.

Findings

None.

Agent review details

How this fits together

Agent runtime fixtures create the admitted authority and host capabilities used by plugin integration tests. Their teardown releases those resources before subsequent tests reuse shared runtime state.

flowchart TD
  A[Agent integration tests] --> B[Runtime fixture]
  B --> C[Admitted run and host capabilities]
  C --> D[Test scenario]
  D --> E[Close host immediately]
  E --> F[Await admission cleanup]
  F --> G[Reset shared test state]
Loading

Technical review

Best possible solution:

Keep fixture cleanup awaitable while preserving immediate host revocation and existing gate-release ordering.

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

Not applicable: this PR prepares test teardown contracts rather than claiming a standalone product bug fix; no tests were executed in this read-only review.

Is this the best way to solve the issue?

Yes: returning fixture-owned cleanup promises and awaiting existing callers is a focused preparation, with production settlement changes reserved for the dependent PR.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4c097a150cab.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: Read the complete introduced diff in bounded path groups. Changes concern fixture cleanup contracts and test callers; production admission policy, dependency sources, workflows, and persisted schemas are unchanged. (src/plugin-sdk/plugin-test-runtime.ts:49, 8031c7d095b7)
  • Current main still needs this preparation: Current main returns a synchronous close callback and invokes admission.close without returning a completion promise. The main host-capability fixture likewise declares closeAdmission as returning void. (src/plugin-sdk/plugin-test-runtime.ts:49, 4c097a150cab)
  • Local test boundary and immediate revocation: The changed callback closes host capabilities synchronously before returning admission cleanup. The unchanged admission owner still revokes its delegated claim synchronously. This preparation does not materially change production authority or the Codex protocol. (src/agents/admitted-run-context.ts:518, 8031c7d095b7)
  • Test helpers are repository-local: The SDK documentation explicitly identifies plugin-test-runtime and agent-runtime-test-contracts as repository-local test helpers that are no longer package exports; this is not a shipped third-party plugin API cutover. Public docs: docs/plugins/sdk-subpaths.md. (docs/plugins/sdk-subpaths.md:180, 8031c7d095b7)
  • Retained lifecycle assertions: The source-lifetime tests continue checking retained authority after foreground closure, subsequent revocation, and release counts. Steering-media changes start closure, release pending work, and then await completion rather than awaiting behind their own unresolved gate. (src/agents/harness/host-capability.source-lifetime.test.ts:80, 8031c7d095b7)
  • Live mergeability: The REST response confirms the reviewed head, MEMBER association, and mergeable=false with mergeable_state=dirty. No pinned integrated merge result is available. (8031c7d095b7)

PR surface

Source 0, Tests +21. Total +21 across 71 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 70 229 208 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 71 231 210 +21

Labels

Label changes:

  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is internal fixture preparation with no introduced user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record focused teardown-test results on the integrated head, including wall time and available CI cost, as requested by the prior review.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-05T06:26:25.140Z sha 8031c7d :: blocked before merge. :: none
  • reviewed 2026-10-05T07:01:20.676Z sha 8031c7d :: blocked before merge. :: none

Reviewed October 5, 2026, 3:54 AM ET / 07:54 UTC (Revision 3).

@openclaw-barnacle openclaw-barnacle Bot closed this Oct 5, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 5, 2026
@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 Oct 5, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Oct 5, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 5, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: acpx extensions: agentsapi extensions: codex extensions: copilot gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants