Skip to content

feat(agent): interactive subagent management and unified background-work tracking - #684

Merged
edenreich merged 15 commits into
mainfrom
fix/678-subagent-management
Jun 30, 2026
Merged

edenreich merged 15 commits into
mainfrom
fix/678-subagent-management

Conversation

@edenreich

@edenreich edenreich commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #678. In interactive subagent mode (the default tools.agent.mode: interactive), the Agent tool opened an infer chat tmux pane but marked the subagent completed and dropped it from the tracker on launch, never storing the pane id — so the main agent had no native way to check a subagent's status, read its screen, drive it, or close a finished pane. It reached for ListShells(), which only knows background bash shells.

A subagent that "finished its work" is an idle-but-still-running REPL (pane alive, process not exited), so "finished" is a judgment the main agent makes, not a signal the system can auto-detect. This PR gives the main agent a full tool surface for managing interactive subagents, and along the way unifies how all background work (A2A tasks, background shells, subagents) is tracked and delivered back to the agent.

Changes

1. Subagent management tools

Interactive subagents are now tracked (carrying their PaneID) as running, with six tools that mirror — and extend — the background-shell trio:

Tool Mirrors Purpose
ListSubagents ListShells List subagents with live pane status (running / finished / closed)
GetSubagentResult BashOutput Return a bounded tail of a subagent's result (last message(s); optional lines)
CloseSubagent KillShell Harvest the final output and close the pane (or cancel a headless run); requires approval
ReadSubagentScreen — Read the subagent's live tmux screen (what it's showing right now)
SendSubagentInput — Type into the subagent's TUI to steer or unblock it
ApproveSubagent — Relay an approval decision into a subagent that is blocked on its own approval gate

The Agent tool routes interactive launches through a fire-and-track path that records the pane and returns immediately — even with wait: true (interactive has no completion signal to wait on). SubagentPoller skips interactive subagents (managed synchronously by the tools above), and HasPending() counts only headless running subagents, so a headless infer agent that opened an interactive pane no longer hangs ~300s at exit.

2. Unified background-work tracking (jobs.Supervisor)

A single long-lived jobs.Supervisor now owns every kind of background job — A2A tasks, background bash shells, and subagents — as domain.BackgroundJob. It is the single source of truth for live counts (CountRunningJobs(kind)) and the single producer that enqueues completion notes onto the shared MessageQueue. BackgroundTaskRegistry is a narrow projection of it; the old per-subsystem pollers (a2a_task_poller, subagent_poller) and the duplicated shell bookkeeping are removed in favor of this one tracker. The /tasks view and the input status bar read the supervisor's counts at render time.

3. Reliable background-work delivery (queue-drain ticker)

Background-job completions and user messages typed while busy used to be delivered by a fragile, non-blocking "wake" that routinely got dropped — leaving the agent stuck "busy" with the queue never drained (reproduced with ctrl+b shells and with 2 subagents). That wake (an in-turn HasActiveWork() wait branch + an Idle keep-alive) is replaced by a self-rescheduling 500 ms chat-UI ticker: when the agent is idle and the shared queue is non-empty, it starts a fresh turn through the normal entry point, and the existing CheckingQueue state drains the note. This respects the state machine — every turn still runs Idle → CheckingQueue → … → Completing → Idle, Idle is terminal again, and turn scheduling lives at the orchestrator where it belongs. CloseSubagent winds its supervised job down (WindJob) so the running-count clears at once with no stale completion note. Headless is unchanged — it keeps draining via BackgroundTasksWaiter.

4. A2A: start local agents configured in userspace

initializeAgentManager loaded agents only from the hardcoded project path (.infer/agents.yaml), so a local agent (run: true) configured in userspace (~/.infer/agents.yaml) showed in the chat agent list but its container never launched. It now loads via config.ResolveAgentsPath() — the same userspace-aware resolver the chat UI uses — and surfaces docker run stderr in the start error instead of discarding it.

Approval

Read-only ListSubagents / GetSubagentResult / ReadSubagentScreen bypass approval; CloseSubagent, SendSubagentInput, and ApproveSubagent fall through to the global approval setting like KillShell.

Testing

  • task build, task test (full suite), task lint (0 issues), task fmt, and go test -race ./... — all clean.
  • New unit tests: interactive pane tracking, ListSubagents status mapping, GetSubagentResult (interactive / headless / not-found), CloseSubagent (winds the supervised job / headless-cancel / not-found), ReadSubagentScreen, SendSubagentInput, the supervisor (enqueue-once, concurrent finish, HasPending excludes interactive), the queue-drain tick handler, and the chat-completion runner's subagent-result path.

