[codex] improve Codex plan mode compatibility#538
Open
dsus4wang wants to merge 1 commit intotiann:mainfrom
Open
[codex] improve Codex plan mode compatibility#538dsus4wang wants to merge 1 commit intotiann:mainfrom
dsus4wang wants to merge 1 commit intotiann:mainfrom
Conversation
There was a problem hiding this comment.
Findings
- [Major] Retry predicate catches every collaborationMode error —
message.includes("mode")is always true after the guard acceptscollaborationMode, so unrelated app-server failures that merely mention the field are retried without collaboration mode. That silently downgrades a plan turn into a normal turn instead of surfacing the real failure. Evidencecli/src/codex/codexRemoteLauncher.ts:52
Suggested fix:return message.includes("experimentalapi") || message.includes("unsupported") || message.includes("unknown") || message.includes("unexpected") || message.includes("unrecognized") || message.includes("invalid field");
Summary
- Review mode: initial
- Found one issue in the fallback detection for Codex collaboration mode. Residual test gap: add a negative test where
startTurnfails with a non-compatibility error mentioningcollaborationMode, and assert HAPI does not retry as a normal turn.
Testing
- Not run:
bunnot found on PATH in this runner.
HAPI Bot
| || message.includes('unrecognized') | ||
| || message.includes('invalid') | ||
| || message.includes('field') | ||
| || message.includes('mode'); |
There was a problem hiding this comment.
[Major] message.includes("mode") is always true once the guard has matched collaborationMode, so this retries any app-server error that mentions the field, including non-compatibility failures. That silently resends a plan turn as a normal turn instead of surfacing the actual error.
Suggested fix:
return message.includes("experimentalapi")
|| message.includes("unsupported")
|| message.includes("unknown")
|| message.includes("unexpected")
|| message.includes("unrecognized")
|| message.includes("invalid field");
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Improves Codex plan-mode compatibility when using the app-server runtime.
Changes
collaborationMode/listafter app-server initialization and keeps native plan-mode attempts enabled until the runtime rejects the field.collaborationModewhen the runtime reports the field is unsupported or invalid, with a user-visible fallback message.item/tool/requestApprovalhandling soexit_plan_moderequests flow through Codex permissions.defaultafter an approvedexit_plan_mode/ExitPlanModerequest and immediately emits updated keepalive state.Validation
cd cli && PATH=$HOME/.bun/bin:$PATH bun run test codexRemoteLauncher.test.ts appServerConfig.test.ts appServerPermissionAdapter.test.ts permissionHandler.test.tsPATH=$HOME/.bun/bin:$PATH bun typecheck