Fix Codex Minimal Reasoning Effort Execution#2020
Conversation
📝 WalkthroughWalkthroughExtends ChangesCodex Workflow-Level Options and Minimal Effort
Test Environment Variable Isolation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Forward workflow-level Codex options into DAG assistant config - Preserve explicit reasoning effort precedence over preset tiers - Add regression and validation coverage for minimal effort
9b7d934 to
6853b05
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/server/src/routes/api.workflows.test.ts`:
- Around line 16-31: The `originalArchonHome` variable is captured once at
module load time, which means `afterEach` restores a potentially stale value
instead of the test's actual incoming value. Move the `originalArchonHome`
assignment from module scope into the `beforeEach` hook as a `let` variable
instead of `const`, so that each test run captures its own incoming state of
`process.env.ARCHON_HOME` before modifying it. This ensures that `afterEach`
restores the environment to the correct pre-test state for each individual test,
maintaining proper test isolation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3e08bde2-9b16-4405-a3e4-90a97c1af1da
📒 Files selected for processing (9)
packages/adapters/src/forge/github/adapter.test.tspackages/cli/src/commands/ai.test.tspackages/core/src/db/codebases.test.tspackages/providers/src/codex/provider.test.tspackages/server/src/routes/api.providers.test.tspackages/server/src/routes/api.user-ai-prefs.test.tspackages/server/src/routes/api.workflows.test.tspackages/workflows/src/dag-executor.test.tspackages/workflows/src/dag-executor.ts
| const originalArchonHome = process.env.ARCHON_HOME; | ||
| const isolatedArchonHome = join(tmpdir(), 'archon-api-workflows-test-home'); | ||
|
|
||
| beforeEach(async () => { | ||
| await rm(isolatedArchonHome, { recursive: true, force: true }); | ||
| process.env.ARCHON_HOME = isolatedArchonHome; | ||
| }); | ||
|
|
||
| afterEach(async () => { | ||
| await rm(isolatedArchonHome, { recursive: true, force: true }); | ||
| if (originalArchonHome === undefined) { | ||
| delete process.env.ARCHON_HOME; | ||
| } else { | ||
| process.env.ARCHON_HOME = originalArchonHome; | ||
| } | ||
| }); |
There was a problem hiding this comment.
Make ARCHON_HOME snapshot per-test, not module-scoped.
originalArchonHome is captured once at module load (Line 16), so afterEach restores a potentially stale value instead of the test’s incoming value. Capture it inside beforeEach via a mutable let to keep restoration symmetric per test run.
Suggested patch
-const originalArchonHome = process.env.ARCHON_HOME;
+let originalArchonHome: string | undefined;
const isolatedArchonHome = join(tmpdir(), 'archon-api-workflows-test-home');
beforeEach(async () => {
+ originalArchonHome = process.env.ARCHON_HOME;
await rm(isolatedArchonHome, { recursive: true, force: true });
process.env.ARCHON_HOME = isolatedArchonHome;
});As per coding guidelines, “Keep tests deterministic … [and ensure] test isolation.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/server/src/routes/api.workflows.test.ts` around lines 16 - 31, The
`originalArchonHome` variable is captured once at module load time, which means
`afterEach` restores a potentially stale value instead of the test's actual
incoming value. Move the `originalArchonHome` assignment from module scope into
the `beforeEach` hook as a `let` variable instead of `const`, so that each test
run captures its own incoming state of `process.env.ARCHON_HOME` before
modifying it. This ensures that `afterEach` restores the environment to the
correct pre-test state for each individual test, maintaining proper test
isolation.
Source: Coding guidelines
Summary
Describe this PR in 2-5 bullets:
modelReasoningEffort: minimalwere parsed but not forwarded into DAG nodeassistantConfig.minimalreasoning could get a different runtime effort than configured, especially when tier defaults or aliases were involved.modelReasoningEffort,webSearchMode, andadditionalDirectoriestoassistantConfig, with explicit workflow reasoning taking precedence over preset effort.effort, Copilot/OpenCode behavior, Settings UI semantics, docs, generated API types, and unrelated workflow YAML/defaults drift.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory (list every module-to-module edge, mark changes):
workflowSchemaloaderloaderdag-executordag-executorassistantConfigdag-executormodelReasoningEffortblocks preset effort overwrite for Codex.assistantConfigCodexProvidereffort: minimal.Label Snapshot
risk: lowsize: Mworkflows|providers|server|cli|adapters|core|testsworkflows:dag-executor,providers:codex,server:ai-config,cli:ai,tests:validationChange Metadata
bugmultiLinked Issue
1d7c2db9d26534d28e79af44b0d707a6Validation Evidence (required)
Commands and result summary:
bun run type-check bun run lint --max-warnings 0 bun run format:check bun run test bun run build bun run validatebun run testpass with 5135 passed / 0 failed / 17 skipped, build pass, and aggregatebun run validatepass.Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, describe risk and mitigation: N/ACompatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoHuman Verification (required)
What was personally validated beyond CI:
modelReasoningEffort: minimalreachesassistantConfig;webSearchModeandadditionalDirectoriesare forwarded for Codex; built-in Codexsmalltier still routes minimal effort; explicit workflow reasoning wins over preset effort.effort: minimal; per-user tier/alias writes accept Codexeffort: minimal; CLI--effort minimalvalidation accepts Codex.Side Effects / Blast Radius (required)
Rollback Plan (required)
6853b056.minimaleffort fail.Risks and Mitigations
codex.Summary by CodeRabbit
New Features
Tests