Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ All notable changes to this project will be documented in this file.

## Unreleased

## 1.9.0 - 2026-07-10

- Refactored config precedence to keep explicit runtime mode authoritative and treat spoof mode as compatibility fallback.
- Hardened merged auth state active-account selection to avoid disabled active identity carry-over.
- Simplified request payload transform wrappers to route through one shared aggregate transform pipeline.
- Consolidated account action messaging with shared builders and tightened auth-menu wording consistency.
- Consolidated model-catalog stale-cache fallback emission flow and removed small dead helper modules.
- Added experimental Codex collaboration profile gates (`runtime.collaborationProfile`, `runtime.orchestratorSubagents`) for plan/orchestrator parity.
- Collaboration features now auto-enable by default in `runtime.mode="codex"` and can be explicitly enabled/disabled in any mode.
- Added managed `orchestrator` agent template sync under `~/.config/opencode/agents`, with visibility gated by effective collaboration profile (mode-derived by default, explicitly overridable).
- Synced pinned upstream Codex orchestrator + plan templates into a local prompt cache (ETag/304-aware, TTL refreshed) and used the cached plan prompt to populate plan-mode collaboration instructions.
- Retired the earlier collaboration-profile/orchestrator WIP, including managed prompt sync, collaboration headers, and generated `orchestrator.md` agents.
- Added the replacement GPT-5.6 Ultra agent mode as a WIP behind `runtime.ultra`, defaulting to `false` with provider variants and delegation policy hidden until explicitly enabled.
- Added configurable `runtime.promptCacheKeyStrategy` (`default` | `project`) for session-based or project-path-based prompt cache keying.
- Added quota threshold warnings at `25%`, `20%`, `10%`, `5%`, `2.5%`, `0%` and automatic cooldown/switch when `5h` or `weekly` quota is exhausted.
- Added account selection tracing and per-attempt failover reason codes for snapshot/debug observability.
Expand Down
40 changes: 14 additions & 26 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Known-field type validation is applied on load. If a known field has an invalid
"headerSnapshots": false,
"headerSnapshotBodies": false,
"headerTransformDebug": false,
"ultra": false,
"pidOffset": false
},
"global": {
Expand All @@ -77,8 +78,7 @@ Known-field type validation is applied on load. If a known field has an invalid
Mode-derived runtime defaults when omitted:

- `runtime.codexCompactionOverride`: `true` in `codex`, `false` in `native`
- `runtime.collaborationProfile`: `true` in `codex`, `false` in `native`
- `runtime.orchestratorSubagents`: inherits effective `runtime.collaborationProfile`
- `runtime.ultra`: `false` in every mode

## Settings reference

Expand Down Expand Up @@ -134,14 +134,10 @@ Mode-derived runtime defaults when omitted:
- Adds explicit `before-header-transform` and `after-header-transform` request snapshots for message fetches.
- `runtime.pidOffset: boolean`
- Enables session-aware offset behavior for account selection.
- `runtime.collaborationProfile: boolean`
- Experimental: enables Codex-style collaboration mode mapping from agent names (`plan` -> plan mode, `orchestrator` -> code mode profile).
- If omitted, defaults to `true` in `runtime.mode="codex"` and `false` otherwise.
- Explicit `true`/`false` works in any mode.
- `runtime.orchestratorSubagents: boolean`
- Experimental: enables Codex-style subagent header hints for helper agents under collaboration profile mode.
- If omitted, inherits `runtime.collaborationProfile` effective value.
- Explicit `true`/`false` works in any mode.
- `runtime.ultra: boolean`
- Work in progress. Enables the catalog-gated Ultra agent mode.
- Defaults to `false`; it must be explicitly enabled in any runtime mode.
- When disabled, the `ultra` picker variant is hidden and no delegation policy is injected. Stale literal `ultra` inputs still degrade safely to wire effort `max`.

### Model behavior

Expand All @@ -158,6 +154,11 @@ Mode-derived runtime defaults when omitted:
- Global reasoning effort override forwarded upstream when the request does not already set one.
- When omitted, the selected model's live catalog `default_reasoning_level` is used, typically `"medium"`.
- User config can still override reasoning effort globally, per model, or per variant.
- `ultra` reasoning variant
- Work in progress and available only when `runtime.ultra=true` and the active model advertises `ultra` with `multi_agent_version: "v2"`.
- `codex` mode adds best-effort proactive delegation guidance; `native` mode preserves OpenCode-native prompt identity.
- Literal configured `ultra` values remain safe on unsupported or stale catalogs: the backend request sends wire effort `max`, without proactive delegation.
- There is no public concurrency setting; OpenCode remains responsible for agent execution and lifecycle.
- `global.reasoningMode: "standard" | "pro"` (optional)
- GPT-5.6 reasoning mode, emitted as `reasoning.mode` independently of `reasoning.effort`.
- An explicit request value is preserved. The same per-model and per-variant precedence applies.
Expand Down Expand Up @@ -331,8 +332,7 @@ Advanced path:
- `OPENCODE_OPENAI_MULTI_HEADER_SNAPSHOTS`: `1|0|true|false`.
- `OPENCODE_OPENAI_MULTI_HEADER_SNAPSHOT_BODIES`: `1|0|true|false`.
- `OPENCODE_OPENAI_MULTI_HEADER_TRANSFORM_DEBUG`: `1|0|true|false`.
- `OPENCODE_OPENAI_MULTI_COLLABORATION_PROFILE`: `1|0|true|false`.
- `OPENCODE_OPENAI_MULTI_ORCHESTRATOR_SUBAGENTS`: `1|0|true|false`.
- `OPENCODE_OPENAI_MULTI_ULTRA`: `1|0|true|false` (WIP; defaults to false).

### Debug/OAuth controls

Expand Down Expand Up @@ -362,18 +362,6 @@ Legacy behavior keys are no longer parsed from `codex-config.jsonc`.

Use canonical `global` and `perModel` keys only.

## Managed prompts and orchestrator agent
## Legacy orchestrator cleanup

The plugin synchronizes a pinned upstream Codex orchestrator prompt and plan-mode prompt into a local cache under the resolved config cache root (`$XDG_CONFIG_HOME/opencode/cache/` when `XDG_CONFIG_HOME` is set, otherwise `~/.config/opencode/cache/`):

- `codex-prompts-cache.json`
- `codex-prompts-cache-meta.json` (stores URLs, `lastChecked`, and ETags)

Fetch behavior:

- TTL-based refresh (best-effort; normal requests continue if refresh fails)
- ETag-based revalidation (`If-None-Match` + `304 Not Modified`)

The plan prompt from this cache is used to populate plan-mode collaboration instructions.

When `runtime.collaborationProfile` is enabled, the installer and plugin startup also manage the visibility of an `orchestrator.md` agent template under the resolved config root (`$XDG_CONFIG_HOME/opencode/agents/` when `XDG_CONFIG_HOME` is set, otherwise `~/.config/opencode/agents/`).
The removed orchestrator WIP no longer downloads prompts, injects collaboration headers, or manages an `orchestrator.md` agent. On startup and installer runs, the plugin removes its legacy prompt-cache files and removes legacy agent files only when they contain the plugin-managed orchestrator marker; user-authored files are preserved.
22 changes: 6 additions & 16 deletions docs/development/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ This plugin bridges OpenCode's OpenAI provider hooks to ChatGPT Codex backend en
- request/body transform ownership split by model defaults, service-tier resolution, payload rewrites, and chat hook behavior
- `lib/codex-native/catalog-sync.ts`
- model-catalog bootstrap, auth selection for bootstrap, and per-auth refresh wiring
- `lib/codex-native/collaboration.ts`
- plan-mode, orchestrator, and subagent collaboration instruction injection
- `lib/codex-native/instruction-utils.ts`
- runtime-safe instruction merging and Codex/OpenCode tool-name adaptation
- `lib/codex-native/ultra.ts`, `lib/codex-native/agent-execution.ts`
- WIP Ultra policy, catalog eligibility, and fail-closed root/child/auxiliary classification
- `lib/codex-native/originator.ts`
- originator header resolution (mode-aware `opencode` vs `codex_cli_rs`/`codex_exec`)
- `lib/codex-native/browser.ts`
Expand Down Expand Up @@ -71,10 +73,8 @@ This plugin bridges OpenCode's OpenAI provider hooks to ChatGPT Codex backend en
- tool handler logic for `codex-status`, `codex-switch-accounts`, `codex-toggle-account`, `codex-remove-account`
- `lib/codex-status-tool.ts`, `lib/codex-status-storage.ts`, `lib/codex-status-ui.ts`
- account status/usage tracking, persistence, and display formatting
- `lib/codex-prompts-cache.ts`
- pinned upstream prompt fetch/sync (orchestrator + plan templates) with ETag/TTL refresh
- `lib/orchestrator-agent.ts`
- managed `orchestrator.md` agent template sync and visibility gating
- `lib/legacy-orchestrator-cleanup.ts`
- removal of prompt caches and plugin-managed agent files from the retired orchestrator WIP while preserving user-authored agents
- `lib/quarantine.ts`
- corrupted auth file detection and recovery
- `lib/quota-threshold-alerts.ts`
Expand Down Expand Up @@ -107,16 +107,6 @@ This plugin bridges OpenCode's OpenAI provider hooks to ChatGPT Codex backend en
- plugin-primary account-scoped server catalog cache
- Existing instruction caches (for example `codex-instructions.md` + `codex-instructions-meta.json`) remain separate artifacts under the same cache root.

## Cache files (pinned prompt sync)

- `<config-root>/cache/codex-prompts-cache.json`
- pinned upstream prompt text for:
- Codex orchestrator agent template
- Codex plan-mode collaboration prompt
- `<config-root>/cache/codex-prompts-cache-meta.json`
- prompt-cache metadata (`lastChecked`, URLs, ETags)

Fetch behavior is best-effort and uses ETag/304 revalidation plus a TTL to limit network traffic.
Successful live catalog fetches are source-faithful: the account-scoped `/backend-api/codex/models` payload is cached and handed to provider shaping without field-level merging against the GitHub fallback snapshot. The shared GitHub cache is used only when live catalog data is unavailable.

## Invariants
Expand Down
9 changes: 3 additions & 6 deletions docs/development/CONFIG_FIELDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Top-level:
- Sensitive headers/tokens and selected metadata/query keys are redacted, but prompt/tool payload content may still be present.
- `runtime.headerTransformDebug: boolean`
- `runtime.pidOffset: boolean`
- `runtime.collaborationProfile: boolean`
- `runtime.orchestratorSubagents: boolean`
- `runtime.ultra: boolean` (WIP, default `false`)
- `global.personality: string`
- `global.reasoningEffort: string` (optional)
- When omitted, the selected model's live catalog `default_reasoning_level` is used, typically `"medium"`.
Expand Down Expand Up @@ -108,8 +107,7 @@ Default generated values:
- `runtime.headerSnapshotBodies: false`
- `runtime.headerTransformDebug: false`
- `runtime.pidOffset: false`
- `runtime.collaborationProfile`: mode-derived when unset (`true` in `codex`, `false` in `native`)
- `runtime.orchestratorSubagents`: inherits `runtime.collaborationProfile` effective value when unset
- `runtime.ultra: false`
- `global.personality: "pragmatic"`
- `global.reasoningSummary: "auto"`
- `global.textVerbosity: "default"`
Expand Down Expand Up @@ -158,8 +156,7 @@ Resolved by `resolveConfig`:
- `OPENCODE_OPENAI_MULTI_SERVICE_TIER`
- `OPENCODE_OPENAI_MULTI_PROACTIVE_REFRESH`
- `OPENCODE_OPENAI_MULTI_PROACTIVE_REFRESH_BUFFER_MS`
- `OPENCODE_OPENAI_MULTI_COLLABORATION_PROFILE`
- `OPENCODE_OPENAI_MULTI_ORCHESTRATOR_SUBAGENTS`
- `OPENCODE_OPENAI_MULTI_ULTRA`

Resolved by auth/runtime code (`lib/codex-native.ts` + helper modules under `lib/codex-native/`):

Expand Down
Loading
Loading