TODO / Follow-ups

  • /tasks view — make every background-work kind visible. Today the table lists only A2A tasks (active via GetBackgroundTasks(), terminal via TaskRetentionService); background shells and subagents appear only as counts in the summary line, not as rows. Render running and recently-terminal shells and subagents as first-class rows so the view reflects all of jobs.Supervisor's jobs, not just A2A.
  • Retention for shells and subagents — at least 5, configurable. Only A2A tasks are retained after they go terminal (a2a.task.completed_task_retention, default 5). Add equivalent terminal-retention for shells and subagents (default ≥ 5, configurable, same shape as the A2A knob) so a just-finished shell/subagent lingers in /tasks instead of vanishing the instant it completes.
  • A2A active tasks are missing from the input status-bar indicator. The "⚙ …" background-jobs indicator below the input shows running shells and subagents but not active A2A tasks — even though getBackgroundJobsInfo counts CountRunningJobs(JobKindA2A) and the A2A submit path registers an a2aJob of that kind through the same unified registry. Reconcile the supervisor's A2A running-count with the /tasks active list (which still sources A2A separately from backgroundTaskService.GetBackgroundTasks()) so a working A2A task appears in the indicator the same way shells and subagents already do.
  • tmux swallows ctrl+b (its own prefix) so "move to background" is eaten inside a tmux session. Document it and/or add a non-colliding alternate binding in keybindings.yaml.
  • Gate the ctrl+b hint/channel on tools.background_shells.enabled so the affordance isn't offered (and doesn't error) when background shells are disabled.
  • TTL auto-reap of abandoned interactive subagent panes — an idle-but-alive pane stays counted as a running subagent indefinitely (honest, but unbounded).
  • Bash-detach pipe handoff can truncate trailing output (StdoutPipe + Wait race after detach); minor robustness follow-up.

Docs

This adds public tool surface (six subagent tools), so a [DOCS] issue for inference-gateway/docs (Agent-tool / tool-list pages) should follow.

…teractive subagents

Interactive Agent-tool subagents opened a tmux pane but were marked
completed and removed from the tracker on launch, with the pane id never
stored - so the main agent had no native tool to check a subagent's
status or close a finished pane (it reached for ListShells, which only
knows background bash shells).

Track interactive subagents (now carrying their PaneID) as running and
add three tools mirroring the background-shell trio: ListSubagents (live
pane status), GetSubagentResult (a bounded tail of a pane's latest
output), and CloseSubagent (harvest the final output and close the pane,
or cancel a headless run; requires approval). The SubagentPoller skips
interactive subagents, and HasPending no longer counts them so a headless
run that opened one does not hang at exit.

Fixes #678
@edenreich
edenreich requested a review from a team as a code owner June 29, 2026 09:33
Comment thread config/config.go Resolved
Comment thread internal/agent/tools/agent.go Resolved
Comment thread internal/agent/tools/tmux.go Resolved
Comment thread internal/domain/subagent.go Resolved
Comment thread internal/services/subagent_poller.go Resolved
Co-authored-by: Eden Reich <[email protected]>
…ent polling poll-free

After dispatching subagents the main agent polled them (via ListSubagents/
GetSubagentResult) instead of waiting for a completion notification, wasting
tokens. Interactive subagents had no completion signal, so the only way to
learn they finished was to poll.

Part A - interactive subagents now notify on completion. The SubagentPoller
gains a system-side pane watcher (monitorInteractive) that polls each
interactive subagent's tmux pane (no LLM tokens) and, when the pane goes idle
and stable or its process exits/closes, enqueues a '[Subagent Completed]'
message with the pane output and wakes the agent loop - the same path headless
subagents and A2A tasks already use. The tmux PaneInspector is injected from
package agent (chat only) to avoid a services->tools import cycle. The chat
loop stays alive while interactive subagents run via a new
BackgroundTaskRegistry.HasActiveWork() (HasPending plus running interactive);
the headless one-shot waiter keeps using HasPending(), so it still does not
hang at exit. Completed interactive subagents are kept tracked with their pane
open so the user can read them and CloseSubagent can tidy them.

Part B - make polling pointless. GetSubagentResult now refuses any running
subagent (it will notify automatically), mirroring A2A_QueryTask, and only
reads a completed one on demand. ListSubagents annotates running subagents,
and the dispatch message plus the Agent/ListSubagents/GetSubagentResult
descriptions lead with 'you are notified automatically - do not poll'. Also
fixes ListSubagents mislabelling a completed-but-pane-alive subagent as
running.
…l relay

