Skip to content

improve: verify PostgreSQL plugin completion cancellation and cleanup - #201018

Merged
vincentkoc merged 2 commits into
mainfrom
test/postgres-plugin-completion-lifecycle-20261118
Nov 18, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
test/postgres-plugin-completion-lifecycle-20261118

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #200990
Related: #200991

What Problem This Solves

The PostgreSQL qualification covered prepared completion acquisition and auth-profile bookkeeping, but did not exercise the plugin completion entry point or prove that cancellation keeps asynchronous plugin cleanup attached to its parent operation.

User Impact

No user-visible behavior changes. No SQLite schema version, DDL, migration, persisted-format, configuration, or production code changes.

Why This Change Was Made

Route the existing stored-profile failover and pinning cases through runtime.llm.complete. Keep the configured-key acquisition/disposal cases. Add one PostgreSQL/PostgreSQL cancellation case using a real loopback provider request and a gated plugin lifecycle disposer; verify that parent drainage waits for cleanup. The eight cases reuse the existing three database-pair fixtures and still reject host-thread PostgreSQL access.

This is the next bounded qualification slice from the maintainer-requested PostgreSQL audit. It does not qualify whole-Gateway shutdown or database-connection closure.

Evidence

  • Independent owner and fixture reviews; corrected the drain assertion to keep disposal gated for one event-loop turn.
  • Full local autoreview against base 5e677bad858c331ec7db0a547bebf0b15e4786d4, Codex gpt-6.1-sol, P0–P2: scoped-clean. Runtime success was not inferred from review.
  • Initial exact-head CI executed all eight cases: seven passed; cancellation failed during auth setup before HTTP. The correction declares explicit direct-key auth and omits stored-profile order for configured-key/cancellation fixtures. This also excludes cooldown profiles retained by preceding cases. The corrected head passed all eight completion cases in PostgreSQL shard 3/4, including cancellation and parent-owned disposal.
  • The final auth-fixture correction passed independent review and a second scoped-clean P0–P2 autoreview with the auth planner, selection owner, and shared fixture lifecycle included.
  • Final normal PR CI passed on a1ed2948b23c9eaa4f361dd2a50460d570298b1d: all four PostgreSQL conformance shards, PostgreSQL 16 Gateway smoke (12/12 cases), selected typecheck/lint, changed checks, security, source contracts, boundaries, baseline ratchets, and the final CI gate. The completion shard independently executed and passed all eight completion cases. Both manual runs retain their unrelated full-tree deadcode audit failure; that audit is not counted as passing.
  • Matching pinned formatter and git diff --check: passed. Production LOC delta: 0.
  • No local test execution: this managed checkout has no qualified dependencies. A queued Blacksmith Testbox allocation was stopped and its cleanup reconciled. Exact-head CI owns runtime proof.
  • Current-head ClawSweeper review: zero findings and no remaining before-merge or rank-up requests. Its previously pending broad CI is now complete as linked above.
Dependency-audit attribution

The corrected-head dependency job repeats the original head's deadcode production report failed and deadcode full-tree report failed diagnostics. It reports unused exports in gbrain release helpers, message-tool discovery, session-event delivery, subagent wake scope, hook/metric types, cron UI helpers, and existing agent/session test-support modules; the unused file is test/scripts/pr-cache-deferral.node.mjs.

The reported files, config/knip.config.ts, config/knip-dynamic-consumers.mjs, and scripts/check-deadcode-exports.mts are unchanged from frozen main 5e677bad858c331ec7db0a547bebf0b15e4786d4. The complete PR changes only src/agents/simple-completion-runtime.postgres.test.ts, which is absent from both reports. These existing dead-code findings remain a separate repository-maintenance follow-up; no failed audit is described as green.

@vincentkoc vincentkoc self-assigned this Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 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 agents Agent runtime and tooling size: M labels Nov 18, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR extends PostgreSQL completion tests through the plugin API and verifies that cancellation retains asynchronous cleanup until parent drainage finishes.

