Repository navigation
Conversation
[Medium impact] Adds cyber access program selection to OpenAI requests. Not ready to merge: account selection can silently remove the configured access program, and disabling the setting does not affect an existing provider. FindingsFix with agent prompt### Issue 1
crates/jcode-provider-openai-runtime/src/lib.rs:986-987
`reload_cached_reasoning_efforts` loads cyber programs for the globally active account, not the provider's selected account. Selecting another account through `set_oauth_account` therefore loads the wrong program list. If the active account has no cached programs, requests silently omit `access_programs` even when the selected account's catalog lists `daybreak_blue`.
Use `cached_openai_cyber_access_programs_for_scope(&self.catalog_scope())`, as the reasoning-effort lookup already does.
```suggestion
let programs =
jcode_base::provider::cached_openai_cyber_access_programs_for_scope(&self.catalog_scope())
.unwrap_or_default();
```
### Issue 2
crates/jcode-provider-openai-runtime/src/lib.rs:862-867
When a user changes `openai_cyber_access_program` while the provider is running, config reloads but this value remains fixed at construction. Turning the setting `off` leaves subsequent OAuth request payloads sending the old program, and choosing a different program has no effect until the provider is rebuilt. Refresh the selection on reload or read it when building each request; this needs to be resolved before merging.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds an optional cyber access program to OpenAI OAuth requests:
Account-specific reloads still read programs from the globally active account instead of the selected account. The previously reported configuration-reload issue also remains: an existing provider keeps its original program setting, so turning the setting off does not stop it from sending that program. Both issues need to be fixed before merging. T-Rex validation blockedEvidence upload is unavailable because this session has no artifact-upload facility or authorized upload destination. The account-selection regression test executed, but its source, commands, and output could not be uploaded. Reviews (21) · Last reviewed commit: "fix(catalog): refresh snapshots written ..." · Reviewed by Greptile |
|
Added a follow-up commit. A catalog cache written by an older build lacks the new field, and a recent one still counts as fresh, so the setting silently did nothing until the TTL expired. The persisted scope now carries a Note for reviewers: |
| let cyber_access_program = jcode_base::config::config() | ||
| .provider | ||
| .openai_cyber_access_program | ||
| .as_deref() | ||
| .map(|program| program.trim().to_ascii_lowercase()) | ||
| .filter(|program| !program.is_empty() && program != "off" && program != "none"); |
There was a problem hiding this comment.
When a user changes openai_cyber_access_program while the provider is running, config reloads but this value remains fixed at construction. Turning the setting off leaves subsequent OAuth request payloads sending the old program, and choosing a different program has no effect until the provider is rebuilt. Refresh the selection on reload or read it when building each request; this needs to be resolved before merging.
Artifacts
Rust test source for config reload and OpenAI payload construction
- The authored test constructs an existing provider, reloads config, and compares its payload with a fresh provider’s payload without contacting OpenAI.
Command script for the credential-free Rust test
- The executed script copies the runtime crate to a temporary location, appends the test, runs Cargo, and removes the temporary copy.
Initial payload before config reload
- The `before` command passed and captured the existing provider sending `daybreak_blue` under the initial config.
Payloads after off and standard config reloads
- The `after` command passed and captured the existing provider retaining `daybreak_blue` while fresh providers reflected each reloaded selection.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-provider-openai-runtime/src/lib.rs
Line: 871-876
Comment:
**Program setting stays stale**
When a user changes `openai_cyber_access_program` while the provider is running, config reloads but this value remains fixed at construction. Turning the setting `off` leaves subsequent OAuth request payloads sending the old program, and choosing a different program has no effect until the provider is rebuilt. Refresh the selection on reload or read it when building each request; this needs to be resolved before merging.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comments Outside DiffThese findings could not be posted inline.
|
81c647e to
cedc3a9
Compare
7641a7d to
5891b50
Compare
aa40447 to
8c666d2
Compare
580a400 to
779f101
Compare
…odels
ChatGPT/Codex accounts approved for OpenAI's Daybreak program select it
per request with `access_programs: {"cyber": "daybreak_blue"}`, as the
Codex CLI does. The model catalog lists the programs each model accepts
in `available_access_programs.cyber` (gpt-6-sol, gpt-6-luna and the
gpt-5.6 family list daybreak_blue, gpt-6-astra does not, and
gpt-daybreak-blue-latest lists only daybreak_blue).
Parse and cache those per-model programs, and add
`provider.openai_cyber_access_program` (env
JCODE_OPENAI_CYBER_ACCESS_PROGRAM). When set, ChatGPT-mode requests and
persistent WebSocket continuations carry the program only for models
whose catalog entry lists it. Astra and models without catalog data are
unchanged, avoiding the backend's 403 for Astra. Default is unset.
…were persisted A catalog cache written by an older build has no cyber_access_programs, and a recent one counts as fresh, so the configured program would not be sent until the TTL expired. Version the persisted scope and hydrate older snapshots as stale (keeping their real observed_at) so a live refresh runs at once.
779f101 to
d3ab903
Compare
| let programs = | ||
| jcode_base::provider::cached_openai_cyber_access_programs().unwrap_or_default(); |
There was a problem hiding this comment.
Selected account loses Daybreak
reload_cached_reasoning_efforts loads cyber programs for the globally active account, not the provider's selected account. Selecting another account through set_oauth_account therefore loads the wrong program list. If the active account has no cached programs, requests silently omit access_programs even when the selected account's catalog lists daybreak_blue.
Use cached_openai_cyber_access_programs_for_scope(&self.catalog_scope()), as the reasoning-effort lookup already does.
| let programs = | |
| jcode_base::provider::cached_openai_cyber_access_programs().unwrap_or_default(); | |
| let programs = | |
| jcode_base::provider::cached_openai_cyber_access_programs_for_scope(&self.catalog_scope()) | |
| .unwrap_or_default(); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-provider-openai-runtime/src/lib.rs
Line: 986-987
Comment:
**Selected account loses Daybreak**
`reload_cached_reasoning_efforts` loads cyber programs for the globally active account, not the provider's selected account. Selecting another account through `set_oauth_account` therefore loads the wrong program list. If the active account has no cached programs, requests silently omit `access_programs` even when the selected account's catalog lists `daybreak_blue`.
Use `cached_openai_cyber_access_programs_for_scope(&self.catalog_scope())`, as the reasoning-effort lookup already does.
```suggestion
let programs =
jcode_base::provider::cached_openai_cyber_access_programs_for_scope(&self.catalog_scope())
.unwrap_or_default();
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Closes #1506
Change
parse_openai_model_catalogreadsavailable_access_programs.cyberper model. The disk catalog cache stores it, with#[serde(default)]for old files.provider.openai_cyber_access_program(envJCODE_OPENAI_CYBER_ACCESS_PROGRAM,off/noneclears it). It is unset by default, so default requests are unchanged.access_programs: {"cyber": <program>}only if the model's catalog entry lists that program. Persistent WebSocket continuations copy the field, likeservice_tier.Validation
access_programs.jcode-provider-openai-runtimelib: 143 passed. Clippy adds no new warnings.daybreak_blue, gpt-6-sol and gpt-5.6-sol return 200. Astra returns 403, which this PR avoids by gating on the catalog.