Codex alternative agent not opening a session#28
Closed
gokhanpicgeta wants to merge 1 commit into
Closed
Conversation
## Changes ### `factory/runner.py` - Added rate limit detection in the `watch_task` coder loop. After capturing agent output each iteration, the code now checks `task.coder.rate_limit_markers` against the captured output. If a marker is found and a next agent exists in the list, `current_agent_idx` is incremented and `needs_new_session = True` is set before `continue`-ing to the next iteration. This triggers the existing (but previously unreachable) branch that kills the old session and starts a fresh one with the new agent (e.g. codex). - Updated both `sess.start_session(...)` call sites to pass `agent_cmd=agent_cmd`. ### `factory/session.py` - Added `agent_cmd: str = "claude"` parameter to `start_session`. - For non-claude agents, `start_session` now returns immediately after launching run.sh — skipping the 60-second Claude TUI prompt polling and the instruction paste-buffer (both irrelevant for non-interactive agents like codex that receive their task via command-line argument). ## Root cause `needs_new_session` was initialized to `False` but **never set to `True`** anywhere. The rate limit detection code (described in CLAUDE.md and referenced in the `rate_limit_markers` model field) was completely absent from the main coder loop. When claude hit rate limits, the fallback path fell into `send_feedback_to_session` rather than opening a new codex session. ## Assumptions - Rate limit markers are checked case-insensitively against the full captured output (tmux pane or output.log). - When a rate limit is detected on the final iteration, the loop exits naturally and the run fails — this is acceptable as the agent had no more retries available anyway.
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.
Automated implementation by Silverpond Factory (run
8f28fb56).