feat(opencode): add order field to agent config for explicit list sorting#22343
Open
Zireael wants to merge 5 commits intoanomalyco:devfrom
Open
feat(opencode): add order field to agent config for explicit list sorting#22343Zireael wants to merge 5 commits intoanomalyco:devfrom
Zireael wants to merge 5 commits intoanomalyco:devfrom
Conversation
…ting Adds an optional `order` field to Agent.Info and Config.Agent schemas so users and plugins can control agent display order without relying on name-based alphabetical sorting or invisible Unicode characters. Sort precedence: order (asc), default_agent (desc), name (asc).
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #19127: feat(agent): add Why it's related: This PR appears to directly address the same feature—adding an |
6 tasks
Author
|
What's the point of test/e2e (windows)? It runs the code through playwright in browser then times out. Looks like misconfigured test. |
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
I did not raise issue - opening this PR to propose a small enhancement. I can create a tracking issue if required.
Type of change
What does this PR do?
Adds an optional
orderfield to the Agent config schema so users and plugins can explicitly control agent display order in the TUI.Currently, the only way to influence agent position is through alphabetical
namesorting (after the default agent). Plugins like oh-my-opencode work around this by prefixing agent names with zero-width space characters (\u200B) to force sort order, which causes rendering corruption in Windows Terminal (missing characters, shifted UI elements).This change adds a clean, explicit mechanism:
order: z.number().int().optional()on both Config.Agent and Agent.Info schemasAgent.list(): order (asc), then default_agent (desc), then name (asc)Number.MAX_SAFE_INTEGER, preserving existing alphabetical behaviorHow did you verify your code works?
Agent.list respects order field as primary sort key— verifies order overrides default_agent placementagent order can be set from config— verifies config → runtime mergeAgent.list keeps the default agent first and sorts the rest by namestill passes (agents without order tie at MAX_SAFE_INTEGER, then default_agent breaks the tie)Checklist
Files changed
packages/opencode/src/agent/agent.ts— Agent.Info schema, merge loop, list() sortpackages/opencode/src/config/config.ts— Config.Agent schema, transform knownKeyspackages/opencode/test/agent/agent.test.ts— 2 new tests