Skip to content

Codex alternative agent not opening a session#28

Closed
gokhanpicgeta wants to merge 1 commit into
masterfrom
factory/codex-alternative-agent-not-opening-a-session-8f28fb56
Closed

Codex alternative agent not opening a session#28
gokhanpicgeta wants to merge 1 commit into
masterfrom
factory/codex-alternative-agent-not-opening-a-session-8f28fb56

Conversation

@gokhanpicgeta
Copy link
Copy Markdown
Collaborator

Automated implementation by Silverpond Factory (run 8f28fb56).

## 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.
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