Add a per-task `type` (ReadOnly default - Explore-like read/search, never prompts; ReadWrite - mutations require approval), plus ReadSubagentScreen (raw TUI capture), SendSubagentInput (re-prompt / drive the TUI), and ApproveSubagent (human-gated relay of a subagent approval prompt).

Make interactive-subagent completion detection reliable: the subagent result file is the authoritative turn-complete signal, and idleness is detected by pane content-stability instead of the always-present "Type your message" placeholder. That placeholder fired a false "[Subagent Completed]" with empty output ~10s in while the subagent was still working, which made the main agent poll and close still-running subagents.
edenreich added a commit that referenced this pull request Jun 29, 2026
## What

Fixes documentation drift surfaced by a README↔codebase audit.
**Documentation only — no code changes.**

## Changes

**Phantom `Github` tool removed** — it was removed in #572 but still
documented. Deleted from the README tools table, the full section in
`docs/tools-reference.md`, and the env vars + YAML blocks in
`docs/configuration-reference.md`. The system prompt already directs
GitHub work to the `gh` CLI.

**README tools table rebuilt** from `internal/agent/tools/registry.go` —
all 35 registered tools, grouped by category with their config gates,
plus a note that MCP tools register dynamically at runtime. (The old
table listed 16 and omitted 28 real tools.)

**New sections + TOC** — added a Table of Contents entry for the
existing *Claude Code Mode (Subscription)* section and four new
sections: *Agent Skills*, *Computer Use*, *Persistent Memory*,
*Reminders & Command Hooks*.

**Features / Commands / Shortcuts**
- Linked the six orphaned docs (`skills`, `plan-mode`,
`database-migrations`, `features/explorer`, `tasks-management`,
`a2a-connections`).
- Documented `infer skills` and `infer export`.
- Shortcuts: removed the non-existent `/export`, corrected `/clear`,
`/model`, `/copy`, and added the nine missing built-ins (`/new`,
`/conversations`, `/context`, `/diff`, `/explorer`, `/release-notes`,
`/tasks`, `/init`, `/init-github-action`).

**Examples** — referenced all 8 example directories (only
`telegram-channel` was linked before).

**Approval defaults corrected** — `WebSearch`, `WebFetch`, and
`A2A_SubmitTask` require approval under the global
`tools.safety.require_approval: true` default; the old tables said "No".
If web search/fetch needing approval is unintended, that's a code-side
default rather than a docs issue.

## Verification

- `markdownlint` clean (pre-commit Lint hook passed)
- All README links + in-page anchors resolve; every linked doc and
example dir exists
- Every tool in `registry.go` is represented; no `Github` row remains

## Merge order

The subagent tool suite (`Agent`, `ListSubagents`, `GetSubagentResult`,
`CloseSubagent`, `ReadSubagentScreen`, `SendSubagentInput`,
`ApproveSubagent`) is documented here but lands via #684. If this merges
before #684, `main` will briefly describe those tools ahead of the code
— merge #684 first (or together) to keep them in sync.
… background job tracking

- Removed old background job tracking methods and replaced them with a unified approach using BackgroundTaskRegistry.
- Updated InputStatusBar to display counts for A2A tasks, shells, and subagents in a single line.
- Enhanced TaskManagerImpl to include a summary of running background jobs.
- Added tests for the new background job tracking functionality in InputStatusBar.
- Removed obsolete tests related to previous background job tracking methods.
Background-job completions (shells, subagents, A2A tasks) and user messages
typed while busy were delivered by a fragile non-blocking "wake" that routinely
got dropped, leaving the agent stuck "busy" with the queue never drained.

Replace it with a self-rescheduling 500ms chat-UI ticker: when the agent is
idle and the shared queue is non-empty, it starts a fresh turn, and the
existing CheckingQueue state drains the note so the agent responds. Headless is
unchanged - it keeps draining via BackgroundTasksWaiter.

- Remove the in-turn HasActiveWork wait-branch and the Idle keep-alive so Idle
  is terminal again and the agent is never stuck busy.
- Strip the supervisor's per-request event sink (BindRequest, SetAgentEventChannel,
  dispatch) and HasActiveWork; it is now a pure job tracker + queue producer.
- CloseSubagent winds down its supervised job (WindJob) so the status-line
  running-count clears at once and no stale completion note fires.
