Skip to content

refactor(control): extract autoResearchManager collaborator - #7796

Merged
esengine merged 1 commit into
main-v2from
refactor/control-autoresearch
Aug 7, 2026
Merged

refactor(control): extract autoResearchManager collaborator#7796
esengine merged 1 commit into
main-v2from
refactor/control-autoresearch

Conversation

@esengine

@esengine esengine commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Continues the controller god-object cleanup (#7787). The AutoResearch subsystem (~320 lines) lived inline on Controller with 13 methods and direct *autoresearch.Store access scattered across controller.go, turn_orchestrator.go, and input.go.

What

  • New autoResearchManager (autoresearch_manager.go) per the established leaf-collaborator playbook: wraps the optional workspace autoresearch.Store, zero-value disabled, every method nil-safe. It never touches Controller state — task IDs and assistant text are passed in by the caller.
  • Orchestration with side effects stays on Controller as thin glue in the same file: prepareAutoResearchTask (goal-machine fast-path), finalizeAutoResearchTask (notices), and the AutoResearch* port methods (task resolution via c.goals).
  • Pure helpers (evidence-block parsing, direction summary, default criteria) move with the manager.
  • Call sites in turn_orchestrator.go/input.go now go through the manager; tests reach the raw store via c.autoResearch.store.
  • controller.go: 6498 → 6179 lines (was 6818 before refactor(control): split plan-todo seeding and module detection out of controller.go #7787).

Verification

  • gofmt clean, go vet ./internal/control/... clean
  • go test -race ./internal/control/ green
  • Full go test ./... green (English locale)

Cache-impact: none - control-plane code motion; no provider request shaping or cache logic involved.
Cache-guard: existing coverage - goal_test.go AutoResearch integration tests pass unchanged under -race.
Documentation-impact: none - internal reorganization; AutoResearch behavior and public API unchanged.

The AutoResearch subsystem (~320 lines: task prepare/resume, heartbeats,
evidence recording, direction summaries, readiness) lived inline on
Controller. Per the leaf-collaborator playbook it moves to
autoresearch_manager.go: autoResearchManager wraps the optional
workspace autoresearch.Store and never touches Controller state —
assistant text and task IDs are passed in. Controller keeps thin glue
that resolves the active task from the goal machine and owns notices
(prepareAutoResearchTask fast-path, finalizeAutoResearchTask, the
AutoResearch* port methods). controller.go 6498 -> 6179 lines.
@esengine
esengine requested a review from SivanCola as a code owner August 7, 2026 00:21
@github-actions github-actions Bot added agent Core agent loop (internal/agent, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development labels Aug 7, 2026
@esengine
esengine merged commit 9d3d241 into main-v2 Aug 7, 2026
23 checks passed
@esengine
esengine deleted the refactor/control-autoresearch branch August 7, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant