mirror of
https://github.com/mikeyobrien/ralph-orchestrator.git
synced 2026-04-25 23:25:57 +03:00
[PR #42] [MERGED] fix: correct agent validation in _apply_codex_shortcut #108
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ralph-orchestrator#108
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/42
Author: @CoderMageFox
Created: 1/9/2026
Status: ✅ Merged
Merged: 1/10/2026
Merged by: @mikeyobrien
Base:
main← Head:fix/codex-shortcut-agent-validation📝 Commits (1)
024990afix: correct agent validation in _apply_codex_shortcut📊 Changes
1 file changed (+5 additions, -1 deletions)
View changed files
📝
src/ralph_orchestrator/__main__.py(+5 -1)📄 Description
Summary
This PR fixes a bug in the
_apply_codex_shortcutfunction where the--codexflag fails to work correctly when used with therunsubcommand.Problem
When running
ralph run --codex, users encounter the following error:This happens even though no explicit
--agentargument was provided.Root Cause
The issue is in line 45 of
__main__.py:The problem is that
getattr(obj, name, default)only returns thedefaultvalue when the attribute does not exist. However, when the attribute exists but has a value ofNone,getattrreturnsNone, not the default value.Since the
--agentargument is defined withdefault=Nonein argparse:When a user runs
ralph run --codexwithout specifying--agent:args.agentexists and equalsNonegetattr(args, "agent", "auto")returnsNone(not"auto")None not in ("auto", "acp")evaluates toTrueSolution
Replace the problematic
getattrcheck with an explicitNonecheck:This correctly treats
None(no explicit agent specified) as equivalent to"auto".Test Cases
ralph run --codexralph run --codex -a autoralph run --codex -a acpralph run --codex -a claudeAdditional Notes
There is also a related UX issue: the
--codexflag must be placed after therunsubcommand:This is due to argparse subparser behavior and may warrant documentation updates in a future PR.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.