Skip to content

fix(opencode): stabilize Agent Builder /agents flow - #314

Merged
nicko-ai merged 11 commits into
devfrom
codex/agent-builder-e2e-scenarios
Jul 10, 2026
Merged

fix(opencode): stabilize Agent Builder /agents flow#314
nicko-ai merged 11 commits into
devfrom
codex/agent-builder-e2e-scenarios

Conversation

@nicko-ai

@nicko-ai nicko-ai commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #313

Type of change

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

What does this PR do?

This PR makes /agents the Agent Builder control point for Plan, Build, Run, and Run-mode swarm targets.

  • Moves Plan, Build, and Run selection into /agents and removes the separate /modes dialog.
  • Keeps Plan and Build on native OpenCode routing with Agent Swarm guidance, native commands, selected OpenCode agents, shell sessions, and compaction behavior.
  • Keeps Run server-backed through Agency Swarm, with Plan and Build shown above live swarms and agents in the Run picker.
  • Shows a visible Starting... state while /agents starts or reconnects local Run, so the TUI does not look frozen.
  • Makes Tab toggle Build and Plan outside Run, while Run keeps Tab for swarm and agent target switching.
  • Recovers Plan handoff questions across sync/startup, routes answers to the right workspace, and keeps approval/decline mode transitions aligned.
  • Opens Build with a prefilled startup error when a detected local project cannot import or start, then lets the user switch back to Run for the repaired same project.
  • Prevents stale OPENCODE_CONFIG_CONTENT and enabled_providers / disabled_providers state from overriding repaired local Run config, while preserving explicit /connect choices from the Build fallback.
  • Updates README, USER_FLOWS.md, FORK_CHANGELOG.md, QA coverage notes, terminal E2E coverage, sync/npx tests, and the Agent Swarm E2E CI timeout for the larger suite.

How did you verify your code works?

The diff adds or updates coverage for /agents mode rows, native Plan/Build routing, Run server-backed routing, visible Run startup feedback, Tab behavior, Plan handoff approval/decline/recovery, startup/import failure fallback into Build, same-project Run after Build repair, stale env config and provider filter handling, dead Run server repair, and pending-question workspace routing.

Latest local proof on head 00e474707:

  • bun test --timeout 240000 --max-concurrency=1 ../../e2e/agent-swarm-tui/terminal-tui.test.ts -t "launcher opens Build after startup failure and restarts repaired local Run from stale env config" passed.
  • Exact rebuilt Darwin arm64 binary passed the same focused E2E with AGENTSWARM_TUI_E2E_BINARY_PATH=/Users/nick2/.codex/worktrees/pr314-agent-builder-final/agentswarm-cli/packages/opencode/dist/agentswarm-cli-darwin-arm64/bin/agentswarm.
  • bun test test/cli/tui/dialog-agent.test.tsx --timeout 30000 passed.
  • bun typecheck from packages/opencode passed.
  • bun x prettier --check FORK_CHANGELOG.md USER_FLOWS.md e2e/agent-swarm-tui/terminal-tui.test.ts packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx passed.
  • git diff --check passed.
  • bun run build rebuilt the Darwin arm64 binary; agentswarm --version returned 1.4.26.
  • Pre-push bun turbo typecheck passed.
  • Local Codex review against origin/dev reported no actionable correctness issues.
  • User QA approved the rebuilt binary for the Run startup loading state.

Hosted checks remain the live source of truth for CI status on each PR head.

Screenshots / recordings

N/A. This is terminal TUI behavior covered by terminal E2E tests.

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@nicko-ai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 406ceaac45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

nicko-ai added a commit that referenced this pull request Jul 1, 2026
- Hosted PR #314 run 28459035332 job 84341579388 failed because the Run Agent Swarm e2e tests step timed out after 10 minutes.

- The uploaded JUnit report for that run shows 66 tests, 65 passed, 1 skipped, 0 failed, and 612.534s elapsed, so the failure is CI budget rather than a test assertion failure.

- git blame traces the timeout to fork-owned commit 5cc1a69 (ci: run Agent Swarm TUI e2e tests); upstream/dev has no Agent Swarm e2e job.

- PR #314 adds Agent Builder mode and Plan handoff coverage, so raise only the Agent Swarm e2e step timeout to 20 minutes and keep the test command unchanged.
nicko-ai added a commit that referenced this pull request Jul 1, 2026
Refs #314.

Wait for the recovered Build follow-up request after the startup Plan approval point while still asserting that the recovered prompt text reaches the native request. This keeps the e2e proof stable without weakening the Plan-to-Build routing assertion.
@nicko-ai

nicko-ai commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 1e45bb13c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

nicko-ai added a commit that referenced this pull request Jul 1, 2026
- Hosted PR #314 run 28459035332 job 84341579388 failed because the Run Agent Swarm e2e tests step timed out after 10 minutes.

