agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

New task dialog ignores the project's default agent and can only spawn 4 of 23 supported agents

Open aprv10 opened this issue 5 months ago • 1 comments

Summary

The New task dialog always sends a hardcoded harness (defaulting to codex) and only exposes 4 of the 23 supported agents. This silently overrides the project's configured default worker agent, and makes it impossible to spawn the other 19 agents from the quick-create flow — even though the daemon fully supports them and is explicitly designed to inherit the project default when harness is omitted.

Expected behavior

  • The agent selector should default to the project's configured default worker agent, not a hardcoded codex.
  • All supported agents (the 23 in the spawn enum) should be selectable — or, when the user hasn't explicitly chosen one, the request should omit harness so the daemon applies the project default.

Actual behavior

  • The dropdown always opens on Codex, regardless of the project's configured default worker agent.
  • Submitting without changing it spawns Codex, ignoring the configured default.
  • Only Codex, Claude Code, OpenCode, Aider are selectable. If a project's default is any other agent (Cursor, Amp, Goose, etc.), there is no way to launch it from New task, and it silently spawns Codex instead.

Root cause

The frontend defeats a backend design that already supports project-default inheritance:

  1. harness is optional on the API. SpawnSessionRequest.Harness is json:"harness,omitempty" with a 23-value enum. backend/internal/httpd/controllers/dto.go:146

  2. The daemon falls back to the project default when harness is empty.

    func effectiveHarness(explicit domain.AgentHarness, kind domain.SessionKind, cfg domain.ProjectConfig) domain.AgentHarness {
        if explicit != "" {
            return explicit
        }
        if role := roleOverride(kind, cfg).Harness; role != "" {
            return role // project's worker/orchestrator default agent
        }
        return ""
    }
    

    backend/internal/session_manager/manager.go:320

  3. But the dialog hardcodes the agent list to 4 entries:

    const AGENTS = [
      { value: "codex", label: "Codex" },
      { value: "claude-code", label: "Claude Code" },
      { value: "opencode", label: "OpenCode" },
      { value: "aider", label: "Aider" },
    ];
    

    frontend/src/renderer/components/NewTaskDialog.tsx:17

  4. defaults the selection to codex without reading project config: const [agent, setAgent] = useState<AgentProvider>("codex"); — NewTaskDialog.tsx:31

  5. and always sends it explicitly, so the daemon's fallback never runs:

    body: { projectId, kind: "worker", harness: agent, issueId: cleanTitle, prompt: cleanPrompt, branch: cleanBranch || undefined }
    

    frontend/src/renderer/components/NewTaskDialog.tsx:65

Steps to reproduce

A — default agent ignored:

  1. Open Project Settings, set Default worker agent to e.g. Claude Code. Save.
  2. Go to the board → New task.
  3. Note the Agent dropdown shows Codex, not Claude Code.
  4. Enter a title + brief, click Start task without changing the dropdown.
  5. Open the spawned session → the running agent is Codex, not the configured default.

B — most agents unreachable:

  1. Set the project default to an agent outside the 4 (e.g. Cursor).
  2. Open New task — Cursor is not in the dropdown; only the 4 hardcoded agents are available.
  3. Any task created spawns one of the 4 (Codex by default), never Cursor.

Affected files

  • frontend/src/renderer/components/NewTaskDialog.tsx (lines 17–22, 31, 65)
  • Backend behavior is correct; no change needed there. References: backend/internal/httpd/controllers/dto.go:146, backend/internal/session_manager/manager.go:320

aprv10 avatar Jun 29 '26 16:06 aprv10

Review — verified, legitimate bug

I checked every file:line reference against main. All claims are accurate:

Claim Status
NewTaskDialog.tsx hardcodes 4 agents (lines 17–22) ✅
Dialog defaults to "codex", ignoring project config (line 31) ✅
Always sends harness: agent explicitly (line 65) ✅
Backend SpawnSessionRequest.Harness is omitempty (dto.go:146) ✅
Enum has 23 values ✅ — I counted, exactly 23
effectiveHarness falls back to project's worker.agent when harness is empty (manager.go:321–330) ✅

This is silent config override, which is worse than a crash: a user who sets Default worker agent = Claude Code and clicks New task gets Codex with no warning. If their Codex credentials aren't set up, the session fails or runs against the wrong account. 19 of 23 supported agents are literally unreachable from the primary spawn entrypoint on the board.

Two things that strengthen the case

1. The fix is already half-built. The frontend already has a canonical 23-item list — AGENT_OPTIONS in frontend/src/renderer/lib/agent-options.ts — and a reusable agent-select component, RequiredAgentField in frontend/src/renderer/components/CreateProjectAgentSheet.tsx, which ProjectSettingsForm already uses for the exact "Default worker agent" field. So NewTaskDialog reinventing a 4-item list is gratuitous duplication, not a missing feature. The fix is a near-trivial swap onto the existing component + list.

2. The project default is already reachable client-side. ProjectSettingsForm reads config.worker.agent, so the dialog can preselect it without any new API surface.

One note on the proposed fix

The issue offers two alternatives — "default the dropdown to the project's worker.agent" vs "omit harness so the daemon applies the default." These aren't equivalent, and omitting harness is the correct one: single source of truth (backend), survives config changes without the dialog needing to re-sync, and matches the documented design.

Best UX: preselect the dropdown to worker.agent for visibility, but send harness: undefined unless the user actively changes it. That gives both correctness ("I can see what's about to launch") and adherence to the backend's designed fallback.

Suggested triage

  • Type: bug — the behavior contradicts documented design and silently violates user config; this isn't an enhancement.
  • Priority: high on the silent-override axis; the 4-of-23 dropdown is medium.
  • Fix scope: NewTaskDialog.tsx only — no backend change needed (the issue is right about this).
  • Small change, but it touches the primary spawn flow — worth owning rather than leaving open.

OrcInc avatar Jun 29 '26 19:06 OrcInc