Skip to content

feat(openai): support Decisions API - #277

Merged
fuller-stack-dev merged 5 commits into
mainfrom
openclaw/clear-claw
Oct 22, 2026
Merged

fuller-stack-dev merged 5 commits into
mainfrom
openclaw/clear-claw

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add OpenAI Decisions for GPT-6 Luna through unified /v1/decisions, native /v1/native/openai/v1/decisions, and manifest /v1/proxy/openai/decisions routes. Preserve complete upstream JSON (model, typed answers, probabilities, confidence, refusals and usage), typed Boolean/string choices, input images, cache controls, safety identifiers and upstream errors.

Rebased original Hannes/RoboClaw commits faithfully onto main 9de791922fe6f2f7580b15b3073d229a07697a91, including landed redirect protection #288 and previous #292/#293/#297 behavior. No merge or deployment.

  • Luna-only, non-streaming JSON, API-key transport. Existing model/policy checks, revocation, reservations and retention remain authoritative.
  • Endpoint-specific price card openai-gpt-6-luna-decisions-2026-10-21: all input tokens, including cached and cache-written input, cost $0.10/M; the entire request costs $0.20/M above272K. No output charge. Ordinary Luna Chat/Responses tariffs are unchanged.
  • Native catalog facts declare the current400-question limit (choices remain2–255), separately from conversational limits. Upstream owns request/schema validation.

Billing review correction (B1)

The prior head fbc6e673 incorrectly interpreted “no cache-read/write charge” as free cached input. That undercharged all-cache-read/all-cache-write requests and is corrected here. Removed all four zero cache rates so both buckets fall back to the Decisions input rate; versioned the price reference. Removed the no-longer-needed generic settlement relaxation, restoring main's cache-counter requirements. Documentation and this body now state the full-input charge explicitly.

New handler-plus-SQL regressions cover all-cache-read and all-cache-write usage at100,000,272,000 and272,001 input tokens. Both policy and provider ledgers settle respectively10,000,27,200 and54,401micros. The mixed-cache unit case settles100micros, not70.

Cheap review follow-ups also addressed: lifecycle tests assert exact status/error codes and no open reservation; the previously external-only cancel/ingress fixture now has an in-repository real-workerd cancellation regression checking upstream abort, original caller cancellation and conservative settled reservation.

Verification — head a655d746d7deda512287b00df43dc487731163a6

Tree: 9a01a018a61daa247ae64e788872a70acfa1e9d5.

  • RED/GREEN: revert only the four YAML cache-rate lines and regenerate the derived snapshot:7billing tests fail (cached traffic settles0). Restore those lines' removal:24focused handler/workerd tests pass. The generic pricing guard remains restored throughout this isolated RED/GREEN.
  • pnpm check: PASS —1,862Worker,228admin,441script tests;18environment-gated skips. Command-local umask022 preserves the existing load-test permission fixture; no assertion was weakened.
  • pnpm build: PASS — all22provider manifests compiled/validated, admin production build, Worker typecheck and1,862tests.
  • API-only GPT-6.1 Sol/high AutoReview of production repair 09a29742, P0–P2: scoped-clean; final follow-up changes only the cancellation assertion described below. Static review, not independent test execution.
  • Exact-head GitHub CI: PASS — CI run39712929273, both CodeQL analyses and all latest check contexts succeeded. An older duplicate ClawSweeper dispatch was superseded/cancelled; its replacement succeeded. The first Linux run exposed a test-only assumption that ingress request.signal must fire even when the response pump already cancels successfully. The test now requires the actual upstream termination, original caller cancellation, client_error receipt and settled reservation instead of that platform-dependent intermediate signal. Production bytes are unchanged by the follow-up test commit.

Composed native proof and its scope

Previously executed at service fbc6e673 with unchanged OpenClaw main 4d86333f6a82117ede1c530fa0b2a3b70341bcab: actual registered/prepared ClawRouter decision host → real local workerd → synthetic OpenAI, private authority/queue/SQLite ledgers, no mocked Worker/native transport. Required response.model, Boolean/choice/score distributions, refusal sibling and inlinePNG succeeded; distinct router/upstream credentials stayed at their boundaries. A positive evaluation sent exactly one catalog GET and one native POST and settled100micros for1,000uncached input tokens in both ledgers.422 mapped to unsupported-input with no charge; denied catalog and disabled selector dispatched no inference; caller cancel drained activeRequests to0 and retained its dispatched reservation. Local physical cancel propagation was approximately7seconds, not a low-latency guarantee.

This billing repair does not alter that wire/consumer contract. Its new real-workerd and SQL tests above requalify the changed settlement and cancellation paths; the earlier composed run is explicitly prior-head evidence, not falsely claimed as rerun on this head. Native main's200-question cap and256-question V2 host cap have a separately prepared400-question repair at 076d38562a492ae6d1c920118fe22e6c3a6bf85e; the composed400-question call passed with that repair. Native publication/CI is outside this service PR.

Deployment and remaining risk

Not deployed; no paid/live provider call. Exact-head CI is green; maintainer re-review remains the landing gate. Synthetic composition does not qualify hosted deployment, live key grants, real vendor behavior or regional premiums. Missing/oversized/interrupted usage retains reservations; ingress retains its existing8MiB JSON limit. Original native-before-service merge ordering is not retroactively repaired by this work.

Implementation by RoboClaw for Hannes’s request.

Worked on by

Work sessions

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🦞👀
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 added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR adds OpenAI Decisions routing for GPT-6 Luna with endpoint-specific input-only pricing.

Example: POST /v1/decisions with model openai/gpt-6-luna and a damaged-product predicate.

  • Before: The unified Decisions route is unavailable.
  • After: The request reaches OpenAI Decisions and returns typed answers; 1,000 uncached input tokens settle at 100 micros.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, source-consistent implementation with meaningful harness coverage; supplied evidence does not establish end-to-end upstream behavior.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer/bot classification exempts this PR from the ordinary contributor proof gate; inspected coverage uses Worker handlers and local SQL ledgers with mocked upstream responses, while the body supplies no Decisions-specific shipped-entry-point trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: SDK clients using ClawRouter cannot call OpenAI Decisions through their configured router base URL.
Reason: The supplied maintainer-authored classification establishes direction, and the dedicated upstream contract needs routing and pricing that existing Responses support cannot supply.

Merge readiness

✅ Ready for maintainer review

Keep open: current main lacks Decisions support, and this maintainer-directed PR provides a focused implementation with no concrete correctness finding.

Priority: P2
Reviewed head: cc31b93f2458828f18a70fbdd450c759692ed95e

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied artifact shows a Decisions request through the shipped server or SDK with upstream output and resulting ledger settlement.
Agent review details

How this fits together

The Worker accepts authenticated client requests, selects manifest endpoints and credentials, enforces budgets, forwards provider traffic, and constructs usage events.

flowchart LR
Client --> Worker
Worker --> PolicyChecks
PolicyChecks --> EndpointSelection
EndpointSelection --> BudgetLedger
BudgetLedger --> OpenAI
OpenAI --> UsageSettlement
UsageSettlement --> Client
Loading

Technical review

Best possible solution:

Land the manifest-based endpoint and shared endpoint-price selection while preserving existing authorization, ledger ownership, and Chat/Responses tariffs.

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

Current-main source confirms that /v1/decisions has no unified routing entry; no target code was executed.

Is this the best way to solve the issue?

The implementation fits the manifest-first architecture and resolves endpoint pricing through existing selection and affordability owners without adding another proxy path.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Missing capability on main: The default-branch capability and unified-path mappings contain Chat, Responses, embeddings, and speech, but no Decisions route. (worker/providers.ts:102, c153989041f0)
  • Manifest-owned implementation: Decisions is declared as a separate JSON endpoint, supported only by Luna, with its own price card; existing model prices remain intact. (providers/openai.provider.yaml:126, cc31b93f2458)
  • Official upstream contract: The OpenAI Decisions guide confirms the dedicated Luna endpoint, typed answers, input-only billing, and applicable long-context multipliers.
  • Shared accounting repair: Settlement permits an omitted cache-write counter only when its declared rate is zero; positive-rate counter requirements remain. (worker/pricing.ts:149, cc31b93f2458)
  • Authorization and dispatch owners: The new endpoint uses existing model-policy checks, scoped credential selection, transport eligibility, budget admission, and the common upstream fetch. (worker/proxy.ts:471, cc31b93f2458)
  • Behavioral coverage and its boundary: Added tests exercise all three Worker routes and SQL budget settlement, but replace the upstream fetch; lifecycle cases reject invalid credentials, unsupported models, and exhausted budgets before dispatch. (worker/test/decisions-proxy.test.mjs:104, cc31b93f2458)

Likely related people:

  • Vincent Koc: Raw commit da3885d adds worker/providers.ts:70 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: da3885d1d17c; files: worker/providers.ts)

Labels

Label changes:

  • add P2: Useful provider capability addition with a bounded scope and no demonstrated urgent regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Useful provider capability addition with a bounded scope and no demonstrated urgent regression.
  • 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.

Rank-up moves

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

  • Capture a redacted SDK Decisions request through the shipped Worker, showing typed answers and matching input-only ledger settlement.

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 20, 2026, 5:11 PM ET / 21:11 UTC.

roboclaw-bot and others added 4 commits October 21, 2026 20:28
Route GPT-6 Luna Decisions requests with endpoint-specific input-only pricing and existing policy, grant, and budget enforcement. Cover typed answer forwarding, conservative failure accounting, discovery, and omitted cache-write counters in reserve and soft modes.

Co-authored-by: hannesrudolph <49103247+hannesrudolph@users.noreply.github.com>
Worked on by:
- @hannesrudolph

Co-authored-by: hannesrudolph <49103247+hannesrudolph@users.noreply.github.com>
OpenClaw-Publication: d4c4ba0e-1810-45fd-a994-20a9227565aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

3 participants