- The uploaded JUnit report for that run shows 66 tests, 65 passed, 1 skipped, 0 failed, and 612.534s elapsed, so the failure is CI budget rather than a test assertion failure.

- git blame traces the timeout to fork-owned commit 5cc1a69 (ci: run Agent Swarm TUI e2e tests); upstream/dev has no Agent Swarm e2e job.

- PR #314 adds Agent Builder mode and Plan handoff coverage, so raise only the Agent Swarm e2e step timeout to 20 minutes and keep the test command unchanged.
@nicko-ai
nicko-ai force-pushed the codex/agent-builder-e2e-scenarios branch from 1e45bb1 to 63678b1 Compare July 1, 2026 05:35
nicko-ai added a commit that referenced this pull request Jul 1, 2026
Refs #314.

Wait for the recovered Build follow-up request after the startup Plan approval point while still asserting that the recovered prompt text reaches the native request. This keeps the e2e proof stable without weakening the Plan-to-Build routing assertion.
@nicko-ai nicko-ai changed the title fix(opencode): recover Plan handoff prompts fix(opencode): finalize Agent Builder agent picker Jul 1, 2026
@nicko-ai
nicko-ai force-pushed the codex/agent-builder-e2e-scenarios branch 4 times, most recently from 707d7f7 to 5d334d3 Compare July 1, 2026 06:33
@nicko-ai nicko-ai changed the title fix(opencode): finalize Agent Builder agent picker fix(opencode): stabilize Agent Builder /agents flow Jul 1, 2026
nicko-ai added 7 commits July 5, 2026 03:54
- clean stale mode command assertions and docs wording

- add focused TUI E2E for server-free Build/Plan, compact, reopen, and dead Run fallback

- keep Tab scoped to agent switching inside the current mode
- hydrate pending TUI questions from question.list during sync

- cover startup Plan handoff when the live question event is missed
- Recover missed pending Plan approval questions on active session reopen

- Keep question recovery best-effort and workspace-routed

- Cover repeated-arrow approval, declined approval, stale question sync, and missed-event recovery
- Hosted PR #314 run 28459035332 job 84341579388 failed because the Run Agent Swarm e2e tests step timed out after 10 minutes.

- The uploaded JUnit report for that run shows 66 tests, 65 passed, 1 skipped, 0 failed, and 612.534s elapsed, so the failure is CI budget rather than a test assertion failure.

- git blame traces the timeout to fork-owned commit 5cc1a69 (ci: run Agent Swarm TUI e2e tests); upstream/dev has no Agent Swarm e2e job.

- PR #314 adds Agent Builder mode and Plan handoff coverage, so raise only the Agent Swarm e2e step timeout to 20 minutes and keep the test command unchanged.
Refs #314.

Wait for the recovered Build follow-up request after the startup Plan approval point while still asserting that the recovered prompt text reaches the native request. This keeps the e2e proof stable without weakening the Plan-to-Build routing assertion.
- Move Plan, Build, and Run selection into /agents and remove /modes

- Keep Tab on Build/Plan outside Run and target switching inside Run

- Remove production-only question test hook and preserve pending Plan approval recovery

- Update user flows, QA coverage, README, and fork changelog
- open Build when a detected local Agent Swarm project has an entry import/startup failure after the environment is ready

- keep the same project available for Run after the user fixes it in Build

- cover the fallback with source and binary terminal E2E plus launcher tests
@nicko-ai
nicko-ai force-pushed the codex/agent-builder-e2e-scenarios branch 3 times, most recently from aaf0264 to 8547ed6 Compare July 6, 2026 00:19
- strip stale launch-time Agency Swarm routing after external /connect from Build fallback

- keep prepared local Run config authoritative when returning to Run from Build

- extend focused terminal E2E assertions for stale local-agency config
@nicko-ai
nicko-ai force-pushed the codex/agent-builder-e2e-scenarios branch from 8547ed6 to bb4ab88 Compare July 6, 2026 00:58
- keep startup Build slash commands usable with prefilled repair text

- keep TUI input ownership when switching back to local Run after dependency refresh

- document and cover the real terminal recovery cases
@nicko-ai
nicko-ai force-pushed the codex/agent-builder-e2e-scenarios branch from e8b23d5 to 53ee119 Compare July 7, 2026 21:17
- keep startup fallback prompt generic for any project startup error

- shorten the prefilled Build prompt while preserving the real error

- update focused assertions and flow docs
@nicko-ai

nicko-ai commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: d1be819787

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- show a visible starting state while /agents Run prepares the local swarm

- cover the slow Build fallback to Run path in focused TUI E2E

- document the user-visible wait state in USER_FLOWS and FORK_CHANGELOG
@nicko-ai
nicko-ai merged commit 990a7a3 into dev Jul 10, 2026
14 checks passed
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.

Plan handoff can stay in Plan after approval

1 participant