feat: vendor and persist Codex fast mode

This commit is contained in:
叶林立
2026-08-20 00:06:39 +08:00
parent bd7ff978e9
commit d3bf562189
13 changed files with 804 additions and 20 deletions
+44
View File
@@ -0,0 +1,44 @@
# Technical reference: Codex Fast Mode for Pi
Advanced behavior, configuration, compatibility, and troubleshooting for the locally maintained fork.
[Back to README](README.md) · [Development guide](DEVELOPMENT.md) · [Upstream provenance](UPSTREAM.md)
## Commands
- `/fast-mode` — toggle the active branch and global default.
- `/fast-mode on` — enable the active branch and make future sessions default to on.
- `/fast-mode off` — disable the active branch and make future sessions default to off.
- `/fast-mode status` — show both the active branch setting and global default.
Mutation is refused while Pi is busy. Status remains available.
## Persistence
The extension stores the global default in:
```text
<Pi agent dir>/extensions/pi-extension-codex-fast-mode/config.json
```
The file contains a single boolean setting:
```json
{
"enabled": true
}
```
Writes use a temporary file followed by atomic rename. The extension enforces `0700` on the containing directory and `0600` on the file. Missing configuration defaults to off. Malformed or unreadable configuration also fails to off and emits a warning without overwriting the bad file automatically.
Pi custom session entries remain branch-scoped. On session start or tree navigation, the latest valid branch entry overrides the global default. Consequently, resumed historical branches retain their own decision while genuinely new sessions inherit the latest global setting.
## Eligibility and credit use
Fast mode applies only when the selected model has provider `openai-codex` and API `openai-codex-responses`. For eligible plain-object payloads, the extension returns a shallow copy with `service_tier: "priority"`; unsupported providers, APIs, disabled state, and malformed payloads pass through unchanged.
Fast mode expresses request intent and cannot guarantee that the upstream service accepts or provides priority processing. OpenAI controls account and model eligibility, credit multipliers, and current service terms.
## Privacy and limitations
The extension does not inspect credentials, change authentication, choose a model, or make a separate network request. The only additional local data is the boolean global preference. If multiple Pi processes change the setting concurrently, the last successful atomic write becomes the default for future sessions.