Skip to content

refactor(code): agent loop inference/executor seams + Linear telemetry#4

Merged
petehanssens merged 2 commits into
mainfrom
feat/agent-loop-inference-executor-linear
May 28, 2026
Merged

refactor(code): agent loop inference/executor seams + Linear telemetry#4
petehanssens merged 2 commits into
mainfrom
feat/agent-loop-inference-executor-linear

Conversation

@petehanssens
Copy link
Copy Markdown
Contributor

Summary

  • Split the monolithic agent loop into InferenceDriver (Anthropic streaming → semantic events) and ToolExecutor (permissions, Warden, registry execute), wired from headless, TUI, coordinator, bridge, and GitHub runner entry points.
  • Add optional Linear trace linking: --linear-issue flag, branch auto-detect (CLO-123), context helpers, and LinkTrace on trace start when LINEAR_API_KEY is set.
  • Add a headless watchdog goroutine that enforces wall-clock timeout and session token budget outside the loop (exit code 4 + result file).
  • Document inference driver in CONTEXT.md and align design doc §2.9 with input-aware permission rules.

Test plan

  • CGO_ENABLED=0 go test ./...
  • Headless smoke: drover-code --headless --prompt "say hi" with and without --linear-issue
  • TUI / coordinator paths still start a turn (manual)

Made with Cursor

petehanssens and others added 2 commits May 26, 2026 17:39
Extract Anthropic streaming and tool execution from the monolithic loop so
headless, TUI, coordinator, and GitHub runners share the same wiring. Add
optional Linear issue linking on traces and a headless watchdog for wall-clock
and token budgets.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Extract and consolidate StatusBar, LiveRegion (+ToolSpinner), HistoryView,
  InputArea, and PermissionPrompt as proper Bubble Tea components
- Full dual-state migration followed by ownership consolidation passes:
  - HistoryView owns viewport + RenderedTurn list (legacy m.history/m.viewport removed)
  - LiveRegion owns active tools, streaming, and completed tools (legacy fields removed)
  - InputArea owns textarea, messageQueue, and autocomplete state (syncInputArea removed)
  - PermissionPrompt owns prompts + batch (old internal/tui/permission.go deleted)
- Centralize all styles in internal/tui/styles/colors.go
- Add real Guard integration:
  - assessPermissionRisk with file-sensitive + dangerous bash pattern detection
  - SetGuardRisk + GuardRiskLevel/Reason on Model
  - StatusBar renders risk state (● CAUTION / HIGH with reason)
- Implement Command Palette with semantic actions (ActionKey), Category,
  Shortcut, and RiskLevel metadata (not just text injection)
- Major coverage improvements:
  - strip.go sanitizers (security-adjacent paste handling)
  - Guard heuristics (table-driven + event-driven tests)
  - Component + integration tests across the new layer
- Update all tests (zero snapshot drift), design docs, AGENTS.md, and
  beads queue for the dcode-001 epic

All prior behavior preserved. Full test suite green.
@petehanssens petehanssens merged commit 0d137b1 into main May 28, 2026
3 of 5 checks passed
@petehanssens petehanssens deleted the feat/agent-loop-inference-executor-linear branch May 28, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant