Skip to content

Add --codex-model override and resilient done-signal handling#5

Merged
axeldelafosse merged 3 commits intomainfrom
loop-pr-1
Feb 22, 2026
Merged

Add --codex-model override and resilient done-signal handling#5
axeldelafosse merged 3 commits intomainfrom
loop-pr-1

Conversation

@axeldelafosse
Copy link
Copy Markdown
Owner

Summary

This change introduces a new CLI flag to explicitly set the Codex model and relaxes done-signal handling so loop completion is recognized even when the agent exits with a non-zero status.

What changed

  • Added --codex-model <model> to argument parsing.
    • New ValueFlag and parsing path support --codex-model <model> and --codex-model=<model>.
    • Added validation to reject empty values.
    • Documented the flag in README.md and help text (--help output constants).
    • Flag now overrides LOOP_CODEX_MODEL when both are provided.
  • Updated main loop completion semantics:
    • If output contains the done signal, loop terminates as completed before failing on exit code.
    • Keeps done-signal completion compatible with:
      • no reviewer mode (immediate stop)
      • reviewer mode (run review and draft PR path still proceeds when approved)
    • Existing non-done failures still throw as before.
  • Added/updated tests for new arg handling and the new completion behavior when runAgent exits non-zero.

Testing

  • Added/updated tests:
    • tests/loop/args.test.ts
    • tests/loop/main.test.ts

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @axeldelafosse, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the CLI by introducing a new flag to explicitly set the Codex model, providing more granular control over agent behavior. Additionally, it improves the robustness of the main loop by ensuring that task completion is recognized via a 'done' signal, even if the underlying agent process exits with an error code. These changes aim to make the system more flexible and resilient to transient agent failures.

Highlights

  • New CLI Flag: --codex-model: Introduced a new command-line interface flag, --codex-model, allowing users to explicitly specify the Codex model to be used. This flag supports both --codex-model <model> and --codex-model=<model> syntax and includes validation to prevent empty values. It also overrides the LOOP_CODEX_MODEL environment variable if both are provided.
  • Resilient Done-Signal Handling: Updated the main loop completion semantics to recognize the 'done' signal even if the agent exits with a non-zero status. This ensures that the loop terminates as completed if the done signal is present in the output, preventing premature failure due to agent exit codes. This change is compatible with both no-reviewer and reviewer modes.
  • Test Coverage: Added and updated tests in tests/loop/args.test.ts and tests/loop/main.test.ts to cover the new argument parsing for --codex-model and the updated loop completion behavior for resilient done-signal handling.
Changelog
  • README.md
    • Documented the new --codex-model CLI flag in the usage instructions.
  • src/loop/args.ts
    • Added codexModel to applyValueFlag to process the value of the new flag.
    • Implemented validation to ensure the --codex-model value is not empty.
    • Extended consumeArg to parse --codex-model=<model> arguments.
  • src/loop/constants.ts
    • Included --codex-model in the HELP_TEXT for CLI documentation.
    • Added --codex-model to the VALUE_FLAGS map for argument parsing.
  • src/loop/main.ts
    • Introduced helper functions (doneSignalText, doneSignalMissingText, doneSignalPassedText) for consistent logging messages related to done signals.
    • Modified runIterations to check for the done signal before throwing an error for a non-zero exitCode from runAgent.
    • Added a console log message when a done signal is detected despite a non-zero exit code.
    • Refactored runLoop calls to runIterations for cleaner argument passing.
  • src/loop/types.ts
    • Added "codexModel" to the ValueFlag union type.
  • tests/loop/args.test.ts
    • Added a test case to verify parseArgs correctly processes the --codex-model flag.
    • Included a test to confirm that --codex-model= overrides the LOOP_CODEX_MODEL environment variable.
    • Updated an existing comprehensive argument parsing test to include the --codex-model flag.
  • tests/loop/main.test.ts
    • Added a test to ensure runLoop stops on a done signal even if the agent exits non-zero when review is disabled.
    • Introduced a test to confirm runLoop creates a draft PR when a done signal is approved, even if the agent exits non-zero.
Activity
  • Added new tests for argument parsing related to the --codex-model flag.
  • Updated existing tests and added new ones to cover the resilient done-signal handling logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new --codex-model CLI flag for overriding the Codex model and enhances done-signal handling to be more resilient, allowing loop completion even when the agent exits with a non-zero status. The changes are well-tested and documented.

@axeldelafosse axeldelafosse changed the title feat: add --codex-model override and resilient done-signal handling Add --codex-model override and resilient done-signal handling Feb 22, 2026
@axeldelafosse axeldelafosse merged commit 4120210 into main Feb 22, 2026
1 check passed
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.

1 participant