Skip to content

fix(decisions): reserve capacity for requested evaluations - #174266

Merged
vincentkoc merged 2 commits into
mainfrom
fix/decision-optional-reservation-20261016
Oct 16, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/decision-optional-reservation-20261016

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Optional tool-prefilter decisions can occupy every provider slot, leaving no capacity for an explicitly requested evaluation.

User Impact

Optional assistance leaves the fourth physical slot available for requested decisions. Under contention the prefilter skips evaluation and retains tools. Existing callers remain requested work by default and retain the four-request limit.

Why This Change Was Made

Add an optional typed priority value to the existing Decision runtime options and enforce it at the provider host's admission owner. Purpose strings remain diagnostic text, not admission policy. Existing physical-settlement ownership continues to retain slots after cancellation until the provider finishes.

This is an additive SDK option, not a configuration key. No queue, concurrency setting, provider route, or timeout default is added.

The original promotion preserved the actual squash of #174027 and the merged credential-isolation repair. During landing, main advanced and introduced a real documentation conflict. This replacement is based on the exact observed conflict anchor 3dd7f576829fd8ec1fd395acb59f3d4f9e999166; it preserves the existing V2 documentation and adds V1/V2 integration coverage rather than treating the new runtime as an unchanged context.

Evidence

  • Exact current head: 1948aee4628d603069662f6274f033016cb86ab8. Root reviewed the full replacement diff and V2 integration, then the mechanical cleanup-variable rename described below. The commits are signed and the source checkout is clean. Fresh scoped autoreview covered the replacement; formatting and diff checks passed.
  • The production admission change remains +8 lines. The replacement retains V2 readiness documentation and adds 93 test lines covering both native and bridged V1/V2 calls, shared optional/requested capacity, abort-ignoring physical settlement, and invalid V2 priority rejection before provider dispatch. No V2 production patch or new configuration was needed.
  • Regression coverage crosses the actual prefilter and registered provider host: three occupied requests reject optional work while requested work uses the fourth slot; canceled work keeps capacity until settlement. Invalid priority is rejected before dispatch.
  • Prior head eb884fc15c83c5c15b99467fe3097e1989840551 passed CI, attempt 1, with 47 successful jobs and 26 skipped. Registered admission tests passed 5/5; applicable Decision/prefilter coverage, build, lint and type checks passed. This is prior-head evidence, not proof for the replacement.
  • Replacement parent 7a1db6cd8aa0a5860765f1902a331ba499d2dcc3 completed CI, attempt 1: 46 successful jobs, 26 skipped, one failed lint job plus its aggregate. Actual Bun shards passed V2 runtime 18 cases, admission 5 cases, prefilter 11 cases and runtime siblings; packaged build and all type checks passed. The real failure was eslint(no-shadow) in the new V2 test's cleanup loop. Current head renames that local binding from callback to releaseGate, with no production or test-behavior change. Fresh exact-head CI is required; the failed parent run is not labeled green.
  • That replacement parent passed Workflow Sanity, including actual SDK surface execution: 155 public entrypoints, 3792 exports, 2205 callable exports, zero wildcard/forbidden subpaths and no unauthorized shipped v2026.10.4 removal. SDK and build inputs are unchanged by the test-local rename; this is explicitly parent-head evidence, not an exact-current-head execution claim.
  • Exact current head 1948aee4628d603069662f6274f033016cb86ab8 passed CI, attempt 1: 48 successful jobs, 26 skipped, no failures. Actual tested merge 12a2265f composed this head with main 971085d5d7b88caa5a2fa8872c4e2243f84b29df. The actual Bun shards passed V2 runtime 18 cases (job), runtime 52 (job), admission 5 (job), and prefilter 11 (job). The corrected lint gate, packaged build, and all type checks passed. The earlier rejected immediate merge intent remains preserved for explicit native replacement recovery; publication itself did not retry that merge.
  • Prior head 88e6284589a6524f4c7381cd177e891b0db5a0a0 retained an inherited three-alias test-type failure, matched to scheduled main run 38875037669 and source blob c729c259dda6ea40dd81954a607d17c4a13986e1. That prior attempt is not claimed as successful or as current-head proof.
  • Production delta: +8 lines; tests: +185 lines; docs: +7 lines. The added contract lets the existing host distinguish optional assistance without inferring policy from diagnostic labels.
  • No live-provider latency or cost result is claimed.

@vincentkoc vincentkoc self-assigned this Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review October 16, 2026 13:47
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reserves one provider slot for requested evaluations by limiting optional prefilter work to three concurrent requests.

Example: Three optional evaluations occupy a provider's four-slot capacity.

  • Before: Another prefilter evaluation can occupy the fourth slot and leave an explicit decision_evaluate request overloaded.
  • After: The prefilter returns overloaded and retains tools, leaving the fourth slot available for the explicit evaluation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The production change appears correct and worthwhile, but behavioral execution is unverified and the failed exact-head type check remains unclassified.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is outside the ordinary contributor proof gate; its body explicitly leaves runtime verification pending and supplies no executed reservation result.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Automatic Decision assistance can consume all provider capacity and prevent an explicitly requested evaluation from running.
Reason: The repair is focused, preserves existing requested behavior, and the maintainer-authored proposal supplies direction for the additive SDK contract.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses current decision-provider contention, and source review found no actionable introduced production bug.

Priority: P2
Reviewed head: 88e6284589a6524f4c7381cd177e891b0db5a0a0

Before merge

None.

Findings

None.

Tests

  • Low-value test src/agents/embedded-agent-runner/run/attempt-decision-prefilter.test.ts: Remove the added priority call-shape expectation: the new registered-provider admission regression already checks its observable effect through the real prefilter.
  • Missing end-to-end proof: No executed reservation scenario or base-fail/head-pass result is supplied; the registered-provider regression remains supporting test design rather than demonstrated runtime behavior.