Comment thread config/config.go Resolved
Comment thread internal/agent/tools/a2a_task.go Resolved
Comment thread internal/agent/tools/list_subagents.go Resolved
Comment thread internal/agent/tools/list_subagents.go Resolved
initializeAgentManager loaded agents only from the hardcoded project path
(.infer/agents.yaml), so a local agent (run: true) configured in userspace
(~/.infer/agents.yaml) showed in the chat agent list but its container was
never launched. Load via config.ResolveAgentsPath() - the same userspace-aware
resolver the chat UI uses - so the AgentManager starts exactly the agents it
lists.

Also surface docker run stderr in the start error instead of discarding it, so
a container that fails to launch is diagnosable rather than silent.
@edenreich edenreich changed the title feat(tools): add ListSubagents/GetSubagentResult/CloseSubagent for interactive subagents feat(agent): interactive subagent management and unified background-work tracking Jun 30, 2026
Render background shells and subagents as first-class rows in /tasks
alongside A2A tasks - three per-kind tables (A2A Tasks / Background Shells /
Subagents) sourced from the supervisor Snapshot, each retaining the last 5
terminal entries by default.

- Supervisor: count-based per-kind terminal retention, evicting the oldest
  over-cap terminal jobs on finish with their Close teardown run outside the
  lock; unbounded when unset.
- Config: tools.bash.background_shells.completed_retention and
  tools.agent.completed_retention knobs (default 5); wired into the supervisor
  in the container.
- /tasks view: kind-grouped section walk over the existing flat selection;
  Completed tab includes Failed; fix Cancelled->Canceled spelling; cancel
  restricted to active A2A tasks.

Implements TODO #1 and #2 of #684.
- subagent_tracker: GetSubagent/GetAllSubagents return copies so readers
  don't race SetSubagentStatus on Status; add a -race regression test
- jobs: Supervisor.Submit closes a superseded job after unlocking (a tmux
  exec was held under the supervisor mutex, against evictOverCapLocked)
- remove dead surface: Supervisor.HasPending, JobMeta.ExcludeFromPending,
  BackgroundTaskRegistry.WindAllJobs; fix stale SubagentPoller comments,
  the copy-paste Wind doc, the vestigial BackgroundShellService mutex
- tests: counterfeiter fakes for BackgroundJob/JobSubmitter/JobStopper/
  JobNotifier (+ BackgroundShellService/BackgroundTaskService); drop
  hand-rolled fakeJobStopper/fakeShellService/stubBackgroundTaskService
@edenreich edenreich moved this from Todo to QA in 2026 Jun 30, 2026
@edenreich
edenreich merged commit 343e083 into main Jun 30, 2026
1 check passed
@edenreich
edenreich deleted the fix/678-subagent-management branch June 30, 2026 16:16
@edenreich edenreich moved this from QA to Done in 2026 Jun 30, 2026
inference-gateway-releaser Bot added a commit that referenced this pull request Jun 30, 2026
## [0.126.0](v0.125.0...v0.126.0) (2026-06-30)

### 🚀 Features

