feat(agent): wire up hog (pi) as a selectable runtime adapter#3264
feat(agent): wire up hog (pi) as a selectable runtime adapter#3264jonathanlab wants to merge 3 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
| // The gateway returns models in an arbitrary order. Sort Claude and hog | ||
| // models oldest-to-newest so the picker is deterministic and the newest | ||
| // model lands at the end of the list, closest to the trigger. | ||
| if (adapter !== "codex") { |
There was a problem hiding this comment.
getClaudeModelRecency sort applied to mixed Claude + OpenAI models in the hog adapter
getClaudeModelRecency uses Claude model naming conventions. For OpenAI model IDs (gpt-*, o*), it almost certainly returns the same default value, so all OpenAI models will cluster together in an undefined order. Sorting the hog adapter's mixed catalogue is fine, but a sort key that is meaningful for all model families would be clearer intent.
| // The gateway returns models in an arbitrary order. Sort Claude and hog | |
| // models oldest-to-newest so the picker is deterministic and the newest | |
| // model lands at the end of the list, closest to the trigger. | |
| if (adapter !== "codex") { | |
| // The gateway returns models in an arbitrary order. Sort Claude models | |
| // oldest-to-newest so the picker is deterministic; OpenAI models returned | |
| // by the hog adapter have no comparable recency function and will cluster | |
| // at the same sort key (keeping their gateway order relative to each other). | |
| if (adapter !== "codex") { |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed: updated the comment to accurately describe the behavior — OpenAI models clustering at the same sort key (no comparable recency function) is expected, not a bug, so this is a clarity fix rather than a logic change.
| function getOtherAdapter(adapter: AgentAdapter): AgentAdapter { | ||
| return adapter === "claude" ? "codex" : "claude"; | ||
| const index = ADAPTER_CYCLE.indexOf(adapter); | ||
| return ADAPTER_CYCLE[(index + 1) % ADAPTER_CYCLE.length]; | ||
| } |
There was a problem hiding this comment.
getOtherAdapter name no longer describes the function's behaviour
After this change the function cycles through a three-element ring rather than returning a binary "other." Calling it getNextAdapter (or getNextAdapterInCycle) would match what the code actually does and avoid confusion for future readers.
| function getOtherAdapter(adapter: AgentAdapter): AgentAdapter { | |
| return adapter === "claude" ? "codex" : "claude"; | |
| const index = ADAPTER_CYCLE.indexOf(adapter); | |
| return ADAPTER_CYCLE[(index + 1) % ADAPTER_CYCLE.length]; | |
| } | |
| function getNextAdapter(adapter: AgentAdapter): AgentAdapter { | |
| const index = ADAPTER_CYCLE.indexOf(adapter); | |
| return ADAPTER_CYCLE[(index + 1) % ADAPTER_CYCLE.length]; | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed: renamed to getNextAdapter, and the local variable/prop usages (otherAdapter -> nextAdapter) for consistency.
- packages/harness/src/acp.ts: stop mapping pi's internal-error stop reason to ACP's "refusal" (which implies a deliberate content-policy decline); map to "end_turn" instead since ACP has no dedicated failure state - packages/workspace-server: clarify the hog-adapter model sort comment (OpenAI models have no comparable recency function and cluster together, which is expected, not a bug) - packages/ui: rename getOtherAdapter -> getNextAdapter now that it cycles through a three-element ring instead of returning a binary other
|
Addressed the greptile P1 finding: |
Problem
Changes
How did you test this?
Automatic notifications