fix(humanize2): pass agentDefaults to AgentRunCoordinator and support per-agent permission/sandbox/extraArgs#166
Conversation
… per-agent permission/sandbox/extraArgs
Two fixes for humanize2 workflow agent launches:
1. **Critical bug**: `AgentRunCoordinator` was constructed without `agentDefaults`,
so `permissionMode`, `sandbox`, and `extraArgs` from `~/.h2/config.yaml` were
silently ignored for all workflow-spawned agents. This caused:
- Claude agents to run with default permission mode, blocking MCP tool calls
(artifact_deliver, etc.) that require user approval in headless mode
- Codex agents to fail with "Not inside a trusted directory" when the working
directory is not a git repo
2. **Extended config surface**: `AgentModelDefaults` now supports `permissionMode`,
`sandbox`, and `extraArgs` per agent. The YAML parser handles both inline
comma-separated values and multi-line list items for extraArgs.
With this fix, users can configure in `~/.h2/config.yaml`:
agents:
claude:
permissionMode: bypassPermissions
codex:
extraArgs:
- --dangerously-bypass-approvals-and-sandbox
- --skip-git-repo-check
Closes PolyArch#165
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b95c3691ef
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…on state Scope the YAML list-item handler to only consume lines inside an agents.extraArgs block (similar to workflow.scripts.allow tracking), preventing unrelated `- ` lines under agent stanzas from being silently captured as CLI arguments.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd0d0e6dce
ℹ️ 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".
| if ((section === "agents" || section === "agents.extraArgs") && indent === 2) { | ||
| currentAgent = key === "codex" || key === "claude" ? key : undefined; | ||
| continue; |
There was a problem hiding this comment.
Reset agent section after parsing extraArgs list
After extraArgs: switches the parser into agents.extraArgs, the next agent header at indent 2 only updates currentAgent and leaves section unchanged. That means later fields (model, reasoningEffort, permissionMode, sandbox) are skipped because their parser branch requires section === "agents". In practice, a config with multiline codex.extraArgs followed by claude.model will silently ignore Claude overrides.
Useful? React with 👍 / 👎.
Summary
Two fixes for humanize2 workflow agent launches that were blocking
gen-ideaand other workflows from completing successfully.Bug 1:
agentDefaultsnot passed toAgentRunCoordinatorRoot cause:
AgentRunCoordinatorwas constructed withoutagentDefaultsinhub-server.ts. The config was loaded and passed tocreateHubHttpServer, but theAgentRunCoordinator(which actually creates and executes agent runs) never received it. This meantpermissionMode,sandbox, andextraArgsfrom~/.h2/config.yamlwere silently ignored.Impact:
permissionMode: default, blocking MCP tool calls (artifact_deliver,artifact_get) that require user approval in headlessclaude -pmodeFeature: Extended agent config surface
AgentModelDefaultsnow supports three new per-agent fields:permissionModePermissionMode--permission-mode(e.g.,bypassPermissions)sandboxSandboxMode--sandboxextraArgsstring[]--skip-git-repo-check,--dangerously-bypass-approvals-and-sandbox)YAML parser supports both inline comma-separated values and multi-line list items for
extraArgs.Configuration example
Changes
src/config.tsAgentModelDefaultsinterface + YAML parsersrc/hub/runs.tspermissionMode/sandbox/extraArgsfrom config defaults increateRunsrc/hub-server.tsagentDefaultstoAgentRunCoordinatorconstructor (critical bugfix)Verification
Tested with
gen-ideaworkflow:idea-draftdelivered correctlyCloses #165