Skip to content

test(gateway): isolate embedding cleanup fixture state - #155703

Merged
vincentkoc merged 4 commits into
mainfrom
codex/test-embedding-cleanup-lifetime
Sep 22, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
codex/test-embedding-cleanup-lifetime

Conversation

@steipete

@steipete steipete commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Main now owns embeddings fixture gate release, request joining, provider draining and HTTP server cleanup. Two gaps remain: an early rejected request can leave a one-shot provider mock for the following case, and the created-local row lacks its local descriptor. Its microtask-only check also does not establish that the second request reached admission.

User Impact

Test-only change. The same 43 cases and production behavior remain intact.

Why This Change Was Made

Reset the create, embed and close mocks after provider draining. Register the created-local descriptor and wait for a forwarded real lease-acquisition signal before asserting that replacement is blocked. Reuse all canonical main helpers; remove the earlier PR-only support abstraction.

This narrows the original contribution after main commit 7580300825dc9539139a13d12bb6cccf05adc142 supplied the broader lifecycle repair. Peter Steinberger’s contributor ancestry is preserved. The local-descriptor and real-admission observations incorporate the relevant work from #155658 at d5e9bbaa68e84cc90a073a1274f953d8e8c9e943; main already includes its authenticated disconnect coverage.

Evidence

  • Main-native controls on frozen 05804bcfdad6daa29fba9cf21b100637824fb489: actual HTTP 401 leaves zero factory calls; after real teardown, the next valid HTTP 200 receives stale local/local-embed instead of the requested OpenAI provider. The three post-drain resets make both cases pass.
  • A forwarding observation of the real cleanup predicate reports false for the created-local provider on main and true after descriptor registration. All three cleanup rows pass with actual second-request admission observed. These private controls are absent from the candidate.
  • Fresh independent source review and P0–P3 autoreview have no actionable findings. Formatting and diff checks pass. The final shipping-file run passes all 43 cases in 116.051 seconds wall on macOS/Node 26.7 (one worker).
  • Current-source Linux x64/Node 24.20/Vitest 5 qualification passed: 20/20 full-file runs (43 cases each), 3/3 original 12-file HTTP/models groups (429 cases each), and all 17 provider registry/runtime sibling tests across three files. Retries were disabled; source and lock hashes were checked before completion. The Testbox command exited 0; the owned holder lease was stopped after proof.
  • One-worker candidate wall times were 41–83 seconds (median 51 seconds). The unchanged 05804 main file passed all 43 cases in 47.667 seconds on the same box, after which exact candidate bytes were restored. These observations measure cost; one baseline run does not establish a speedup. The existing full-file suite crosses real HTTP authentication/admission/disconnect and provider cleanup boundaries; helper-only tests cannot establish those orderings. This change adds no cases or server boots.
  • Exact-head hosted CI passed all 25 selected jobs, including the required static, type, lint and security gates. Its affected-file job passed all 43 cases in 76.68 seconds wrapper wall (73.65 seconds Vitest), on Node 24.19. The separate repetition campaign used Node 24.20, matching the retained original failing HTTP/models job.

The prior head a92a6442a166f80f27c119c39754c6577c643380 passed CI run 35735842910. Its separate proof completed three original groups and seven full-file runs before being stopped for the overlapping main repair; run eight was censored. Those results do not qualify this rewritten source. The original CI cleanup callback delay remains unexplained; the controls establish these specific remaining fixture defects.

Additional independent Linux Testbox verification of the same 3bbe5450d56d57422fcd6b91259791724d5704eb source passed all 43 embeddings cases and 17 registry/runtime sibling cases on Node 24.20.0, with no failures or skips. Command wall times were 80.56 seconds and 27.13 seconds respectively; the lease was stopped after artifact export. A separate independent P2 source review completed after the merge with no actionable findings; it is post-merge verification, not a pre-landing gate.

@clawsweeper

clawsweeper Bot commented Sep 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 22, 2026
@steipete
steipete marked this pull request as ready for review September 22, 2026 11:42
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 22, 2026, 10:30 AM ET / 14:30 UTC (Revision 3).

ClawSweeper review

What this changes

The PR clears leftover embedding-provider mocks after cleanup and makes existing HTTP tests observe actual provider admission before checking that cleanup blocks replacement.

Merge readiness

⛔ Needs changes before merge - 1 item remains

The narrowed patch remains useful and has no actionable correctness findings. Current main lacks these fixture corrections; the previously requested Linux qualification remains incomplete.

Priority: P2
Reviewed head: 3bbe5450d56d57422fcd6b91259791724d5704eb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable test repair with useful controls and no identified correctness defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this member-authored test repair. The body records real HTTP fixture controls and a passing candidate suite; the separately requested Linux qualification remains pending. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this member-authored test repair. The body records real HTTP fixture controls and a passing candidate suite; the separately requested Linux qualification remains pending. No stored-data contract changes.
Evidence reviewed 8 items Verified introduced scope: The pinned merge-base-to-head delta changes only the embeddings HTTP test: post-drain mock resets, a local descriptor, and a forwarding admission observer. No production, dependency, workflow, authorization, or persisted-data changes are introduced.
Current main still needs the corrections: Comparison with fetched main retains the same focused test delta. Main has the broader lifecycle cleanup, but lacks these resets, the created-local descriptor, and the three-case admission observation.
Real lifetime owner remains in use: The observer delegates to the original lease acquisition function. That owner records the admission tail before awaiting acquisition; the endpoint decides whether to hold cleanup using the registered provider descriptor. The new local descriptor therefore exercises the intended cleanup branch.
Findings None None.
Security None None.

How this fits together