Agent review details

How this fits together

The Decision runtime validates evaluation options and selects a provider; the provider host owns admission, cancellation settlement, and health, returning typed answers or an unavailable outcome.

flowchart LR
  A[Automatic tool prefilter] --> C[Decision runtime]
  B[Explicit evaluations and plugins] --> C
  C --> D[Provider host admission]
  D --> E[Decision provider]
  E --> F[Physical settlement]
  F --> D
  D --> G[Answers or unavailable outcome]
Loading

Technical review

Best possible solution:

Keep capacity reservation in the existing provider host while preserving requested-call defaults, tool-retaining fallback, and physical-settlement accounting.

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

Current-main source admits four overlapping prefilter evaluations through the shared host, after which an explicit evaluation receives overloaded; this read-only review did not execute target code.

Is this the best way to solve the issue?

A typed distinction enforced by the existing admission owner solves the contention problem without parsing purpose strings, introducing a queue, or releasing canceled providers' slots prematurely.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Provider concurrency admission changes intended behavior with a stated reason (cde6bbd: The original Decision provider feature centralized bounded concurrency, health, cancellation, and lifecycle ownership.)
  • Automatic prefilter evaluations keeps the original intent (2f1f8be: Optional conversational tool filtering retains the normal tool surface when evaluation is unavailable; the PR explains why this opportunistic consumer should leave requested capacity available.)
  • Deadline and physical cleanup contract keeps the original intent (c2d8511: Local inference received a thirty-second maximum while shorter caller deadlines and physical settlement remained enforced.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

  • Introduced admission change: The pinned introduction changes the existing host limit according to a typed priority, marks the prefilter optional, validates priority, and documents the contract without changing cancellation settlement. (src/decisions/provider-host.ts:274, 88e6284589a6)
  • Current main retains contention: Fetched main applies the same four-request threshold to all evaluations, and its prefilter supplies no priority distinction. (src/decisions/provider-host.ts:274, c3798aeb0892)
  • Regression design: The added registered-provider test crosses the real prefilter and admission owner, checks requested fourth-slot admission, and checks that canceled work retains capacity until physical settlement; execution and base-failure results are not supplied. (src/decisions/runtime.admission.test.ts:19, 88e6284589a6)
  • Maintainer-owned SDK direction: The MEMBER-authored proposal explicitly chooses an additive optional priority parameter, preserves requested behavior for existing callers, and accepts reduced optional admission under contention. (src/decisions/types.ts:148, 88e6284589a6)
  • Exact-head CI remains unresolved: check-test-types failed in its check shard, and openclaw/ci-gate reports that failure; production types and the five core test-type checks passed. Annotations contain no compiler diagnostic. The log download redirected to a blocked Azure host, so neither diff attribution nor an inherited cause is established. (88e6284589a6)
  • Stack dependency: This PR targets the open readiness correction at fix(decisions): stop reporting unconfirmed credentials as ready #174027; that correction addresses a separate diagnostic problem and does not implement capacity reservation. (c8a770eac9e7)

Likely related people:

  • Josh Lehman: Raw commit cde6bbd adds src/decisions/provider-host.ts:232 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cde6bbdcfe84; files: src/decisions/provider-host.ts)
  • Mert Başar: Raw commit 2f1f8be adds src/agents/embedded-agent-runner/run/attempt-decision-prefilter.ts:50 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2f1f8beed7a3; files: src/agents/embedded-agent-runner/run/attempt-decision-prefilter.ts)

PR surface

Source +8, Tests +92, Docs +7. Total +107 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 9 1 +8
Tests 2 93 1 +92
Docs 2 12 5 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 114 7 +107

Review metrics

Metric Value Why it matters
Public runtime option One optional SDK parameter: priority The documented requested default preserves existing callers; optional callers receive a lower admission threshold.

Labels

Label changes:

  • add P2: Contention can reject explicit evaluations when optional assistance occupies every provider slot, with limited impact on an optional subsystem.
  • add merge-risk: 🚨 compatibility: The PR adds a public SDK option and changes automatic prefilter admission; the maintainer-authored direction explicitly accepts that behavior while retaining existing callers' four-request limit.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Contention can reject explicit evaluations when optional assistance occupies every provider slot, with limited impact on an optional subsystem.
  • merge-risk: 🚨 compatibility: The PR adds a public SDK option and changes automatic prefilter admission; the maintainer-authored direction explicitly accepts that behavior while retaining existing callers' four-request limit.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Classify the failed check-test-types job and obtain passing affected checks or evidence establishing an inherited failure.
  • Obtain a passing result for the registered-provider reservation and cancellation-settlement regression.

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.

Reviewed October 16, 2026, 10:03 AM ET / 14:03 UTC.

Base automatically changed from fix/decision-readiness-evidence-20261016 to main October 16, 2026 14:36
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime labels Oct 16, 2026
@vincentkoc
vincentkoc force-pushed the fix/decision-optional-reservation-20261016 branch from 88e6284 to eb884fc Compare October 16, 2026 14:44
@openclaw-barnacle openclaw-barnacle Bot removed app: web-ui App: web-ui gateway Gateway runtime labels Oct 16, 2026
@vincentkoc
vincentkoc force-pushed the fix/decision-optional-reservation-20261016 branch from eb884fc to 7a1db6c Compare October 16, 2026 17:28
@vincentkoc
vincentkoc merged commit 6e91ef2 into main Oct 16, 2026
139 of 140 checks passed
@vincentkoc
vincentkoc deleted the fix/decision-optional-reservation-20261016 branch October 16, 2026 17:59
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…174266)

* fix(decisions): reserve capacity for requested evaluations

* test(decisions): avoid shadowing provider callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant