You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Managed policy strips an escaped trailing space from pinned Codex launch arguments. Codex receives a literal backslash instead of the space that normal Codex settings preserve (#48856).
Deterministic repro on origin/main (616ed6a1b4f994baead9bc31da526ecaee6bf9a8)
From the repo root after installing dependencies:
cd apps/server
node --input-type=module <<'JS'import * as Schema from 'effect/Schema';import { ManagedPolicyDocument } from '@t3tools/contracts';import { codexAppServerArgs, resolveCodexLaunchArgs } from './src/provider/codexLaunchArgs.ts';const policy = Schema.decodeUnknownSync(ManagedPolicyDocument)({ schemaVersion: 1, organization: 'Acme', limits: { providers: { instances: { codex: { locked: true, launchArgs: '--cloud-skills-snapshot /tmp/skills.json\\ ' }, } } },});const launchArgs = policy.limits.providers.instances.codex.launchArgs;console.log(JSON.stringify(codexAppServerArgs(resolveCodexLaunchArgs(launchArgs, {}))));JS
Observed: ['app-server', '-c', 'thread_unload_delay_secs=0', '--cloud-skills-snapshot', '/tmp/skills.json\\'] (last argument ends in a literal backslash).
Expected: ['app-server', '-c', 'thread_unload_delay_secs=0', '--cloud-skills-snapshot', '/tmp/skills.json '] (last argument ends in a space).
At startup readManagedPolicyFile decodes the installed policy with this schema. ServerSettings applies the provider overlay, which copies the pin into config.launchArgs; ProviderInstanceRegistry decodes it as Codex settings, and CodexAdapterV2 passes the resulting argv to the app-server child process. The overlay, settings decoder, and argument builder cannot recover the space once the policy decoder removes it.
Change
Decode managed launchArgs with the same escaped-edge trimming as Codex settings, while retaining the existing non-blank check. This fixes the policy input before the server provider overlay; no client, UI, or wire changes are needed.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
The focused ManagedPolicy.test.ts regression failed on base: the overlaid launchArgs ended in \\ instead of \\ in the assertion diff. It passed on the fix.
The before/after runtime transcript shows the real policy file loader, overlay, Codex config decoder, and argv builder. The managed argv changes from a trailing backslash to a trailing space and matches the user settings argv.
vp run check:changed exited 0 via commit-checked.sh: format, lint, Knip, server GraphQL check, 39 package typechecks, and 24 tests across 3 files passed.
Not shown: A live Codex process or an authenticated Codex session, platform-specific spawn behavior, and other providers' argument parsing. No UI changed.
Authored by GPT-6.2 Sol (Codex); reviewed by Claude Opus 5.5 (Model Hub).
Not shown
packages/contracts/src/managedPolicy.ts:32 — managed launchArgs covers every driver, not only Codex. Claude's settings launchArgs (settings.ts:854) is a plain untrimmed Schema.String that is also tokenized (ClaudeSkills.ts:852). So a locked Claude pin ending in \ now keeps its escaped space too. That is consistent and correct, but the PR body says only Codex. Add to Not shown: 'Claude (and other drivers) managed launchArgs pins also keep a trailing escaped space now; only the Codex path was exercised at runtime.'
Macroscope's review found this PR approvable — Managed-policy launch arguments now preserve a trailing escaped space using the existing CLI normalization schema, while still rejecting blank values. Product defaults and policy enforcement remain unchanged.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between edd9ea5 and fa906fa.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The managed policy launch-argument schema now validates values with CliArgsString and isNonBlank. A test checks that applying a locked Codex policy preserves a launch argument ending in an escaped space.
Changes: Managed policy launch arguments
Layer / File(s)
Summary
Launch argument schema and behavior packages/contracts/src/baseSchemas.ts, packages/contracts/src/managedPolicy.ts, apps/server/src/policy/ManagedPolicy.test.ts
isNonBlank is exported and used with CliArgsString to validate launchArgs. A test verifies that policy application preserves a launch argument ending in an escaped space.
Managed launch arguments ending in an escaped space are now preserved instead of being silently trimmed. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: managed policy Codex launch arguments keep a trailing escaped space. It matches the changeset, which makes managed launchArgs decoding preserve escaped-edge trimming a…
Description check
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives a reproduction and expected behavior. The Change section explains the fix location. T…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: managed policy Codex launch arguments keep a trailing escaped space. It matches the changeset, which makes managed launchArgs decoding preserve escaped-edge trimming and adds a regression test. The title is 83 characters and uses the conventional commit format, which is slightly long but acceptable.
Full details: Description check
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives a reproduction and expected behavior. The Change section explains the fix location. The Scope section says why no issue is needed and cites #48856. The Verification section lists focused test results, a runtime transcript, the check run, and items not shown. The description omits the template's agent/model line in the expected form, since it names the model and reviewer. The Not shown section does not mention that managed launchArgs for Claude and other drivers also keep a trailing escaped space, and the Scope section cites no maintainer request, which is acceptable since none was made. The description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 1876a9e and edd9ea5.
Files selected for processing: 3
apps/server/src/policy/ManagedPolicy.test.ts
packages/contracts/src/baseSchemas.ts
packages/contracts/src/managedPolicy.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Created a valid snapshot named skills.json (one trailing space), applied a managed Codex launch argument ending in backslash-space, then opened and reloaded a default Codex thread in each fresh dev app. Real codex-cli 0.174.0; Linux Chromium; light theme; 1280×800 CSS viewport. Base fails the provider probe; head loads the model successfully.
Blank managed launchArgs rejection was not exercised in the real app; this comparison covers the escaped trailing-space regression.
Exact spawned argv, root-owned system policy installation, and a full model turn were not captured; the real provider probe demonstrates the reported file-reading failure and its resolution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Managed policy strips an escaped trailing space from pinned Codex launch arguments. Codex receives a literal backslash instead of the space that normal Codex settings preserve (#48856).
Deterministic repro on
origin/main(616ed6a1b4f994baead9bc31da526ecaee6bf9a8)From the repo root after installing dependencies:
['app-server', '-c', 'thread_unload_delay_secs=0', '--cloud-skills-snapshot', '/tmp/skills.json\\'](last argument ends in a literal backslash).['app-server', '-c', 'thread_unload_delay_secs=0', '--cloud-skills-snapshot', '/tmp/skills.json '](last argument ends in a space).At startup
readManagedPolicyFiledecodes the installed policy with this schema.ServerSettingsapplies the provider overlay, which copies the pin intoconfig.launchArgs;ProviderInstanceRegistrydecodes it as Codex settings, andCodexAdapterV2passes the resulting argv to the app-server child process. The overlay, settings decoder, and argument builder cannot recover the space once the policy decoder removes it.Change
Decode managed
launchArgswith the same escaped-edge trimming as Codex settings, while retaining the existing non-blank check. This fixes the policy input before the server provider overlay; no client, UI, or wire changes are needed.Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
ManagedPolicy.test.tsregression failed on base: the overlaidlaunchArgsended in\\instead of\\in the assertion diff. It passed on the fix.vp run check:changedexited 0 viacommit-checked.sh: format, lint, Knip, server GraphQL check, 39 package typechecks, and 24 tests across 3 files passed.Authored by GPT-6.2 Sol (Codex); reviewed by Claude Opus 5.5 (Model Hub).
Not shown
launchArgscovers every driver, not only Codex. Claude's settingslaunchArgs(settings.ts:854) is a plain untrimmedSchema.Stringthat is also tokenized (ClaudeSkills.ts:852). So a locked Claude pin ending in\now keeps its escaped space too. That is consistent and correct, but the PR body says only Codex. Add to Not shown: 'Claude (and other drivers) managed launchArgs pins also keep a trailing escaped space now; only the Codex path was exercised at runtime.'