Example: Cancel a completion for completion-provider/completion-model after its HTTP request starts.

  • Before: PostgreSQL qualification did not exercise this cancellation and cleanup sequence.
  • After: The test expects an aborted result and verifies that parent drainage waits for the gated plugin disposer.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful production-owner integration coverage with a successful exact-head PostgreSQL shard; proof remains an in-process fixture and broad CI is incomplete.
Proof confidence 🦐 gold shrimp (3/6) This test-only qualification needs no separate shipped-entry-point demonstration; the linked exact-head PostgreSQL shard succeeded.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: PostgreSQL qualification did not cover cancellation retaining plugin cleanup through the plugin completion API.
Reason: The maintainer-authored direction adds a distinct transport and database lifecycle boundary without changing production contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR adds useful PostgreSQL lifecycle coverage, with no actionable code findings; broad CI remains pending.

Priority: P3
Reviewed head: a1ed2948b23c9eaa4f361dd2a50460d570298b1d

Before merge

None.

Findings

None.

Agent review details

How this fits together

The plugin LLM runtime accepts completion requests, acquires provider and credential resources through database workers, calls the HTTP transport, and retains cleanup under the caller's asynchronous work scope.

flowchart TD
  A[Plugin completion request] --> B[Runtime LLM owner]
  B --> C[Prepared model acquisition]
  C --> D[Database workers]
  B --> E[HTTP provider fixture]
  B --> F[Parent work scope]
  F --> G[Plugin lifecycle disposal]
Loading

Technical review

Best possible solution:

Retain this focused qualification extension using the existing completion, database-worker, and lifecycle owners.

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

No production bug is claimed; source inspection confirms the earlier suite lacked the added PostgreSQL plugin-completion cancellation scenario.

Is this the best way to solve the issue?

The change is appropriately scoped: it reuses the existing fixture, strengthens the exercised boundary, and preserves direct acquisition, durable health, pinning, and database-admission coverage.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 75a31ed2854c.

Provenance checked

  • PostgreSQL acquisition and auth-health qualification keeps the original intent (4273141: Qualify stored-profile failover, explicit pinning, and fresh reads of health persisted to the correct database owners.)
  • Configured-key acquisition and release keeps the original intent (b8029b4: Qualify cold provider acquisition across PostgreSQL and mixed stores while enforcing Gateway host-thread restrictions and lease release.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 4273141 adds src/agents/simple-completion-runtime.postgres.test.ts:82 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 427314175240; files: src/agents/simple-completion-runtime.postgres.test.ts)

PR surface

Tests +92. Total +92 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 153 61 +92
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 153 61 +92

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P3: This is test qualification with no production behavior change or confirmed user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 (1 earlier review cycle)
  • reviewed 2026-11-18T05:53:06.696Z sha 5de26cf :: needs maintainer review before merge. :: none

Reviewed November 18, 2026, 1:19 AM ET / 06:19 UTC (Revision 2).

@vincentkoc
vincentkoc marked this pull request as ready for review November 18, 2026 06:14
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Nov 18, 2026
@vincentkoc
vincentkoc enabled auto-merge (squash) November 18, 2026 06:23
@vincentkoc
vincentkoc merged commit c4d8259 into main Nov 18, 2026
263 of 267 checks passed
@vincentkoc
vincentkoc deleted the test/postgres-plugin-completion-lifecycle-20261118 branch November 18, 2026 06:39
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…openclaw#201018)

* test(agents): qualify PostgreSQL plugin completion lifecycle

* test(agents): isolate direct completion auth from stored profiles
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
…#201018)

* test(agents): qualify PostgreSQL plugin completion lifecycle

* test(agents): isolate direct completion auth from stored profiles

(cherry picked from commit c4d8259)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit bc98401829fd0b79f3f7e9c8e80457f7c00907f1)
(cherry picked from commit 057377ddd9556bdc11b8941c497fc2795e319544)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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