Skip to content

fix(agent): align effort schema with provider-specific capabilities#234

Open
lucas77778 wants to merge 5 commits into
masterfrom
xuan/code-330
Open

fix(agent): align effort schema with provider-specific capabilities#234
lucas77778 wants to merge 5 commits into
masterfrom
xuan/code-330

Conversation

@lucas77778

Copy link
Copy Markdown
Member

Summary

  • extend the normalized effort schema with Codex's distinct ultra level and advertise per-model effort capabilities/defaults
  • parse Codex model/list metadata for pre-session and live catalogs, validating startup and live model/effort selections against the selected model
  • keep Codex ultra separate from Claude's ultracode, update effort filtering/fallbacks, and preserve pending picks across stale settings notifications
  • bump the wire protocol to v44

Verification

  • pnpm test (210 files, 1,634 tests)
  • pnpm check:ci
  • git diff --check
  • verified the supportedReasoningEfforts protocol shape against @openai/codex 0.144.1

Linear: CODE-330

Co-authored-by: Chenyu Lu <chenyu@arcbox.dev>
Copilot AI review requested due to automatic review settings July 21, 2026 10:18
@linear-code

linear-code Bot commented Jul 21, 2026

Copy link
Copy Markdown
CODE-330 fix(agent): align effort schema with provider-specific capabilities

Problem

The normalized effort contract is a single global enum and the UI keeps provider effort choices in static tables. That contract no longer matches the pinned Codex 0.144.1 provider:

  • gpt-5.6-sol and gpt-5.6-terra advertise low | medium | high | xhigh | max | ultra.
  • gpt-5.6-luna advertises low | medium | high | xhigh | max.
  • The generated app-server protocol explicitly directs clients to use effort: "ultra" for proactive multi-agent behavior.
  • packages/schema/src/agent.ts:37 omits Codex ultra.
  • packages/agent-adapter/src/native/codex/adapter.ts:482 rejects max.
  • packages/ui/src/shell/agent-efforts.ts:27 assumes Codex is always low–xhigh.

A configured Codex ultra session can therefore be reflected as the model's low/medium default, and provider-supported choices are unavailable.

Root cause

Effort vocabulary and availability are modeled globally, although they are provider- and model-specific. The adapter already reads model/list, but only retains each model's default effort and discards supportedReasoningEfforts.

Fix

  • Represent Codex ultra distinctly from Claude ultracode.
  • Carry supported/default effort metadata from the provider model catalog through the normalized contract.
  • Validate selections against the active provider/model rather than a global static assumption.
  • Update the wire version and all peers in lockstep.
  • Refresh the adapter documentation from the pinned app-server output.

Acceptance

  • Sol/Terra expose and accept max and ultra; Luna exposes and accepts max but not ultra.
  • Configured/runtime ultra remains truthfully reflected.
  • Claude, Grok Build, and other adapters reject values outside their own capabilities.
  • Tests cover provider/model-specific option sets, startup reflection, live switching, and wire validation.

Evidence

Verified directly against the repository-pinned codex-cli 0.144.1 using app-server generate-ts --experimental and a live model/list request on 2026-07-19.

Review in Linear

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lucas77778
lucas77778 requested review from AprilNEA and Zerlight July 21, 2026 10:20
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR aligns reasoning-effort handling with each provider and model. The main changes are:

  • Adds Codex’s distinct ultra effort level and per-model defaults.
  • Loads Codex model capabilities before and during sessions.
  • Validates model and effort selections against available metadata.
  • Preserves pending selections across stale updates and recovery.
  • Updates UI effort filtering and bumps the wire protocol to v44.

Confidence Score: 5/5

This looks safe to merge.

Optional or empty Codex catalogs no longer block session startup. Pending model selections survive stale updates and process recovery. No blocking issues were found in the changed code.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the project tests with pnpm test and completed with exit status 0 after about 169.5 seconds.
  • Opened the test run log artifact to verify the command output and confirm the successful test run.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
packages/host/agent-adapter/src/native/codex/adapter.ts Adds Codex catalog normalization, capability validation, and pending selection reconciliation.
packages/foundation/schema/src/model/agent/input.ts Adds ultra and per-model default effort metadata to the agent schema.
packages/foundation/schema/src/wire/message.ts Bumps the wire protocol to version 44 for the schema changes.
packages/presentation/ui/src/shell/agent-efforts.ts Builds effort choices from each model’s advertised capabilities.
packages/presentation/ui/src/shell/new-session-surface.tsx Drops remembered efforts that the selected model does not support.

Reviews (5): Last reviewed commit: "fix(agent): resolve effort review blocke..." | Re-trigger Greptile

Comment thread packages/host/agent-adapter/src/native/codex/adapter.ts Outdated
Comment thread packages/host/agent-adapter/src/native/codex/adapter.ts
Co-authored-by: Chenyu Lu <chenyu@arcbox.dev>
Copilot AI review requested due to automatic review settings July 21, 2026 10:53

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread packages/host/agent-adapter/src/native/codex/adapter.ts Outdated
Co-authored-by: Chenyu Lu <chenyu@arcbox.dev>
Copilot AI review requested due to automatic review settings July 21, 2026 11:04

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread packages/host/agent-adapter/src/native/codex/adapter.ts Outdated
Co-authored-by: Chenyu Lu <chenyu@arcbox.dev>
Copilot AI review requested due to automatic review settings July 21, 2026 11:17

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Zerlight Zerlight left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Requesting changes for two correctness issues:

  1. The inline comment covers the live pending-selection lifetime.
  2. The static fallback capability metadata is not used by draft submission. new-session-surface.tsx:169-174 resolves modelOption only from dynamicModels, while this PR adds model-specific fallback capabilities in agent-models.ts:90-108. If model/list is unavailable, a remembered Sol ultra selection can survive after selecting Luna and is submitted even though the fallback table excludes it, causing the first turn to fail. Resolve the selected model from the dynamic catalog or AGENT_MODEL_OPTIONS[provider] consistently before calculating constrainedEffort.

The pinned 0.144.1 protocol shape and CI both check out; these are the remaining blockers.

Comment thread packages/host/agent-adapter/src/native/codex/adapter.ts Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 06:45

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copy link
Copy Markdown
Member Author

Addressed the second review blocker in cd7cb81. NewSessionSurface now resolves the selected model from the non-empty dynamic catalog or the same AGENT_MODEL_OPTIONS[provider] fallback used by Composer, through resolveModel, before calculating constrainedEffort. When model/list is unavailable, switching a remembered Sol/ultra draft to Luna now drops the incompatible effort and omits it from submission. Added a regression for that exact flow. pnpm check:ci and the full suite (210 files / 1,641 tests) pass.

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.

3 participants