Skip to content

fix(agent): remove alphabetical sort to preserve insertion order for primary agents - #34841

Closed
Cretezy wants to merge 1 commit into
anomalyco:devfrom
Cretezy:push-qzskrmyrnuqx
Closed

fix(agent): remove alphabetical sort to preserve insertion order for primary agents#34841
Cretezy wants to merge 1 commit into
anomalyco:devfrom
Cretezy:push-qzskrmyrnuqx

Conversation

@Cretezy

@Cretezy Cretezy commented Jul 2, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #7372

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Removes the secondary alphabetical sort from Agent.list() so primary agents appear in insertion order (built-in first, then user-defined in config declaration order).

Previously, adding a custom "home" agent caused the TUI tab order to become "build" -> "home" -> "plan" instead of the expected "build" -> "plan" -> "home" because h < p alphabetically. Removing the [(x) => x.name, "asc"] sort criterion restores the user's intended ordering.

This PR does not add an explicit ordering field (e.g. order: number) for agents. It simply relies on declaration order in the config, which is the simpler fix and sufficient for the current use case.

How did you verify your code works?

  • Inspected the source: packages/opencode/src/agent/agent.tslist() now sorts only by default agent priority, preserving insertion order for the rest.
  • Tab cycling in the TUI now follows: Build → Plan → Home.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found potentially related PRs:

These PRs suggest there has been prior discussion about controlling agent tab order. Your PR takes a simpler approach by preserving insertion order instead of requiring explicit configuration. Verify whether these older PRs were closed/rejected in favor of the approach your PR implements.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@Cretezy

Cretezy commented Aug 2, 2026

Copy link
Copy Markdown
Author

Still a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Configurable Agent Cycling Order (Tab)

1 participant