* add persistent memory tool for agent ([#679](#679)) ([a487b13](a487b13))
* **agent:** interactive subagent management and unified background-work tracking ([#684](#684)) ([343e083](343e083))

### 🐛 Bug Fixes

* **chat:** bind opt+backspace and ctrl+backspace to delete-word-backward ([#697](#697)) ([173fe83](173fe83)), closes [#689](#689) [#576](#576)
* **a2a:** retain completed background tasks in /tasks ([#691](#691)) ([#701](#701)) ([43b8e13](43b8e13))
* **autocomplete:** surface arguments for one-of/all-optional tool schemas ([#698](#698)) ([655b2e4](655b2e4))

### ♻️ Code Refactoring

* add .gitignore by default to the projects dir ([4717deb](4717deb))
* enable memory by default ([86c2158](86c2158))
* make infer config userspace-first ([#682](#682)) ([1e77e42](1e77e42)), closes [#680](#680)
* **tui:** single event-loop ingress - one notifier, no self-rescheduling pollers ([#700](#700)) ([2ab8854](2ab8854))
* standardize comment punctuation by replacing em dashes with hyphens ([78f53a8](78f53a8))

### 📚 Documentation

* fix docs/ drift found by the README-to-codebase audit ([#687](#687)) ([413047a](413047a)), closes [#572](#572) [#686](#686)
* sync README and reference docs with the codebase ([#685](#685)) ([c328423](c328423)), closes [#572](#572) [#684](#684) [#684](#684)

### 👷 CI/CD

* **deps:** update CLAUDE workflow to version 0.14.5 ([eaba2b3](eaba2b3))

### 🧹 Maintenance

* add .infer to .gitignore ([08ef319](08ef319))
* **deps:** bump infer CLI v0.124.0 -> v0.125.0, infer-action v0.19.0 -> v0.19.1 ([#681](#681)) ([e9e7e21](e9e7e21))
* remove agent definitions ([4f7fd7d](4f7fd7d))
* remove unused configuration and shortcut files ([4c611db](4c611db))
* update claude-code to 2.1.191 ([729e81c](729e81c))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.126.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 30, 2026
edenreich added a commit that referenced this pull request Jul 2, 2026
…visor (#693) (#721)

## Summary

Closes #693.

A2A tasks were dual-tracked: the submit path registered each task in
**both** the `jobs.Supervisor` (which the status-bar indicator counts
via `CountRunningJobs`) and the `A2ATaskTracker` polling set (which the
`/tasks` active list and `HasPending` read via `GetAllPollingTasks`).
The two were cleaned up by independent paths and could diverge, so a
running A2A task could be missing from the status-bar indicator while
still showing in `/tasks`.

This makes the `jobs.Supervisor` the single source of truth for A2A
liveness (matching #684's intent), while the `A2ATaskTracker` stays
authoritative only for the context graph (resume) and the cancel
agent-URL lookup.

## Changes

- **`a2aJob` exposes its live polling state** via the new optional
`domain.A2AStateProvider`, and **`Supervisor.A2APollingStates()`**
enumerates running A2A jobs. Because the job holds the same
`*TaskPollingState` the poll loop mutates, this preserves the full A2A
detail (context/agent id, last known state) with no A2A-specific fields
added to the generic `JobMeta`/`TrackedJob`.
- **`BackgroundTaskService.GetBackgroundTasks()` and
`backgroundTaskRegistry.HasPending()` now read the supervisor**, so the
`/tasks` rows, the `/tasks` summary count, and the status-bar indicator
all derive from one source and can no longer disagree. The headless
`BackgroundTasksWaiter` exit path is unaffected (it goes through
`HasPending`).
- **Cancel is unified:** `CancelBackgroundTask` now winds the supervised
job (`WindStop`) so a cancelled task drops from the count/list at once
instead of lingering until the poll independently observes the remote
cancel. `runA2APolling`'s `ctx.Done()` branch now carries result `Data`
so the retained "Canceled" row survives the wind.
- **Closed a pre-existing data race** on the shared `TaskPollingState`:
`A2APollingState` composes the immutable identity fields with a
mutex-guarded last-known state instead of copying the struct the poll
goroutine mutates.

Interface-preserving: no counterfeiter mock regeneration required.

## Testing

- `task build`, `task test` (full suite), `task lint` (0 issues) — all
green.
- `go test -race` clean on `internal/services`,
`internal/services/jobs`, `internal/agent/tools` (validates the race
fix).
- New tests: `Supervisor.A2APollingStates` (A2A-only, detail preserved,
drops on finish); `HasPending` via the supervisor (a bare `StartPolling`
no longer counts); `GetBackgroundTasks` sourced from the supervisor;
`CancelBackgroundTask` winds the job; a concurrent `A2APollingState`
race test; and `TestA2ADivergenceGone` — a regression guard proving the
status-bar count and the `/tasks` list agree while running and drop
together on finish.

## Follow-ups (filed)

Discovered while fixing this; tracked separately:

- #718 [BUG] `/clear` / new-conversation leave in-flight A2A tasks
running in the supervisor (needs a kind-scoped `Supervisor.WindKind`).
- #719 [TASK] Refactor — remove dead `TaskPollingState.CancelFunc`
plumbing.
- #720 [BUG] `A2A_QueryTask` passes agent URL where a task ID is
expected (polling-active guard is a no-op).

no docs ticket: internal-only refactor
edenreich added a commit that referenced this pull request Sep 23, 2026
…names (#1283)

## Summary

A DDD / Clean Architecture / over-engineering audit of the domains,
followed by fixes. Four commits, one per phase; each passes `task
precommit:run` on its own. Net −4,183 lines.

### 1. Dead code and duplicates (`050c101f`)
- Removes 17 event types that nothing has emitted since #684 unified
background tracking, plus every receiver: the `a2acoord` package, the
conversation-view background-task bar, and the
chat-handler/tool-coordinator handlers. The `/tasks` view already covers
A2A tasks, shells and subagents.
- Removes interface methods only tests called (ImageService,
FileService, GitHubSetupService, A2ATaskTracker, ToolService), and the
unused workflow templates behind them.
- Collapses duplicates:
- `plugins` now reuses `skills`' GitHub `FetchTree`/`DownloadFile`
instead of carrying its own copy.
- One `CommandRunner`, one `ModelSelectedEvent`, one `AgentNameFromURL`.
- One `SubagentResultFile` writer and reader. The headless copy wrote
0o644 and ignored marshal errors; the shared one uses 0o600 and checks
errors.
- The judge verdict/input/approver types move out of `agent/domain` into
the agent package, their only user.

### 2. Misplaced code moved to its owning context (`627b7475`)
- **A2A tracking** belongs to the scheduler: the port moves to
`scheduler/domain`, and the trackers move from `platform/utils` to
`scheduler/infrastructure`.
- **Subprocess runner:** `agentrunner` moves to `platform/agentrunner`,
together with `FormatAgentMessage`, which parses its output.
- **Headless:** `presentation/headless` no longer imports
`internal/container`. `cmd/headless` passes a `Services` port instead,
and the container owns `StartScreenshotServer` for both chat and
headless.
- **UI types:** TUI-only state (sessions, the approval/plan/question
prompts, their enums), TUI-only events and `ToolFormatter` move from
`agent/domain` to `presentation/tui`. The agent keeps a single-method
`RetryStatusSink`.
- **Conversation ports:** `conversation/domain` gains
`PersistentConversationRepository` and `SessionRollover`, plus the pure
`BuildAgentMessagesFromEntries`/`EnsureToolCallsClosed`. The TUI no
longer casts to concrete conversation types.
- **Injection:** the container now provides the agent's tokenizer,
rollover, hooks and plugin instructions instead of the agent building
them.
- **Small edges:**
  - `download` takes an explicit progress callback.
  - The container runtime takes a plain session id.
  - `CapInstructions` moves to `platform/formatting`.
  - `ParseCron` moves to `scheduler/domain` and uses one shared parser.
- **`ScheduledJob`** gets `NewScheduledJob` and `Apply(JobPatch)`, so
schedule validation and timestamps live on the entity.

### 3. Domain names instead of `Manager` / `Impl` (`f83be330`)
- Lifecycle owners of external processes become Supervisors
(`AgentSupervisor`, `gateway.Supervisor`, `mcp.Supervisor`).
- Download helpers become Stores (audio
`BinaryStore`/`ModelStore`/`TTSModelStore`, `history.Store`).
- The rest get role names: `keybinding.Dispatcher`, `web.Sessions`,
`conversation.SessionRollover`, `scheduler.TitleBackfill`,
`statemanager.Store`, `tui.ViewNavigator`.
- 15 `*Impl` types drop the suffix. Container getters and file names
follow.
- Done with `gopls rename`, so every reference is updated.

### 4. Enforcement (`9cebcd3f`)
- New depguard rule `domain-is-pure`: a `domain/` package may import
only stdlib, external types and `agent/domain`, which is now documented
as the shared kernel.
- New depguard rule `container-is-the-root`: nothing under `internal/`
(tests excepted) may import `internal/container`.
- Both rules were checked by planting a violation. AGENTS.md is updated.

## Not done (deliberately)
- **`Tool` interface split:** every tool already renders its own UI in
`FormatResult`, so splitting the interface would touch ~60 tools without
removing any UI code from them.
- **Audio synthesizer injection:** the TTS tool also calls
`audio.WAVDurationSeconds`, so injecting the synthesizer alone would not
remove the dependency.
- **Deferred:**
  - storage ports living in `platform`
  - where `platform/render` sits
  - the mutable globals in `platform/models`
  - SDK types in the domain
  - splitting the fat `ImageService`/`MCPSupervisor` interfaces
  - local variable and field names that still say "Manager"

## Test plan
- [x] `task precommit:run` (mod tidy, mocks, fmt, lint, markdownlint) on
every commit
- [x] `go test ./...`, `task test:race`, `task test:e2e`
- [x] `INFER_GATEWAY_MOCK=true infer headless --model mock/openai/gpt-4o
"hi"`, including `--result-file` (written 0o600) and the early
`--format` error
- [x] Chat TUI in tmux against the mock gateway: chat, `/tasks`,
`/model` switch, `!echo`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Main agent in subagents interactive mode doesn't have a native tool to get their status

1 participant