Skip to content

fix: restore Daybreak options for OpenAI API keys - #184451

Merged
VACInc merged 6 commits into
mainfrom
fix/daybreak-options-visibility
Oct 26, 2026
Merged

VACInc merged 6 commits into
mainfrom
fix/daybreak-options-visibility

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Collaborator

Related: #177812

What Problem This Solves

Fixes missing Daybreak Access options when OpenAI uses a configured API key or API-key authentication in the Codex runtime.

User Impact

Eligible accounts can select their advertised Daybreak programs without switching authentication methods. Saved-account selections still take precedence over provider defaults. Unknown, revoked, or other-account grants remain unavailable; custom endpoints do not inherit OpenAI grants.

Why This Change Was Made

Discovery selected a saved profile ahead of an explicitly configured key, while Access projection and embedded execution rejected direct credentials. Native Codex also retained a ChatGPT-only restriction despite the bundled 0.164.0 client supporting API-key programs.

The fix uses the existing discovery, selected-account, and runtime owners. It adds no cache, configuration option, or persistence schema. Explicit account discovery keeps its credential lock and the original request configuration.

Evidence

  • Configured-key discovery and visibility regressions failed before the fix. Focused tests cover discovery, selected-account authority, catalog projection, execution admission, native turn/start boundaries, and native process discovery.
  • All three real Chromium + built Gateway + OpenAI plugin scenarios pass: configured-key selection and serialized Responses submission; direct-credential authority at dispatch; and desktop/mobile subscription queued preferences, clearing Access, and revoked/unknown capabilities. Only external provider I/O is synthetic; no production inference call or live Gateway change was made.
  • Live read-only metadata checks independently confirmed API-key Daybreak Blue availability through the provider endpoint and the actual bundled Codex 0.164.0 model/list.
  • Core, extension, and affected test typechecks, targeted lint/format, changed-file guards, full build, and independent P0–P2 implementation review passed. The selected-account precedence finding was fixed and re-reviewed. The proof follow-up retains the focused captured-guard freshness regression alongside the new end-to-end scenario: the earlier runtime-retirement rejection does not substitute for the final-fetch guard's separate contract.
  • Implementation-head CI passed. ClawSweeper cleared the subsequent final-dispatch proof head with no findings or before-merge items. Its CI run passed every functional job except one unchanged mobile-sharing test; the CI-discovered sharing lifetime repair below is now included. Integrated-head CI and ClawSweeper review are complete; see the final qualification below.

Final qualification

Head 71d8dfe02df61716d9cfccf20ebc03fa60eab501 is conflict-free. CI run 40311562574 completed successfully with all 70 jobs settled and no failures. ClawSweeper's exact-head review has no findings or before-merge items. VACInc merged the qualified head on 2026-10-26 at 11:20 UTC as 02e6a799b59a189bb9e07e297e033ac88bd8a7ae. Deployment is separate and was not performed by this task.

OAuth-refresh conflict resolution

Integrated main at 32db508cbd27482c30ca377d1e829f33f24411e8 in merge commit 71d8dfe02df61716d9cfccf20ebc03fa60eab501, preserving #184364. The shared Access guard now retains both configured-key discovery and the upstream provider-owned same-account check across OAuth refresh. No history was rewritten.

Both affected guard suites pass: 34 tests, including same-account refresh, foreign-account rejection, configured-key grants, and final-dispatch revocation. Core typecheck, targeted lint/format, whitespace checks, and independent P0–P2 review passed on the integrated candidate. Prior browser and upgrade evidence below remains prior-head proof; current-head hosted CI passed and ClawSweeper reported no findings or before-merge items.

CI-discovered sharing lifetime race

Two successive runs failed checks-ui (2/3) on keeps sharing busy through refresh and retires it for a same-key successor, while the Daybreak browser lane passed. The first failure did not identify its assertion. Focused replay, 20 repetitions, the six observed predecessor files, and two-core/three-worker execution passed locally; those passes were not treated as a fix.

The same failure was independently observed in Peter Steinberger's PR #184346. We first reused only its reviewed fixture synchronization from 79ccd0b5cefe91be14ed4db3891dbb96fcdc654f: await pane DOM commit and actual lazy mutation RPC admission. Peter is credited. The added assertion messages then identified the remaining failure in run 40308706575: the successor failed to retire the previous sharing scope. Fixture synchronization alone did not fix that bug.

A deterministic production-path regression now publishes the successor through the canonical session list before delivering the change event. This fails against 6e21487 with the same successor-retirement assertion. The existing row-observation owner was returning early when the canonical list had already projected the successor, because no predecessor row remained to remove; that accidentally skipped retiring the old mutation scope.

The production fix moves the existing retirement call before those projection-cleanup early returns. Active scoped observation callbacks still exclude unresolved and stale bindings. No new state owner, cache, timeout, or permission is introduced. The regression retains every busy-through-refresh and stale-completion assertion, and covers both event-first and canonical-list-first arrival.

