Skip to content

fix: Map priority mode to fast - #327

Merged
benbrandt merged 2 commits into
mainfrom
priority-mode
Nov 9, 2026
Merged

benbrandt merged 2 commits into
mainfrom
priority-mode

Conversation

@benbrandt

@benbrandt benbrandt commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #285.

Codex still normalizes configured fast and priority service tiers to priority in 0.166.0. Recognize both values when initializing Fast mode so the adapter does not mark it off and clear the configured tier on the first prompt.

  • Share the tier check across session creation, resume, history load, and fork, for both ACP v1 and v2.
  • Preserve the app-server string tier in session metadata instead of casting it to the narrower outbound ServiceTier enum. Continue sending the supported fast value for Fast-mode turns.
  • Cover fast, priority, flex, null, and unknown tiers; verify first-prompt behavior in v1 and lifecycle response snapshots over the v2 router, including resume with and without history replay.

Refreshed against current main by merging it into this branch without rewriting the original commit.

Validation

  • npm run typecheck — passed.
  • npm test — 2,504 passed; 39 skipped (159 test files passed, 7 skipped).
  • npm run build — passed.
  • Focused Fast-mode and v2 lifecycle suites — 75 passed.
  • Regression check: temporarily restoring the old fast-only predicate makes all five priority cases fail; restoring the fix makes both focused suites pass.
  • Live Codex 0.166.0 smoke test: configured priority, observed priority in the app-server response, verified Fast mode enabled for new/resume/load/fork, and completed a real prompt sent with serviceTier: "fast".

The dedicated integration and E2E suites were not run; the live smoke test above was run separately.

Copilot AI review requested due to automatic review settings July 22, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an ACP fast-mode regression where Codex normalizes the configured fast tier to the canonical priority tier, causing codex-acp to incorrectly initialize Fast mode as disabled and then clear the session tier on first prompt.

Changes:

  • Treat serviceTier: "priority" as Fast mode enabled when initializing/resuming a session (same as "fast").
  • Introduce a small helper (serviceTierEnablesFast) and a widened tier type (SupportedServiceTier) to represent Codex’s canonical tier value.
  • Add a Vitest case ensuring a priority session tier results in serviceTier: "fast" being sent on the first turn.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/FastModeConfig.ts Adds SupportedServiceTier and serviceTierEnablesFast() to treat "priority" as enabling Fast mode.
src/CodexAcpServer.ts Uses serviceTierEnablesFast() to initialize fastModeEnabled for new/resumed sessions.
src/CodexAcpClient.ts Stores response.serviceTier as SupportedServiceTier in SessionMetadata to preserve "priority".
src/tests/CodexACPAgent/fast-mode-config.test.ts Adds coverage verifying "priority" initializes Fast mode on and triggers serviceTier: "fast" on prompt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@benbrandt
benbrandt merged commit 52cc518 into main Nov 9, 2026
7 checks passed
@benbrandt
benbrandt deleted the priority-mode branch November 9, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fast mode is disabled when Codex reports the canonical priority service tier

2 participants