Skip to content

feat(agent-priority): inject order field for deterministic agent Tab cycling#2833

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
kuitos:feat/agent-order-support
Mar 25, 2026
Merged

feat(agent-priority): inject order field for deterministic agent Tab cycling#2833
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
kuitos:feat/agent-order-support

Conversation

@kuitos
Copy link
Copy Markdown
Contributor

@kuitos kuitos commented Mar 25, 2026

Summary

  • Inject explicit order field (1-4) into four core agents so Tab cycling order is preserved after OpenCode 1.3.0+ alphabetical sorting
  • Pre-empts upstream support: once anomalyco/opencode#19127 merges, the order takes effect automatically

Problem

OpenCode 1.3.0 introduced alphabetical agent sorting (#18261), which overrides oh-my-opencode's intended agent order. Tab cycle changed from Sisyphus → Hephaestus → Prometheus → Atlas to Sisyphus -> Atlas → Hephaestus → Prometheus.

The existing reorderAgentsByPriority() only controlled object insertion order, which OpenCode's sortBy ignores.

Solution

Refactored reorderAgentsByPriority() to inject an order field into each core agent config:

Agent Order
Sisyphus 1
Hephaestus 2
Prometheus 3
Atlas 4

The order field is part of the upstream PR (anomalyco/opencode#19127, refs #7372). Until merged, the field is harmlessly ignored by OpenCode.

Changes

  • src/plugin-handlers/agent-priority-order.ts: Refactored CORE_AGENT_ORDER to carry order values, added injectOrderField() helper
  • src/plugin-handlers/agent-config-handler.test.ts: Updated test expectation to include injected order field

Summary by cubic

Adds an explicit order field to core agents to enforce deterministic Tab cycling despite OpenCode 1.3.0 alphabetical sorting. Prepares for upstream order support so the order applies automatically when available and is a no-op until then.

  • New Features
    • Assigned order: Sisyphus 1, Hephaestus 2, Prometheus 3, Atlas 4.
    • Refactored reorderAgentsByPriority() to inject order via injectOrderField().
    • Updated tests to expect order on builtin Sisyphus.

Written for commit 5befb60. Summary will update on new commits.

…cycling

Inject an explicit `order` field (1-4) into the four core agents
(Sisyphus, Hephaestus, Prometheus, Atlas) via reorderAgentsByPriority().
This pre-empts OpenCode's alphabetical agent sorting so the intended
Tab cycle order is preserved once OpenCode merges order field support
(anomalyco/opencode#19127).

Refs anomalyco/opencode#7372
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Injecting an 'order' field is a safe, additive change. It restores intended behavior following upstream changes and is designed to be backwards compatible.


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

@code-yeongyu code-yeongyu merged commit 09fb364 into code-yeongyu:dev Mar 25, 2026
2 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@kuitos
Copy link
Copy Markdown
Contributor Author

kuitos commented Mar 26, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Mar 26, 2026
@kuitos kuitos deleted the feat/agent-order-support branch March 26, 2026 09:56
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.

2 participants