Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR loads missing plugin tools asynchronously so PostgreSQL readiness reads run through the existing worker. Example: A PostgreSQL Gateway starts an agent turn with tools.profile set to full and a cold plugin tool.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current PostgreSQL turn-start failure. The previous CI-capacity finding is resolved, and no introduced correctness or security defects remain; exact-head CI is still pending. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAgent tool assembly selects permitted plugin tools, obtains their registrations through the plugin loader, and returns bound tools for the model turn. flowchart LR
A[Agent turn] --> B[Async tool assembly]
B --> C[Plugin tool resolver]
C --> D[Existing async loader]
D --> E[Database readiness worker]
E --> D
D --> F[Bound plugin tools]
F --> G[Model request]
Technical reviewBest possible solution: Carry asynchronous construction through the existing resolver and loader while preserving synchronous callers, workspace readiness, and existing registry ownership. Do we have a high-confidence way to reproduce the issue? Source inspection confirms the cold-load path reaches synchronous database readiness on the Gateway thread, and the contributor reports matching base failures; this read-only review did not execute the reproduction. Is this the best way to solve the issue? The patch repairs the owning construction path with the existing asynchronous loader, covers both workspace-context branches, and preserves the synchronous API without adding another state or policy owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 307d9c45fb25. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +12, Tests +111, Other 0. Total +123 across 11 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 19, 2026, 9:43 AM ET / 14:43 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Summary
High Level TLDR
A healthy PostgreSQL Gateway can reject an agent turn with the full tool profile before contacting the model. Load missing plugin tools through the existing asynchronous loader so their readiness read runs in a worker.
What Problem This Solves
A plugin needed by the turn may not yet be registered in its runtime generation. Cold tool construction then reports
PostgreSQL connections must run in a worker, even though Gateway readiness succeeds.User Impact
Agent turns can load those plugin tools and complete. Synchronous compatibility entry points remain synchronous. This changes no configuration, schema, permissions, retention, or durability.
Why This Change Was Made
Async tool construction now carries its execution mode through the existing tool-resolution generator, including callers without workspace-readiness state. Plugin selection, registry reuse, factories, and tool policy keep their existing owners. The synchronous API selects the existing synchronous loader.
Existing consumer test doubles follow that same generator contract. The database regression reuses the existing forked plugin inspection suite and its fixture. An explicit conformance target keeps both PostgreSQL cases in database CI. One unchanged diagnostic helper moves into the existing tool inspection module to satisfy the source-file size limit.
Root Cause
On the base,
resolvePluginToolsFromRegistrycallsloadPluginRegistryHandlefor missing owners. That synchronous loader skips the readiness worker step and falls back toreadPluginStateMigrationReadinesson the Gateway thread. Opening the PostgreSQL connection there is correctly refused. The asynchronous agent adapter also previously selected the synchronous resolver when no workspace-readiness context existed.The regression runs with the actual Gateway process role on thread zero, prepares metadata as startup does, and loads and invokes a synthetic cold tool. Both PostgreSQL cases fail on the base at
readDeferredPluginMigrations/readPluginStateMigrationReadiness; both SQLite controls pass. Each case uses an independent store and plugin cache.Real behavior proof
RAN on Linux, Node 26.13.1, PostgreSQL 17.12, with a disposable Unix-socket-only server and isolated foreground Gateways. The model endpoint is the repository's loopback OpenAI mock fixture. Configuration uses
tools.profile: "full"and disables memory search.The turn command was:
Temporary session and marker values are placeholders above. On the base, readiness returned
ready: true, the command exited 1 with the worker-only connection error, and the mock received zero requests. With the fix, eight turns completed withstatus: "ok",summary: "completed", and the requested marker in the reply. The SQLite control also completed eight turns.What was not tested
No paid or external model calls, live channels, production state, TLS deployment, other server majors, or database port/upgrade workflow. The mock-backed turns prove tool construction and model reachability, not the functionality of every registered tool. PostgreSQL successful-turn latency has no baseline comparison because the base fails before model dispatch.
Verification
pnpm build, focused consumer tests including prompt-prefix stability, core and changed-test typechecks, targeted lint/format, mock-export ratchet, andgit diff --check.Evidence
Local autoreview of the production repair, P0-P2, reports
scoped-clean. The complete option-construction and loader owners were supplied. Local autoreview of the CI inventory repair also reportsscoped-clean. The current-head diagnostic only adds refusal details to an existing assertion; it changes no expected response, request, wait, retry, or production behavior.CI inventory repair
The first CI run found 78 jobs against the scheduled 77-job cap. The regression now reuses the existing forked inspection suite. No extra host-worker inventory entry or increased limit remains. RAN the four scheduled-capacity cases and eleven conformance-routing cases: all passed.
Repeated Bun failure investigation
Both failed CI attempts tested the same merge commit. Their avatar-subscription test received
ok: false:RAN the actual
scripts/ci-run-node-test-shard.mtsentry with its three-fileagentic-gateway-server-isolated-hosted-3selection, Node 24.22.1 and the checksum-verified repository Bun pin,1.4.4-canary.1+191755ec1. On base3587df70a23, the avatar case passed three of three runs. On PR head271b8a34a6d, it also passed three of three. The full shard had a separate terminal-subagent timeout once on each ref; these are separate outcomes, not avatar failures.Three runs each on CI's exact main parent and tested merge ref also passed the avatar case. A further clean-home, four-CPU run reproduced the exact avatar refusal on the PR head, while its base control passed. Thus the repeated CI failure remains unclassified. No inherited-failure claim is made.
A verified main-branch snapshot contains the same test and passed it:
https://github.com/openclaw/openclaw/actions/runs/44598233217/job/135823119335
The diagnostic commit retains
ok: trueand the same subscribed-session payload assertion while reporting the RPC error code and message when that assertion fails. This is diagnostic evidence collection, not a claimed fix for the CI refusal. Focused lint, formatting and the gateway test typecheck pass. Equivalent temporary assertion diagnostics passed three head and three base Bun shard runs with fresh homes and four CPUs.Current head: 649f80c3e072. Production source remains unchanged.
Current diagnostic CI result
The original avatar case passed in the same three-file Bun group, taking 2.943 s:
https://github.com/openclaw/openclaw/actions/runs/44616678138/job/135888545902
CI also advanced its main base. The pass does not establish that the assertion diagnostic repaired the historical refusal; that cause remains unclassified.
The current run is red on a different test:
session-message-events.history-worker.test.ts > delivers selected-session count updates after worker overloadtimes out:https://github.com/openclaw/openclaw/actions/runs/44616678138/job/135888546116
The CI classifier labels this unknown with no matching job on main. RAN that exact two-file Bun group three times on base and three times on this head: all six local runs passed. These replays do not classify the CI timeout as inherited or fix it. No timeout, retry, expected response, or gate was relaxed. Merge readiness is not claimed. No merge or auto-merge was requested.