feature: add Codex Fast Mode support#2115
Conversation
|
depends on: PostHog/posthog#58205 |
|
Thread here, do we wanna make the mentioned changes? https://posthog.slack.com/archives/C09G8Q32R6F/p1778278633237439 |
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/agent/src/adapters/codex/codex-agent.ts:899-909
**Duplicate "priority" alias in two normalizers**
`toCodexServiceTier` here and `normalizeServiceTier` in `spawn.ts` both independently map `"priority"` → `"fast"`. If a new alias or tier is added, both functions must be updated in sync. The canonical mapping belongs in one place — the `spawn.ts` normalizer that actually writes the flag to the process args is the logical owner; `toCodexServiceTier` could delegate to it (or to a shared helper) rather than re-implementing the same switch.
### Issue 2 of 2
apps/code/src/main/services/agent/service.ts:1780-1804
**Service tier options defined in two places**
The full three-item options array (standard / fast / flex with their names and descriptions) is duplicated here and in `CODEX_SERVICE_TIER_OPTIONS` in `packages/agent/src/adapters/codex/codex-agent.ts`. If a description or new tier is added in one location, the other must be updated manually. A single exported constant shared by both modules would eliminate the duplication.
Reviews (1): Last reviewed commit: "Send Codex service tier to cloud runs" | Re-trigger Greptile |
| this.codexProcessOptions.serviceTier = previousConfigValue; | ||
| this.sessionState.serviceTier = previousTier; | ||
| this.sessionState.configOptions = this.withCodexServiceTierOption( | ||
| this.sessionState.configOptions, | ||
| ); | ||
| throw error; | ||
| } | ||
|
|
||
| this.sessionState.serviceTier = nextTier; | ||
| this.sessionState.configOptions = this.withCodexServiceTierOption( | ||
| this.sessionState.configOptions, |
There was a problem hiding this comment.
Duplicate "priority" alias in two normalizers
toCodexServiceTier here and normalizeServiceTier in spawn.ts both independently map "priority" → "fast". If a new alias or tier is added, both functions must be updated in sync. The canonical mapping belongs in one place — the spawn.ts normalizer that actually writes the flag to the process args is the logical owner; toCodexServiceTier could delegate to it (or to a shared helper) rather than re-implementing the same switch.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/agent/src/adapters/codex/codex-agent.ts
Line: 899-909
Comment:
**Duplicate "priority" alias in two normalizers**
`toCodexServiceTier` here and `normalizeServiceTier` in `spawn.ts` both independently map `"priority"` → `"fast"`. If a new alias or tier is added, both functions must be updated in sync. The canonical mapping belongs in one place — the `spawn.ts` normalizer that actually writes the flag to the process args is the logical owner; `toCodexServiceTier` could delegate to it (or to a shared helper) rather than re-implementing the same switch.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| configOptions.push({ | ||
| id: "service_tier", | ||
| name: "Speed", | ||
| type: "select", | ||
| currentValue: "standard", | ||
| options: [ | ||
| { | ||
| value: "standard", | ||
| name: "Standard", | ||
| description: "Default Codex service tier", | ||
| }, | ||
| { | ||
| value: "fast", | ||
| name: "Fast", | ||
| description: "Request Codex fast mode for lower latency", | ||
| }, | ||
| { | ||
| value: "flex", | ||
| name: "Flex", | ||
| description: "Request Codex flex mode", | ||
| }, | ||
| ], | ||
| category: "service_tier", | ||
| description: "Choose the Codex service tier for new turns", | ||
| }); |
There was a problem hiding this comment.
Service tier options defined in two places
The full three-item options array (standard / fast / flex with their names and descriptions) is duplicated here and in CODEX_SERVICE_TIER_OPTIONS in packages/agent/src/adapters/codex/codex-agent.ts. If a description or new tier is added in one location, the other must be updated manually. A single exported constant shared by both modules would eliminate the duplication.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/main/services/agent/service.ts
Line: 1780-1804
Comment:
**Service tier options defined in two places**
The full three-item options array (standard / fast / flex with their names and descriptions) is duplicated here and in `CODEX_SERVICE_TIER_OPTIONS` in `packages/agent/src/adapters/codex/codex-agent.ts`. If a description or new tier is added in one location, the other must be updated manually. A single exported constant shared by both modules would eliminate the duplication.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
e84f91f to
147d793
Compare
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Summary