feat(agent): add order field for configurable agent cycling order#24691
Open
LCubero wants to merge 1 commit intoanomalyco:devfrom
Open
feat(agent): add order field for configurable agent cycling order#24691LCubero wants to merge 1 commit intoanomalyco:devfrom
LCubero wants to merge 1 commit intoanomalyco:devfrom
Conversation
Adds an optional `order` field (PositiveInt) to agent config so users and plugins can control Tab cycling order. Sorting in Agent.list() becomes: 1. Default agent first (unchanged) 2. By order ascending (new) 3. By name ascending (unchanged fallback) Fully backward-compatible — agents without `order` behave as before. Closes anomalyco#7372
6 tasks
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs Found
Both of these PRs appear to address the same issue (sorting agents by configurable order field instead of alphabetically) that your PR #24691 is implementing. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #7372
Type of change
What does this PR do?
Adds an optional
orderfield (PositiveInt) to agent config so users and plugins can control Tab cycling order instead of being forced into alphabetical sort.Currently
Agent.list()sorts agents alphabetically by name (after the default agent). This breaks plugins that define multiple agents with a specific intended order. For example, oh-my-opencode defines Sisyphus → Hephaestus → Prometheus → Atlas, but alphabetical sort produces Atlas → Hephaestus → Prometheus → Sisyphus.Sorting becomes:
orderascending (new) — agents withoutordergetInfinityFully backward compatible — configs without
orderbehave exactly as before.Changes:
packages/opencode/src/config/agent.ts: Addorderto AgentSchema + KNOWN_KEYSpackages/opencode/src/agent/agent.ts: Addorderto Info schema, merge logic, andsortBypackages/opencode/test/agent/agent.test.ts: Add 2 tests fororderfield sortingHow did you verify your code works?
Two new unit tests cover the behavior:
order: 1, 2, 3appear in that sequence after the default agentorderappear before those without, fall back to alphabeticalThe existing alphabetical sort test was renamed for clarity and still passes. Backward compatibility is verified: agents without
ordersort alphabetically as before.Screenshots / recordings
N/A — no UI changes.
Checklist