The Gateway embeddings endpoint converts authenticated HTTP requests into calls to configured embedding providers. These tests exercise provider admission and cleanup through a shared Gateway, using synthetic providers.

flowchart TD
  A[Authenticated test requests] --> B[Gateway embeddings endpoint]
  B --> C[Provider admission queue]
  C --> D[Synthetic embedding provider]
  D --> E[Held cleanup gate]
  E --> C
  C --> F[Admission and response assertions]
  F --> G[Drain providers and reset fixtures]
Loading

Before merge

  • Complete next step (P2) - Complete and record the requested current-source Linux/Node 24.20 qualification: twenty full-file runs, three original 12-file HTTP/models groups, provider registry/runtime siblings, and same-box main/candidate timing with CI duration when available.
Agent review details

Security

None.

PR surface

Tests +15. Total +15 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 16 1 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 16 1 +15

Review metrics

Metric Value Why it matters
Focused validation cost 43 cases passed; 116.051 seconds wall The candidate's reported macOS run preserves the case count; comparable Linux baseline timing is still pending.

Technical review

Best possible solution:

Keep the shared fixture and production lifetime owner, with deterministic admission observation and mock reset only after cleanup settles.

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

Yes, source identifies the missing mock resets and local descriptor, and the body records targeted failing controls on frozen main. This read-only review did not execute tests.

Is this the best way to solve the issue?

Yes. The patch extends existing fixture cleanup and observes the real admission owner without adding production seams, duplicate helpers, or test cases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 092cc29d5e0a.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs bounded Gateway test isolation and regression sensitivity without changing production behavior.
  • 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 external-contributor proof gate does not apply to this member-authored test repair. The body records real HTTP fixture controls and a passing candidate suite; the separately requested Linux qualification remains pending. No stored-data contract changes.

Evidence

What I checked:

  • Verified introduced scope: The pinned merge-base-to-head delta changes only the embeddings HTTP test: post-drain mock resets, a local descriptor, and a forwarding admission observer. No production, dependency, workflow, authorization, or persisted-data changes are introduced. (src/gateway/embeddings-http.test.ts:146, 3bbe5450d56d)
  • Current main still needs the corrections: Comparison with fetched main retains the same focused test delta. Main has the broader lifecycle cleanup, but lacks these resets, the created-local descriptor, and the three-case admission observation. (src/gateway/embeddings-http.test.ts:837, 092cc29d5e0a)
  • Real lifetime owner remains in use: The observer delegates to the original lease acquisition function. That owner records the admission tail before awaiting acquisition; the endpoint decides whether to hold cleanup using the registered provider descriptor. The new local descriptor therefore exercises the intended cleanup branch. (src/gateway/embeddings-provider-lifetime.ts:7, 3bbe5450d56d)
  • Mock reset contract verified: The patch directly uses Vitest mockReset, and the target pins Vitest 5.0.0. Its implementation clears queued one-shot implementations while vi.fn retains its original implementation, so teardown does not erase the providers' default behavior. (packages/spy/src/index.ts:235, f441c6fab25e)
  • Main lifecycle history: Main's recent fixture repair added gate release, lifetime drainage, and authenticated disconnect observation. Local history identified the commit; its raw parent record and GitHub commit patch were inspected. Some older local blobs were unavailable, so deeper local blame did not complete. (src/gateway/embeddings-http.test.ts:140, 7580300825dc)
  • Recorded validation and review continuity: The captured body, confirmed unchanged by a live read, reports main-native stale-mock and cleanup-predicate controls plus 43 passing candidate cases in 116.051 seconds on macOS/Node 26.7. It explicitly leaves Linux/Node 24.20 repetitions, original groups, registry/runtime siblings, and same-box main timing pending. The prior review's corresponding rank-up remains applicable; earlier-head results are not qualification for this rewrite. (3bbe5450d56d)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Record current-source Linux repetitions, original-group and owner-sibling results, and comparable main/candidate timing, including CI duration when available.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-22T12:27:30.090Z sha a6f63f7 :: needs changes before merge. :: none
  • reviewed 2026-09-22T13:53:05.436Z sha a92a644 :: needs changes before merge. :: none

@vincentkoc vincentkoc self-assigned this Sep 22, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review current head adbf9ed948f56e84cb160cc0b9d21f18e3abf00d. The PR body records completed changed-file gates and the reviewed cleanup controls. Required Linux repetitions, owner siblings, before/after timing, and exact-head CI are still pending and must complete before landing.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Please review current head a92a6442a166f80f27c119c39754c6577c643380. This resolves the concrete overlap with landed PR #155677 while preserving its three-case table and the remaining cancellation, mock-reset, authenticated admission and disconnect coverage. Focused proof and independent review pass; current-head CI and the source-bound Linux repetition proof remain pending before landing.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc vincentkoc changed the title fix(test): prevent embeddings cleanup failures from stranding later cases test(gateway): isolate embedding cleanup fixture state Sep 22, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Current head: 3bbe5450d56d57422fcd6b91259791724d5704eb. Main now owns the broader fixture cleanup; this revision retains only three post-drain mock resets, the local descriptor, and real second-request admission observation. The PR body records meaningful main-native controls, 43/43 focused cases, and the remaining Linux repetition proof.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit 6b89bf8 into main Sep 22, 2026
111 of 113 checks passed
@vincentkoc
vincentkoc deleted the codex/test-embedding-cleanup-lifetime branch September 22, 2026 15:14
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
* fix(test): retire held embeddings cleanup after failures

* test(gateway): strengthen embedding cleanup fixture coverage

---------

Co-authored-by: Vincent Koc <[email protected]>
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants