fix(tasks): map plan to read-only for codex cloud runs#3322
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "map plan to read-only for codex cloud ru..." | Re-trigger Greptile |
There was a problem hiding this comment.
No showstoppers. The PR correctly maps the "plan" permission mode to "read-only" for codex cloud runs and moves the initial_permission_mode field inside the adapter guard, so it's omitted when no adapter is set. The older bot comment's concern is directly addressed by the current diff, and both the resolver logic and the no-adapter case are covered by new tests.
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
|
Could not verify team-posthog-code membership (GitHub API error). Auto-release is limited to Team PostHog Code members, so this will ship with the next scheduled release instead. |
Problem
Creating a cloud task run with a GPT model fails with a 400 when the permission mode is Plan:
Plan is a valid codex preset locally (the app-server adapter synthesizes it), so the picker offers it and the last-used mode restores it, but the cloud API's
initial_permission_modeenum for codex doesn't accept it. Anyone whose last-used mode is Plan hits this the moment they pick a GPT model. Reported by Daniel in Slack.Changes
Clamp
initial_permission_modeto the API's per-adapter enum inbuildCloudRunRequestBody, the single path every cloud run request goes through (create and resume). Unsupported values degrade to the nearest mode with the same permission ceiling: for codex, plan becomes read-only, bypassPermissions becomes full-access and default/acceptEdits become auto. The claude direction gets the symmetric mapping. Codex-native values pass through unchanged, so this becomes a no-op if the backend later accepts plan for codex.Until then, a codex cloud task started in Plan runs read-only; switching to Plan mid-session still works since that goes over the ACP bridge, not this enum.
How did you test this?
it.eachunit tests covering all adapter/mode combinations inexecution-mode.test.ts, plus aposthog-client.test.tscase asserting codex + plan sendsread-onlyin the request body.@posthog/agent(1179) and@posthog/api-client(72) suites, turbo typecheck and Biome.Automatic notifications