Skip to content

Conversation

@krissetto
Copy link
Contributor

@krissetto krissetto commented Feb 6, 2026

Concurrent agents

Introduces an initial version of a new feature: concurrent agents.

This allows users to open multiple "tabs" with their current agent, even in separate working directories, and run them in parallel.

Includes:

  • Uses the experimental renderer by default
  • Tab switching works via mouse and keyboard
  • Introduces a TUI store to save user TUI state (open sessions, collapsed sidebar per session, etc)
  • Lets users know when a background agent is requesting a confirmation

The feature is gated behind the CAGENT_EXPERIMENTAL_CONCURRENT_AGENTS environment variable. The rest of the TUI should remain as-is, i created a separate model strongly based off of the original TUI model to touch as little of the existing code as possible until we all test things and agree on the approach

Screencast

Screencast.From.2026-02-08.16-37-05.mp4

@krissetto krissetto requested a review from a team as a code owner February 6, 2026 19:02
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I found 4 concurrency-related issues in the concurrent agent implementation. These are real bugs that could cause crashes or resource leaks:

  • 1 HIGH severity: Double-close panic on programReady channel (latent, unlikely with current usage)
  • 3 MEDIUM severity: Race conditions and cleanup synchronization issues

All issues are in the new pkg/tui/service/supervisor/supervisor.go file. The most critical is the missing synchronization in cleanup operations, which could leave resources in inconsistent states.

Key Findings:

  1. Unprotected channel close operation (potential panic)
  2. Goroutine spawning s.program access without synchronization
  3. Cleanup functions launched without WaitGroup or synchronization

These should be addressed before merge to ensure stability of the concurrent agents feature.

@krissetto krissetto force-pushed the concurrent-sessions branch 2 times, most recently from 792e80c to 04c7b2f Compare February 7, 2026 15:41
@krissetto
Copy link
Contributor Author

/review

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Code Review Summary

Reviewed the concurrent agent support implementation. Found 2 issues worth addressing:

Findings:

  • 1 issue with error handling in cleanup goroutines
  • 1 issue with shallow copying causing shared references

Both are medium severity but could cause issues in production under specific conditions.

@krissetto krissetto force-pushed the concurrent-sessions branch from 04c7b2f to 12388ea Compare February 7, 2026 16:12
@krissetto
Copy link
Contributor Author

/review

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Found 3 issues in the new concurrent agent support code that should be addressed:

  1. HIGH Severity: Goroutine leak if SetProgram() is never called (could leak all subscription goroutines)
  2. MEDIUM Severity: Unnecessary goroutine spawning in notifyTabsUpdated() with missing error handling
  3. MEDIUM Severity: Inconsistent cleanup pattern that may cause deadlock

All issues are in the new pkg/tui/service/supervisor/supervisor.go file. The rest of the PR looks good - the concurrent agent architecture is well-designed with proper locking and context cancellation patterns.

@krissetto krissetto force-pushed the concurrent-sessions branch from 12388ea to 9c3ae7e Compare February 7, 2026 16:57
@krissetto
Copy link
Contributor Author

/review

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Found 4 issues in the concurrent agent implementation that should be addressed:

  • 2 CONFIRMED bugs (configuration cloning and blocking I/O)
  • 2 LIKELY coordination issues (cleanup goroutine patterns)

The concurrent agent architecture looks solid overall. The main concerns are around proper resource cleanup coordination and using appropriate contexts for I/O operations.

@krissetto krissetto force-pushed the concurrent-sessions branch 3 times, most recently from 7205b41 to 033027b Compare February 8, 2026 17:42
…ions

Signed-off-by: krissetto <chrisjpetito@gmail.com>
@krissetto krissetto force-pushed the concurrent-sessions branch from 033027b to 20e3ead Compare February 9, 2026 19:43
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