The reproduction passes with the fix. All 56 tests across the sharing component, sharing authority, and session-event suites passed in 6.44 seconds. UI production/test typechecks, targeted lint/format, and independent P0–P2 review passed. Hosted CI on the final integrated head passed, including the previously failing UI lane; no failed job was blindly rerun.

Final-dispatch authority proof

The committed ui/src/e2e/chat-daybreak.real-gateway.e2e.test.ts uses real session creation, sessions.patch, models.list, config.patch, the paired Control UI's chat.send, agent.wait, and persisted chat.history. An external synthetic HTTP server records the actual target-model Responses requests. No internal admission decision is mocked.

Case Selected credential capability Independent saved account Observed rejection Target Responses requests
Positive control Configured key A advertises Standard + Blue Available None; request uses key A and access_programs.cyber=daybreak_blue 1
Replace before admission Configured key B advertises no programs Still advertises Standard + Blue not advertised for the current account 0
Replace during preparation Started with key A; pause reached in before_agent_run; replace with key B and refresh before releasing Still advertises Standard + Blue prepared model runtime publication was superseded 0

Both negative runs reached terminal error. The late case asserts the preparation barrier was reached before replacement and that no target request crossed it. The existing runtime owner retires the old prepared credential before transport; its earlier rejection is intentionally asserted rather than mislabeled as an Access error. The independent captured-Access-guard test still checks freshness immediately before request use.

The temporary test plugin explicitly opts into conversation access. Its loopback pause request uses the same isolated Undici dispatcher as the external provider fixture. Earlier fixture attempts exposed a missing hook opt-in and a closed global HTTP pool; both were corrected without changing production guards or weakening the zero-request assertion.

Stable-to-head data compatibility

An isolated install of the official npm [email protected] package (157d8c2) produced and read back:

  • A configured OpenAI API key.
  • A distinct saved API-key profile.
  • An existing session with a user-selected saved-account pin and model/provider overrides.

The candidate opened that same isolated state through the supported Doctor migration. The inherited agent database upgraded from v25 to v37; no schema change is introduced by this PR. Doctor completed with exit 0 after the build was settled. Candidate SDK readers independently resolved the configured key and the pinned saved key, preserved the session ID, model/provider overrides and user pin, then persisted Daybreak Blue and read it back in a new process. A final read after successful Doctor completion preserved all of those values.

The stable baseline predates this Access feature, so the Access field was set only after upgrade; no claim is made that stable could write it. The initial Doctor attempt overlapped a runtime rebuild and encountered missing generated modules; its migration and state readbacks were retained, then the supported command completed successfully against the settled build. All credentials and session content in this probe are synthetic.

Focused proof timing and reproduction

Selected-account regressions: 58 tests, 56.53 seconds including compilation. Native catalog: 15 tests, 49.89 seconds including compilation. Native process regression: 1 test, 77.71 seconds including compilation.

Final browser suite: 3/3 passed, 55.31 seconds wall time. Configured-key flow: 7.529 seconds; final-dispatch authority: 7.473 seconds; subscription desktop/mobile queue flow: 30.068 seconds. The suite shares one Gateway; the longer queue scenario proves real persisted preference changes across two active queued turns and both viewport sizes.

After building the candidate, reproduce with:

OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run \
  --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner \
  ui/src/e2e/chat-daybreak.real-gateway.e2e.test.ts

The suite retains sanitized proof.json with per-case rejection, selected/foreign capabilities and physical request counts. Gateway diagnostics are retained separately as private logs.

Visual evidence

Before: synthetic reproduction of the missing-capability response observed on Team; Access is absent.

Missing Access with the observed metadata shape

After: the isolated built Gateway discovers the configured key's Blue grant and the real UI exposes it.

Configured-key Daybreak Blue appears after discovery

@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 26, 2026 09:27
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling extensions: openai extensions: codex size: M labels Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 71d8dfe02df61716d9cfccf20ebc03fa60eab501
  • Maintainer: @roboclaw-bot
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/models-config.providers.secrets.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Restores advertised Daybreak programs for OpenAI API keys and fixes sharing-scope retirement when a session is replaced.

Example: A configured OpenAI API key advertises Daybreak Blue for gpt-6.1-sol.

  • Before: Access is absent or the selected program is rejected before submission.
  • After: Access exposes Daybreak Blue, and an authorized request includes access_programs.cyber=daybreak_blue.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-level repair with shipped-entry-point evidence, negative authority controls, stable-upgrade preservation evidence, and no actionable finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied built-Gateway Chromium results exercise configured-key discovery, persisted Access selection, serialized Responses submission, foreign-grant rejection, and credential replacement during preparation with zero target requests; inspected screenshots confirm the visible change, and native writer tests support the Codex boundary.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Eligible API-key users cannot select or submit their advertised Daybreak programs.
Reason: The maintainer-authored direction restores useful capability through existing owners, with credential isolation retained and no new setting or storage format.

Merge readiness

✅ Ready for maintainer review

This PR fixes missing API-key Daybreak options and preserves the merged OAuth-refresh repair; no actionable introduced defect was found. Current-head CI remains pending.

Priority: P2
Reviewed head: 71d8dfe02df61716d9cfccf20ebc03fa60eab501

Before merge

None.

Findings

None.

Agent review details

How this fits together

Authenticated provider discovery supplies account-scoped capabilities to model listings and the chat picker; execution rechecks the selected credential, route, and runtime before submitting the program.

flowchart TD
  A[Configured key or selected account] --> B[Authenticated model discovery]
  B --> C[Current runtime catalog]
  C --> D[Gateway model listing]
  D --> E[Chat Access selection]
  E --> F[Execution authority guard]
  C --> F
  F --> G[Responses or Codex turn submission]
Loading

Technical review

Best possible solution:

Land the existing-owner repairs after the exact-head required checks pass.

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

Current-main source excludes direct credentials from Access projection and execution; supplied red/green discovery and visibility results corroborate that path, without this review executing target code.

Is this the best way to solve the issue?

The change repairs existing credential, catalog, and execution owners while preserving selected-account precedence, route isolation, and final-request freshness checks.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Daybreak projection and execution changes intended behavior with a stated reason (ee584a7: Require explicit account/model/runtime grants and keep native API-key execution outside the initial integration scope.)
  • Discovery credential selection keeps the original intent (fix: keep OpenAI model discovery on configured auth profile #137120: Use canonical account ordering and bind discovery to its selected credential; the PR aligns explicit configured-key discovery with execution while retaining locked selected-account discovery.)
  • Saved profile bindings keeps the original intent (31c8052: Resolve provider apiKey profile references as credentials rather than sending profile identifiers as bearer tokens.)
  • OAuth-refresh identity keeps the original intent (32db508: Allow token rotation only for the same provider-owned user/account identity, preserving authoritative empty private catalogs.)
  • Sharing mutation lifetime keeps the original intent (88baa37: Tie sharing mutations to their physical session scope; retirement must occur even when canonical projection already contains the successor.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +54, Tests +460, Docs -1. Total +513 across 19 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 80 26 +54
Tests 10 585 125 +460
Docs 1 6 7 -1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 671 158 +513

Review metrics

Metric Value Why it matters
Production versus test changes Production +80/-26; tests +585/-125 Production growth repairs credential selection and admission; test growth exercises distinct discovery, projection, dispatch-authority, native-protocol, and session-replacement boundaries.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Restores optional advertised Access programs for API-key users without evidence that ordinary model requests are unusable.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (5 earlier review cycles)
  • reviewed 2026-10-26T09:45:56.680Z sha 2b34d86 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-26T10:22:09.572Z sha e9bd60e :: needs maintainer review before merge. :: none
  • reviewed 2026-10-26T10:28:28.330Z sha e9bd60e :: needs maintainer review before merge. :: none
  • reviewed 2026-10-26T10:43:49.103Z sha 6e21487 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-26T10:56:57.705Z sha 02f49d3 :: needs changes before merge. :: none

Reviewed October 26, 2026, 7:04 AM ET / 11:04 UTC (Revision 6).

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
Retire the captured mutation scope when the row owner reports retirement, even if the canonical list already projected the successor and no old row remains to remove. Cover event-first and canonical-list-first ordering without relaxing assertions or timeouts.

Co-authored-by: VACInc <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 26, 2026
Resolve the access-program guard conflict while keeping configured-key discovery and upstream provider-owned OAuth account identity checks.

Co-authored-by: VACInc <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 26, 2026
@VACInc
VACInc enabled auto-merge (squash) October 26, 2026 11:06
@VACInc
VACInc merged commit 02e6a79 into main Oct 26, 2026
126 checks passed
@VACInc
VACInc deleted the fix/daybreak-options-visibility branch October 26, 2026 11:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
* fix: restore Daybreak options for OpenAI API keys

Co-authored-by: VACInc <[email protected]>

* test: qualify Daybreak API-key and subscription flows

Co-authored-by: VACInc <[email protected]>

* test: prove Daybreak credential isolation at dispatch

Co-authored-by: VACInc <[email protected]>

* test: await mobile sharing fixture readiness

Reuse the focused synchronization repair from openclaw#184346 (79ccd0b) after the same UI CI failure. Preserve all assertions and timeouts.

Co-authored-by: Peter Steinberger <[email protected]>

Co-authored-by: VACInc <[email protected]>

* fix(ui): retire sharing scope after session list replacement

Retire the captured mutation scope when the row owner reports retirement, even if the canonical list already projected the successor and no old row remains to remove. Cover event-first and canonical-list-first ordering without relaxing assertions or timeouts.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: VACInc <[email protected]>
roboclaw-bot added a commit that referenced this pull request Oct 27, 2026
Merge pinned official main 02e6a79 to incorporate the named checks-ui prerequisite from #184451. Preserve the reviewed notice patch byte-for-byte; no authored conflict resolution.

Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation extensions: codex extensions: openai gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: L 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