fix(agent): review fixes for Codex and OpenCode support#44
Merged
MiniCodeMonkey merged 19 commits intomainfrom Mar 7, 2026
Merged
fix(agent): review fixes for Codex and OpenCode support#44MiniCodeMonkey merged 19 commits intomainfrom
MiniCodeMonkey merged 19 commits intomainfrom
Conversation
Introduce an agent abstraction to support Claude and OpenAI Codex CLIs. Added internal/agent providers (ClaudeProvider, CodexProvider), resolution and installation checks (Resolve, CheckInstalled), and tests. Wire provider selection via --agent / --agent-path flags, CHIEF_AGENT env vars, and .chief/config.yaml (agent.provider, agent.cliPath). Propagate the provider into TUI, new, edit, and convert flows; convert and fix-json now run through the provider. Added Codex JSONL parser for the loop output and accompanying tests. Updated config struct, docs (README, installation, configuration, troubleshooting), and various command code to use the provider abstraction. Key new files: internal/agent/*.go, internal/cmd/convert.go, internal/loop/codex_parser*.go and tests; updated main.go, cmd handlers, prd conversion wiring and docs to reflect multi-agent support.
Propagate errors from provider commands and improve provider resolution flow. - Extended loop.Provider ConvertCommand and FixJSONCommand to return an error and updated implementations (Claude, Codex) to follow the new signature. Codex now returns explicit errors when temp files cannot be created. - Updated callers (internal/cmd/convert.go, runFixJSONWithProvider, loop tests, agent tests) to handle the new error return values. - Changed Resolve to return (loop.Provider, error) and make unknown providers produce a clear error; added mustResolve helper in tests and a TestResolve_unknownProvider. - Added resolveProvider helper in cmd/chief to load config and resolve the provider (exiting on error), and improved CLI flag parsing for --agent/--agent-path (support both --flag value and --flag=value). Minor test and docstring tweaks to reflect agent-agnostic language.
Add runtime validation and better error handling across CLI and loop components. Key changes: - cmd/chief: validate presence of values for --agent and --agent-path flags (print error and exit) and handle config.Load errors with a clear message. - internal/cmd: enforce non-nil Provider for RunNew, RunEdit and runInteractiveAgent (return explicit errors) and add corresponding tests that assert provider is required. Minor comment/spacing cleanups in option structs. - internal/cmd/convert: ensure temporary output files are removed on failed command start to avoid leftover artifacts. - internal/loop: return an error if Loop.Run is invoked without a configured provider; require provider for Manager.Start; add tests for both failure cases. Also minor struct field alignment and test provider method formatting. These changes make failures explicit and fail fast with clearer messages, and ensure temporary files are cleaned up on early command failures.
Remove the deprecated --output-last-message option from CodexProvider CLI invocations and simplify error messages in WaitWithSpinner and WaitWithPanel from "Claude failed" to the more generic "agent failed" for compatibility and clearer messaging. Changes in internal/agent/codex.go and internal/prd/generator.go.
…rser event timing - Remove duplicate stdin in OpenCode ConvertCommand and FixJSONCommand where the prompt was passed both as a CLI argument and via stdin - Revert Claude ConvertCommand to use `-p` with stdin instead of the incorrect `-p --tools ""` which passed an empty string as a separate arg - Fix OpenCode parser to emit EventToolStart when tools begin (not only on completion) and EventToolResult when completed, so the TUI shows activity during tool execution
…e test coverage - Extract parseAgentFlags() in main.go to eliminate triple-duplicated --agent/--agent-path parsing across parseTUIFlags, runNew, and runEdit - Extract runAgentCommand() in convert.go to share stdout/file output handling between runConversionWithProvider and runFixJSONWithProvider - Improve OpenCode CleanOutput to use JSON parsing instead of fragile string matching heuristics - Add Claude provider tests (claude_test.go) covering all Provider methods - Add OpenCode CleanOutput tests for NDJSON extraction and edge cases - Add OpenCode parser tests for tool_use start/no-state/completed events - Update troubleshooting docs to clarify provider-specific log file names
Add acknowledgments for the contributors who designed and built the multi-agent architecture, Codex CLI integration, and OpenCode CLI support.
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.
Summary
Review fixes for #43 (Codex and OpenCode support). Based on the same branch with bug fixes, deduplication, and improved test coverage.
--tools ""argsEventToolStartwhen tools begin, not only on completionparseAgentFlags()to eliminate 3x duplicated flag parsing in main.gorunAgentCommand()to deduplicate convert.go helpersCleanOutputto use JSON parsing instead of string matchingTest plan
go test ./...)go buildandgo vetclean--agent codexand--agent opencodeflagschief new --agent opencodeworks end-to-endBuilds on #43