e2e/: E2E tests with real agent calls (see e2e/README.md)
Command Layout
The CLI is organized around five noun groups plus a small set of top-level
verbs. The groups are the canonical home for each verb; legacy top-level
shortcuts remain functional but hidden, and emit a deprecation hint pointing
at the canonical group form.
session (alias: sessions): list, info, stop, attach, resume, current
agent: bare opens the interactive agent selector, plus list, add, remove
configure: bare prints help and a hint pointing at entire agent; flags
manage non-agent settings (telemetry, git-hook installation mode, strategy
options, summary provider). Agent CRUD lives under entire agent.
auth: login, logout, status, list, revoke
doctor: bare runs the scan-and-fix flow, plus trace, logs, bundle
The hideAsAlias(cmd, canonical) helper in cmd/entire/cli/aliascmd.go
marks a command Hidden and sets cobra's Deprecated field so the hint
renders to stderr on every invocation while the command stays functional.
Diagnostic subcommands live alongside doctor.go as doctor_logs.go and
doctor_bundle.go. Group roots and noun-group children live in files
named <noun>_group.go and <noun>_<verb>.go respectively.
Tech Stack
Language: Go 1.26.x
Build tool: mise, go modules
Linting: golangci-lint
Development
Running Tests
bash
mise run test
Running Integration Tests
bash
mise run test:integration
Running All Tests (CI)
bash
mise run test:ci
This runs unit tests, integration tests, and the E2E canary (Vogon agent) in sequence. Integration tests use the //go:build integration build tag and are located in cmd/entire/cli/integration_test/.
Running E2E Canary Tests (Vogon Agent)
The Vogon agent is a deterministic fake agent that exercises the full E2E test suite without making any API calls. Named after the Vogons from The Hitchhiker's Guide to the Galaxy — bureaucratic, procedural, and deterministic to a fault.
bash
mise run test:e2e:canary # Run all E2E tests with the Vogon agent
mise run test:e2e:canary TestFoo # Run a specific test
Runs as part of test:ci — canary failures block merges
No API calls, no cost — safe to run freely, unlike real agent E2E tests
If a canary test fails, the bug is in the CLI or test infrastructure, not in an agent
Located in e2e/vogon/ (binary) and cmd/entire/cli/agent/vogon/ (Agent interface)
The binary parses prompts via regex, creates/modifies/deletes files, and fires lifecycle hooks
IMPORTANT: When changing E2E test prompt wording, the Vogon binary (e2e/vogon/main.go) parses prompts with hardcoded regexes. New phrasing may not match existing patterns — always run mise run test:e2e:canary after changing prompt text and fix Vogon's parsing if tests fail.
Running E2E Tests (Only When Explicitly Requested)
IMPORTANT: Do NOT run E2E tests proactively. E2E tests make real API calls to agents, which consume tokens and cost money. Only run them when the user explicitly asks for E2E testing.
bash
mise run test:e2e [filter] # All agents, filtered
mise run test:e2e --agent claude-code [filter] # Claude Code only
mise run test:e2e --agent gemini-cli [filter] # Gemini CLI only
mise run test:e2e --agent opencode [filter] # OpenCode only
mise run test:e2e --agent cursor [filter] # Cursor only
mise run test:e2e --agent factoryai-droid [filter] # Factory AI Droid only
mise run test:e2e --agent copilot-cli [filter] # Copilot CLI only
E2E tests:
Use the //go:build e2e build tag
Located in e2e/tests/
See e2e/README.md for full documentation (structure, debugging, adding agents)
Test real agent interactions (Claude Code, Gemini CLI, OpenCode, Cursor, Factory AI Droid, Copilot CLI, or Vogon creating files, committing, etc.)
Validate checkpoint scenarios documented in docs/architecture/checkpoint-scenarios.md
Support multiple agents via E2E_AGENT env var (claude-code, gemini, opencode, cursor, factoryai-droid, copilot-cli, vogon)
Environment variables:
E2E_AGENT - Agent to test with (default: claude-code)
E2E_CLAUDE_MODEL - Claude model to use (default: haiku for cost efficiency)
E2E_TIMEOUT - Timeout per prompt (default: 2m)
Test Parallelization
Always use t.Parallel() in tests. Every top-level test function and subtest should call t.Parallel() unless it modifies process-global state (e.g., os.Chdir()).
Exception: Tests that modify process-global state cannot be parallelized. This includes os.Chdir()/t.Chdir() and os.Setenv()/t.Setenv() — Go's test framework will panic if these are used after t.Parallel().
Git in Tests
Tests that touch git state must use an isolated temp repo — never the real repo CWD.
Many handlers (lifecycle, strategy, hooks) resolve the git repo from CWD via OpenRepository, GetGitCommonDir, DetectFileChanges, etc. Without isolation, tests can create session state files, shadow branches, or other artifacts in the real .git/ directory.
Use the testutil helpers:
go
tmpDir := t.TempDir()
testutil.InitRepo(t, tmpDir) // git init + user config + disable GPG
testutil.WriteFile(t, tmpDir, "f.txt", "init") // create a file
testutil.GitAdd(t, tmpDir, "f.txt") // stage it
testutil.GitCommit(t, tmpDir, "init") // commit (needs at least one commit for HEAD)
t.Chdir(tmpDir) // redirect CWD-based git resolution
testutil.InitRepo configures user.name, user.email, and disables GPG signing — safe for CI environments without global git config.
Prefer testutil.InitRepo() over direct git.PlainInit() in tests. When a test in this repo needs an initialized repository, use testutil.InitRepo(t, dir) unless the test specifically needs lower-level initialization behavior that the helper cannot provide. Do not call git.PlainInit() directly and then create commits or run CLI git operations without also reproducing the helper's repo-local config.
Do NOT shell out to git init/git commit directly without setting user config and --no-gpg-sign, and do NOT run lifecycle/strategy handlers from the real repo CWD in tests.
Spawning subprocesses in tests (TTY detection)
Tests that spawn the real entire or git binary need the child to be non-interactive so prompts don't hang on a developer terminal.
interactive.CanPromptInteractively() resolves in this order:
ENTIRE_TEST_TTY=1 → force interactive ON (any other non-empty value → force OFF).
testing.Testing() → false. In-process go test runs are non-interactive by default; no per-test t.Setenv("ENTIRE_TEST_TTY", "0") is needed.
For subprocesses spawning the real entire binary (e2e, integration tests, entire calling itself from a hook), prefer execx.NonInteractive over env-var plumbing:
execx.NonInteractive puts the child in a new session with no controlling terminal (Setsid on Unix, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP on Windows), so the child's /dev/tty probe fails naturally. No env var required.
interactive.UnderTest() returns true when testing.Testing() or ENTIRE_TEST_TTY is set — use it where code needs to skip a real-terminal operation even if CanPromptInteractively() returns true (e.g., reading from /dev/tty directly inside askConfirmTTY).
Linting and Formatting
bash
mise run fmt && mise run lint
mise run fmt can rewrite files. Treat mise run fmt && mise run lint as a single verification sequence: if formatting changes anything, run lint again on the formatted tree rather than assuming a previous lint result still applies.
Before Every Commit (REQUIRED)
CI will fail if you skip these steps:
bash
mise run check
Equivalent expanded form:
bash
mise run fmt # Format code (CI enforces gofmt)
mise run lint # Lint check (CI enforces golangci-lint)
mise run test:ci # Run all tests (unit + integration)
mise run check runs the three commands above.
Safety note: do not treat a clean mise run lint result as final unless it was run after the most recent mise run fmt pass.
Before Any Push Or Remote Code Update (REQUIRED)
Before pushing commits or otherwise sending code changes to any remote, run mise run lint on the current tree and ensure it passes. If mise run fmt changed files, rerun mise run lint on the formatted tree before pushing.
Common CI failures from skipping this:
gofmt formatting differences → run mise run fmt
Lint errors → run mise run lint and fix issues
Test failures → run mise run test and fix
Code Duplication Prevention
Before implementing Go code, use /go:discover-related to find existing utilities and patterns that might be reusable.
Check for duplication:
bash
mise run dup # Comprehensive check (threshold 50) with summary
mise run dup:staged # Check only staged files
mise run lint # Normal lint includes dupl at threshold 75 (new issues only)
mise run lint:full # All issues at threshold 75
Tiered thresholds:
75 tokens (lint/CI) - Blocks on serious duplication (~20+ lines)
Check if a helper already exists in common.go or nearby utility files
If not, consider extracting the duplicated logic to a shared helper
If duplication is intentional (e.g., test setup), add a //nolint:dupl comment with explanation
Code Patterns
Error Handling
The CLI uses a specific pattern for error output to avoid duplication between Cobra and main.go.
How it works:
root.go sets SilenceErrors: true globally - Cobra never prints errors
main.go prints errors to stderr, unless the error is a SilentError
Commands return NewSilentError(err) when they've already printed a custom message
When to use SilentError:
Use NewSilentError() when you want to print a custom, user-friendly error message instead of the raw error:
go
// In a command's RunE function:
if _, err := paths.WorktreeRoot(); err != nil {
cmd.SilenceUsage = true // Don't show usage for prerequisite errors
fmt.Fprintln(cmd.ErrOrStderr(), "Not a git repository. Please run 'entire enable' from within a git repository.")
return NewSilentError(errors.New("not a git repository"))
}
When NOT to use SilentError:
For normal errors where the default error message is sufficient, just return the error directly. main.go will print it:
go
// Normal error - main.go will print "unknown strategy: foo"
return fmt.Errorf("unknown strategy: %s", name)
Key files:
errors.go - Defines SilentError type and NewSilentError() constructor
root.go - Sets SilenceErrors: true on root command
main.go - Checks for SilentError before printing
Settings
All settings access should go through the settings package (cmd/entire/cli/settings/).
Why a separate package:
The settings package exists to avoid import cycles. The cli package imports strategy, so strategy cannot import cli. The settings package provides shared settings loading that both can use.
Usage:
go
import "github.com/entireio/cli/cmd/entire/cli/settings"
// Load full settings object
s, err := settings.Load()
if err != nil {
// handle error
}
if s.Enabled {
// ...
}
// Or use convenience functions
if settings.IsSummarizeEnabled() {
// ...
}
Do NOT:
Read .entire/settings.json or .entire/settings.local.json directly with os.ReadFile
Duplicate settings parsing logic in other packages
Create new settings helpers without adding them to the settings package
Key files:
settings/settings.go - EntireSettings struct, Load(), and helper methods
config.go - Higher-level config functions that use settings (for cli package consumers)
Logging vs User Output
Internal/debug logging: Use logging.Debug/Info/Warn/Error(ctx, msg, attrs...) from cmd/entire/cli/logging/. Writes to .entire/logs/.
Enabling debug/perf logs locally: Prefer adding "log_level": "DEBUG" to .entire/settings.local.json when you need detailed hook/perf logs. This file is gitignored, so it is a low-risk local-only change. ENTIRE_LOG_LEVEL=debug also works and takes precedence.
User-facing output: Use fmt.Fprint*(cmd.OutOrStdout(), ...) or cmd.ErrOrStderr().
Don't use fmt.Print* for operational messages (checkpoint saves, hook invocations, strategy decisions) - those should use the logging package.
Privacy: Don't log user content (prompts, file contents, commit messages). Log only operational metadata (IDs, counts, paths, durations).
Git Operations
We use github.com/go-git/go-git for most git operations, but with important exceptions:
go-git v5 Bugs - Use CLI Instead
Do NOT use go-git v5 for checkout or reset --hard operations.
go-git v5 has a bug where worktree.Reset() with git.HardReset and worktree.Checkout() incorrectly delete untracked directories even when they're listed in .gitignore. This would destroy .entire/ and .worktrees/ directories.
See HardResetWithProtection() in common.go and CheckoutBranch() in git_operations.go for examples.
Regression tests in hard_reset_test.go verify this behavior - if go-git v6 fixes this issue, those tests can be used to validate switching back.
Repo Root vs Current Working Directory
Always use repo root (not os.Getwd()) when working with git-relative paths.
Git commands like git status and worktree.Status() return paths relative to the repository root, not the current working directory. When an agent runs from a subdirectory (e.g., /repo/frontend), using os.Getwd() to construct absolute paths will produce incorrect results for files in sibling directories.
This also affects path filtering. The paths.ToRelativePath() function rejects paths starting with .., so computing relative paths from cwd instead of repo root will filter out files in sibling directories:
When to use os.Getwd(): Only when you actually need the current directory (e.g., finding agent session directories that are cwd-relative).
When to use repo root: Any time you're working with paths from git status, git diff, or any git-relative file list.
Test case in state_test.go: TestFilterAndNormalizePaths_SiblingDirectories documents this bug pattern.
Session Strategy (cmd/entire/cli/strategy/)
The CLI uses a manual-commit strategy for managing session data and checkpoints. The strategy implements the Strategy interface defined in strategy.go.
Strategy Interface
The Strategy interface provides:
SaveStep() - Save session step checkpoint (code + metadata)
SaveTaskStep() - Save subagent task step checkpoint
GetRewindPoints() / Rewind() - List and restore to checkpoints
GetSessionLog() / GetSessionInfo() - Retrieve session data
ListSessions() / GetSession() - Session discovery
How It Works
The manual-commit strategy (manual_commit*.go) does not modify the active branch - no commits are created on the working branch. Instead it:
Creates shadow branch entire/<HEAD-commit-hash[:7]>-<worktreeHash[:6]> per base commit + worktree
Worktree-specific branches - each git worktree gets its own shadow branch namespace, preventing conflicts
Supports multiple concurrent sessions - checkpoints from different sessions in the same directory interleave on the same shadow branch
Condenses session logs to permanent entire/checkpoints/v1 branch on user commits
Uses the post-rewrite Git hook to keep local session linkage aligned after amend/rebase rewrites
Builds git trees in-memory using go-git plumbing APIs
Rewind restores files from shadow branch commit tree (does not use git reset)
Location-independent transcript resolution - transcript paths are always computed dynamically from the current repo location (via agent.GetSessionDir + agent.ResolveSessionFile), never stored in checkpoint metadata. This ensures restore/rewind works after repo relocation or across machines.
Copilot token scoping - Copilot CLI session.shutdown contains session-wide token aggregates. Checkpoint metadata must stay scoped to CheckpointTranscriptStart; condensation may separately backfill full-session Copilot totals into session state for entire status.
Tracks session state in .git/entire-sessions/ (shared across worktrees)
Shadow branch migration - if user does stash/pull/rebase (HEAD changes without commit), shadow branch is automatically moved to new base commit
Orphaned branch cleanup - if a shadow branch exists without a corresponding session state file, it is automatically reset when a new session starts
PrePush hook can push entire/checkpoints/v1 branch alongside user pushes
Safe to use on main/master since it never modifies commit history
{
"checkpoint_id": "abc123def456",
"session_id": "2026-01-13-uuid", // Current/latest session
"session_ids": ["2026-01-13-uuid1", "2026-01-13-uuid2"], // All sessions
"session_count": 2, // Number of sessions in this checkpoint
"strategy": "manual-commit",
"created_at": "2026-01-13T12:00:00Z",
"files_touched": ["file1.txt", "file2.txt"] // Merged from all sessions
}
When multiple sessions are condensed to the same checkpoint (same base commit):
Sessions are stored in numbered subfolders using 0-based indexing (0/, 1/, 2/, etc.)
Latest session is always in the highest-numbered folder
session_ids array tracks all sessions, session_count increments
Session State (filesystem, .git/entire-sessions/):
code
<session-id>.json # Active session state (base_commit, checkpoint_count, etc.)
Checkpoint ID Linking
The strategy uses a 12-hex-char random checkpoint ID (e.g., a3b2c4d5e6f7) as the stable identifier linking user commits to metadata.
How checkpoint IDs work:
Generated once per checkpoint: When condensing session metadata to the metadata branch
Added to user commits via Entire-Checkpoint trailer:
Manual-commit: Added via prepare-commit-msg hook (user can remove it before committing)
Used for directory sharding on entire/checkpoints/v1 branch:
Path format: <id[:2]>/<id[2:]>/
Example: a3b2c4d5e6f7 → a3/b2c4d5e6f7/
Creates 256 shards to avoid directory bloat
Appears in commit subject on entire/checkpoints/v1 commits:
Format: Checkpoint: a3b2c4d5e6f7
Makes git log entire/checkpoints/v1 readable and searchable
Bidirectional linking:
code
User commit → Metadata:
Extract "Entire-Checkpoint: a3b2c4d5e6f7" trailer
→ Read a3/b2c4d5e6f7/ directory from entire/checkpoints/v1 tree at HEAD
Metadata → User commits:
Given checkpoint ID a3b2c4d5e6f7
→ Search user branch history for commits with "Entire-Checkpoint: a3b2c4d5e6f7" trailer
Note: Commit subjects on entire/checkpoints/v1 (e.g., Checkpoint: a3b2c4d5e6f7) are
for human readability in git log only. The CLI always reads from the tree at HEAD.
Example:
code
User's commit (on main branch):
"Implement login feature
Entire-Checkpoint: a3b2c4d5e6f7"
↓ ↑
Linked via checkpoint ID
↓ ↑
entire/checkpoints/v1 commit:
Subject: "Checkpoint: a3b2c4d5e6f7"
Tree: a3/b2c4d5e6f7/
├── metadata.json (checkpoint_id: "a3b2c4d5e6f7")
├── full.jsonl (session transcript)
└── prompt.txt
Commit Trailers
On user's active branch commits:
Entire-Checkpoint: <checkpoint-id> - 12-hex-char ID linking to metadata on entire/checkpoints/v1
Added via prepare-commit-msg hook; user can remove it before committing to skip linking
On shadow branch commits (entire/<commit-hash[:7]>-<worktreeHash[:6]>):
Entire-Session: <session-id> - Session identifier
Entire-Metadata: <path> - Path to metadata directory within the tree
Entire-Strategy: manual-commit - Strategy that created the commit
On metadata branch commits (entire/checkpoints/v1):
Commit subject: Checkpoint: <checkpoint-id> (or custom subject for task checkpoints)
Trailers:
Entire-Session: <session-id> - Session identifier
Entire-Strategy: <strategy> - Strategy name (manual-commit)
Entire-Agent: <agent-name> - Agent name (optional, e.g., "Claude Code")
Ephemeral-branch: <branch> - Shadow branch name (optional)
Entire-Metadata-Task: <path> - Task metadata path (optional, for task checkpoints)
Note: The strategy keeps active branch history clean - the only addition to user commits is the single Entire-Checkpoint trailer. It never creates commits on the active branch (the user creates them manually). All detailed session data (transcripts, prompts, context) is stored on the entire/checkpoints/v1 orphan branch or shadow branches.
Multi-Session Behavior
Concurrent Sessions:
When a second session starts in the same directory while another has uncommitted checkpoints, a warning is shown
Both sessions can proceed - their checkpoints interleave on the same shadow branch
Each session's RewindPoint includes SessionID and SessionPrompt to help identify which checkpoint belongs to which session
On commit, all sessions are condensed together with archived sessions in numbered subfolders
Note: Different git worktrees have separate shadow branches (worktree-specific naming), so concurrent sessions in different worktrees do not conflict
Orphaned Shadow Branches:
A shadow branch is "orphaned" if it exists but has no corresponding session state file
This can happen if the state file is manually deleted or lost
When a new session starts with an orphaned branch, the branch is automatically reset
If the existing session DOES have a state file (concurrent session in same directory), a SessionIDConflictError is returned
Shadow Branch Migration (Pull/Rebase):
If user does stash → pull → apply (or rebase), HEAD changes but work isn't committed
The shadow branch would be orphaned at the old commit
Detection: base commit changed AND old shadow branch still exists (would be deleted if user committed)
Action: shadow branch is renamed from entire/<old-hash>-<worktreeHash> to entire/<new-hash>-<worktreeHash>
Session continues seamlessly with checkpoints preserved
When Modifying the Strategy
The strategy must implement the full Strategy interface
Test with mise run test - strategy tests are in *_test.go files
Update both CLAUDE.md and AGENTS.md when modifying the strategy to keep documentation current
entire review Command
entire review runs a set of configured review skills inside an agent session. The review session is an immutable fact attached to a checkpoint — no verdict, no status tracking, no empty commits. On the next git commit, the review session is condensed into the checkpoint metadata alongside normal sessions, permanently recording that the code was reviewed and which skills were run.
Command Surface
code
entire review # Normal run: load config, run configured agent(s)
entire review --edit # Re-open the skills picker before running
entire review --agent <name> # Force a specific configured agent (skips multi-picker)
entire review attach <session-id> # Tag an existing agent session as a review (post-hoc)
entire review attach --force # Skip confirmation
entire review attach --agent <name> # Agent that created the session
entire review attach --skills <s,...> # Declare which skills were run
When two or more launchable agents are configured and --agent is not set, a multi-select picker appears with an optional per-run prompt field (e.g. "focus on security"). Selecting one agent or passing --agent runs the single-agent path; selecting two or more runs the N-agent path.
Settings Schema
Review skills are configured per-agent in .entire/settings.json:
yesterday when running entire review everything seemed to be fine. now i just ran and see this when two agents are runnign, how could this have happened? Reviewing main vs issues: 10 commits, 37 files changed, 4 uncommitted
AGENT STATUS DURATION AAGAGAAGENT STATUS DURATION TOKEAGENT STATUS AGENT STAGENT STATUS DURAT
claude-code ⣽ running 2mAGENT STATUS DU
claude-code ⣽ running AGENT STATUS
AGENT STATUS
AGENT STATUS
claude-code ⡿ runniAGENT STATUS
claude-code ⡿ runni
AGENT STATUS
claude-code ⣟ run
AGENT STATU
AGENT STATUS DURATION TOKENS PREVIEW
claude-code ⢿ running 5m7s
codex ⢿ running 5m7s
Ctrl+O: drill in · Ctrl+C: cancel
Assistant
Using systematic-debugging for the terminal rendering regression and context-fetcher to keep the investigation focused. I’ll first locate the review multi-agent UI path, then compare recent changes and identify why output would get interleaved instead of redrawn cleanly.
Assistant
The workspace is clean and the current branch here is at origin/main, so this looks like a regression in the review dashboard code rather than an uncommitted local edit in this worktree. The repeated AGENT STATUS... header strongly suggests a terminal redraw/control-sequence issue, so I’m narrowing on the Bubble Tea sink and the multi-agent runner.
Assistant
The live table is produced by TUISink and reviewTUIModel. So far the multi-agent event fan-in is serialized, which makes actual concurrent writes from the two agents unlikely; the failure shape points more at the renderer being asked to repaint too often or in a terminal mode it can’t control.
Assistant
I found one concrete mismatch: the dashboard row is built as about 94 visible columns (20 + status + duration + tokens + 40-char preview) while the renderer is often running in an 80-column terminal. In Bubble Tea’s inline mode, a hard-wrapped frame can make subsequent redraws land on the wrong physical lines, which matches the repeated header fragments.
Assistant
I’m going to add a focused regression test before touching the renderer code: a two-agent dashboard at 80 columns with long assistant previews must not emit any logical line wider than the terminal. That should catch the wrap condition behind this corruption.
Assistant
The regression test is in place. I’m running just that test now to verify it fails for the current implementation before making the production change.
User
do you know what the expected is supposed to look ike?
Assistant
Yes. The expected live view is a single in-place table, roughly:
text
Reviewing main vs issues: 10 commits, 37 files changed, 4 uncommitted
AGENT STATUS DURATION TOKENS PREVIEW
claude-code <spinner> running 5m7s
codex <spinner> running 5m7s
Ctrl+O: drill in · Ctrl+C: cancel
As agents emit text, only the DURATION, TOKENS, and PREVIEW cells should change; the header should appear once per frame and never leave fragments behind. The focused test now fails for the current code because a rendered row is 94 columns wide in an 80-column terminal, which is enough to cause the redraw corruption you saw.
Assistant
I’m going to make the dashboard width-aware rather than switching to a different UI mode. The fixed columns need 54 cells, so on an 80-column terminal the preview should get the remaining 26 cells and be truncated there.
Assistant
The fix now uses terminal display width instead of rune count or fmt padding, so ANSI-colored spinner text and wide glyphs are measured the same way the terminal will render them. I’m rerunning the failing test first.
Assistant
The focused regression is green after the width-aware rendering change. I’m formatting the touched files and then I’ll run the review package tests to catch nearby breakage.
Assistant
The full review package test suite passes. I’m doing one last diff/status pass so I can give you the exact root cause and changed files without hand-waving.
Assistant
Expected output is a stable, single live dashboard, not repeated fragments:
text
AGENT STATUS DURATION TOKENS PREVIEW
claude-code ⣽ running 5m7s
codex ⣽ running 5m7s
Ctrl+O: drill in · Ctrl+C: cancel
How it happened: the inline Bubble Tea dashboard could render rows wider than the terminal. In the failing case, a row was 94 columns wide in an 80-column terminal. Once the terminal wrapped that row, Bubble Tea’s redraw math no longer matched the real cursor position, so each refresh left pieces of prior frames behind.
I patched tui_model.go to render the table using terminal display width and truncate the preview to fit. I also added a regression test in tui_model_test.go.
Verified with:
text
go test ./cmd/entire/cli/review -count=1
User
why would i have not seen this before but see it now? and it looks like it has a row for each subagent?
Assistant
Using context-fetcher here to keep the explanation tied to the review UI path we just inspected.
Assistant
You likely only hit the exact conditions now:
The multi-agent review dashboard is active only when 2+ launchable configured agents are selected, like claude-code and codex.
The broken redraw only shows once a row has preview text. With no preview, the row is ~54 columns and fits. With a 40-char preview, the row becomes ~94 columns. In an 80-column terminal or split pane, it wraps and Bubble Tea redraws over the wrong physical lines.
If yesterday your terminal was wider, only one agent ran, or the agents had not emitted long preview text yet, it would look fine.
It is not supposed to create a row for each subagent. The rows come from the selected top-level review agents:
go
agentNames[i] = r.Name()
So claude-code and codex should be the rows. Any Claude/Codex subagent activity should only appear inside that agent’s event stream or drill-in view, not as separate dashboard rows.
User
yeah, but i should never see this, Reviewing main vs issues: 10 commits, 37 files changed, 4 uncommitted
AGENT STATUS DURATION AAGAGAAGENT STATUS DURATION TOKEAGENT STATUS AGENT STAGENT STATUS DURAT
claude-code ⣽ running 2mAGENT STATUS DU
claude-code ⣽ running AGENT STATUS
AGENT STATUS
AGENT STATUS
claude-code ⡿ runniAGENT STATUS
claude-code ⡿ runni
AGENT STATUS
claude-code ⣟ run
AGENT STATU
AGENT STATUS DURATION TOKENS PREAGENT STATUS DURATION TOKENS PAGENT STATUS DURATION TOKENS PR
AGENT STATUS DURATION TOKENS AGENT STATUS DURATION TOKAGENT STATUS DURATIAGENT STATUS AGENT STATUS DURATION
claude-code ⢿ running 8m17AGENT STATUS DURA
claude-code ⢿ runningAGENT STATUS
claude-code ⡿ runninAGENT STATUS
claude-code ⡿ runniAGENT STATUS
claude-code ⡿ runnAGENT STAAGENT STATU
claude-code ⣾ rAGENT STAT
claude-code ⣾ r
AGENT STA
claude-code ⣾
AGENT STATUS DURATION TOKENS PRAGENT STATUS DURATION TOKENS PR
AGENT STATUS DURATIAGENT STATUS DURATI
claude-code ⣯ running 16AGENT STATUS DU
claude-code ⣷ running AGENT STATUS
AGENT STATUS
claude-code ⣷ runninAGENT STATUS
claude-code ⣾ runniAAAGENT AGENT STATUS AGENT STATUS AAGENT STATUS DURATION TOKENS PREVIEAGENT STATUS DURATIONAGENT STATUS DURATION TOKENS PREVIEW
AGENT STATUS DURATION TOKENS PREVIEW
AGENT STATUS DURATION TOKENS PREVIEW
AGENT STATUS DURATION TOKENS PREVAGENT STATUS DURATION TOKENS PRAGENT STATUS DURATION TOKENS PRE
AGENT STATUS DURATION TOKENS PR
AGENT STATUS DURATION TOKENAGENT STATUS DURATION TOKAGENT STATUS DURATION TAGENT STATUS DURATION TOK
claude-code ✓ done 16m56s
codex ✓ done 6m45s
2 agent(s) done — 2 succeeded, 0 failed, 0 canc
Press any key to exit.
Assistant
Using systematic-debugging again because the symptom is stronger than a normal wrap glitch and the important question is what state the TUI actually had versus what the terminal displayed.
Assistant
You’re right: that output should never be visible. It’s not a legitimate review state.
What you’re seeing is stale redraw frames piling up. The TUI repaints the dashboard every 100ms for spinner and duration updates. Each frame contains the header:
text
AGENT STATUS DURATION TOKENS PREVIEW
When the frame is wider than the terminal, the terminal wraps/truncates differently than Bubble Tea expects. After that, each repaint writes over the wrong cells, so pieces of many old frames remain visible. That’s why it looks like dozens of AGENT rows.
It is not one row per subagent. The final line confirms the actual model only had two review agents:
The codex row showing only at the end is another artifact of the same corrupted redraw area. It should have been present from the first dashboard frame as either queued or running.
The patch I made caps every dashboard line to the terminal width, including ANSI-colored spinner text, so the renderer should not get into this wrapped-frame state.
User
can you build binary so i can test
Assistant
Using verification-before-completion for this because the useful outcome is a binary that was actually built and smoke-tested. I’ll place it under the worktree so you can run this exact patched build.
Assistant
The entry point is ./cmd/entire. I’m building a separate binary at bin/entire-fix-review so it won’t overwrite whatever entire you normally have on PATH.
Assistant
The build produced a binary, but Go printed a module-cache warning while writing its stat cache outside the workspace. I’m smoke-testing the binary now before handing you the path.
Assistant
One more practical detail: agent hook commands usually invoke entire by name, so I’m also producing bin/entire. That lets you test with this patched build first on PATH, instead of only invoking the parent process by an alternate filename.
Run it like this from the worktree so hooks also pick up this build first:
bash
cd /Users/peytonmontei/Documents/entire/devenv/entireio/cli/.worktrees/fix-review
PATH="$PWD/bin:$PATH" entire review
I also left bin/entire-fix-review if you want an explicit alternate name. Both report:
text
Entire CLI dev (unknown)
Go version: go1.26.2
OS/Arch: darwin/arm64
Go printed a module stat-cache permission warning during build, but the build exited 0 and the binaries run.
User
okay formatting is working, how do we make sure no regression in any size termianl
Assistant
Using test-writer plus verification-before-completion here. The practical answer is to pin the invariant in unit tests across terminal widths, and ideally add a renderer/PTY smoke test for the actual Bubble Tea redraw behavior.
Assistant
The current test proves the 80-column case, but “no regression in any size terminal” needs a stronger invariant: every line the dashboard emits must be at most the current terminal width, for both running and final frames. I’m going to broaden the test across narrow, normal, and wide widths, which will also force the footer/count lines to obey the same rule.
Assistant
I broadened the regression test first. It now checks running and finished dashboard frames across widths from 1 to 120 columns, with long names, large token values, and long previews. Next I’ll run it to see what still violates the invariant.
Assistant
The expanded test exposed the remaining weak spots: the table rows fit, but the running footer and finished summary line still overflow narrow terminals. I’m applying the same width cap to every dashboard line, not just rows.
Assistant
All dashboard lines now go through one width gate. I’m rerunning the width matrix test, then the full review package tests.
Assistant
The width matrix and full review package tests pass now. Since your test binary was built before this extra footer/count-line hardening, I’m rebuilding bin/entire so the binary matches the current patch.
Assistant
One note from git status: .entire/settings.json is modified, and that was not part of my TUI change. I’m treating it as existing/user state and leaving it alone; the TUI patch is only in the two cmd/entire/cli/review files.
Assistant
I added a regression invariant around the actual failure mode: every dashboard line must be <= termWidth, so the terminal never hard-wraps a Bubble Tea frame.
Coverage now checks running and finished dashboards across widths:
1, 2, 10, 20, 24, 30, 40, 53, 54, 55, 60, 80, 120
It includes long agent names, large token counts, and long previews. The first version caught the footer/count lines still overflowing on narrow terminals, so I updated tui_model.go to cap every dashboard line, not just table rows. Test is in tui_model_test.go.
Verified:
text
go test ./cmd/entire/cli/review -run TestTUIModel_DashboardLinesFitTerminalWidth -count=1
go test ./cmd/entire/cli/review -count=1
Both passed. I also rebuilt bin/entire; Go still prints the module stat-cache permission warning, but the build exits 0 and ./bin/entire version runs.
Note: .entire/settings.json is modified in the worktree, but I did not touch it.
User
okay what is next for review?
Assistant
Using project-shipper to frame the remaining work around what gets this review fix shipped cleanly.
Assistant
Next for this review fix:
Keep the patch scoped to the TUI width bug.
The only intended code changes should be cmd/entire/cli/review/tui_model.go and tui_model_test.go. Decide what to do with the unrelated .entire/settings.json change before committing.
Run the repo-required checks before PR:
bash
mise run fmt
mise run lint
mise run test
I’d avoid full real E2E unless you explicitly want it, since that can spend agent tokens.
Manually test the patched binary in a few terminal widths:
bash
PATH="$PWD/bin:$PATH" entire review
Resize the pane while it runs, especially around 80 cols and below.
Then commit with a focused message like:
text
fix(review): keep live dashboard within terminal width
The remaining nice-to-have would be a PTY-level smoke test for Bubble Tea redraw behavior, but the width invariant test already guards the root cause directly.
User
is there anything else that can cuase a rendering error to surface that we should evaluate
Assistant
Using systematic-debugging and test-writer here: the useful outcome is a short risk inventory tied to concrete tests, not guesses about terminals.
Assistant
I’m checking the existing detail/drill-in tests too, because dashboard wrapping was one failure class, but alt-screen ghost rows and leaked subprocess output are separate classes.
Assistant
Yes. The main remaining rendering risks I’d evaluate are:
Drill-in/detail view width
This is the biggest one. detailView still truncates by rune count, not display width. CJK text, emoji, or some symbols can be 2 columns wide, so a line can fit by rune count but still overflow the terminal. That could cause alt-screen rendering artifacts.
ANSI/control sequences in dashboard preview
Detail view strips ANSI. Dashboard preview currently collapses/truncates assistant text, but should also strip control sequences before display. Codex output is filtered earlier, but defense here is cheap.
Terminal resize while running
We handle WindowSizeMsg, but the invariant test is pure model state. A PTY smoke test that resizes during spinner updates would cover the renderer path more directly.
Concurrent writes to the same output
This looks mostly controlled: agent stdout/stderr are piped, DumpSink runs after TUI exits, and AgentEvent is serialized. Still worth keeping an eye on any new sink that writes during AgentEvent.
Final/dismissal frame overlap
We now cap final dashboard lines. The next risk is whether post-run dump/synthesis always waits until the TUI fully exits. TUISink.RunFinished blocks on dismissal, so this is designed correctly, but a regression test around sink ordering could pin it.
If I were tightening this before PR, I’d do two more targeted things: convert detailView to display-width truncation like the dashboard, and add a focused test that all detail-view lines fit widths with CJK/emoji/control-sequence input.
User
okay can we fix all these
Assistant
Using systematic-debugging, test-writer, and test-driven-development for this pass. I’ll add failing coverage for the remaining rendering classes first, then make the rendering helpers shared so dashboard and drill-in obey the same width/control-sequence rules.
Assistant
I’m adding the tests for the remaining risks now: dashboard preview control-sequence stripping, resize-after-render width behavior, detail-view display-width limits, and sink composition order. Some should fail on the current code, which is the point.
Assistant
Those tests failed exactly where expected: dashboard previews leaked cursor-control sequences, and drill-in lines overflowed with double-width text. I’m moving the width/control-sequence handling into shared helpers and using them in both dashboard and detail renderers.
Assistant
The new targeted tests are green after the shared text-rendering fix. I’m running the full review package tests next, then I’ll rebuild the test binary.
Assistant
I also ran the existing race-focused serial-dispatch test under -race; it passes, so the multi-agent sink calls are still serialized. I’m rebuilding the patched binary now.
Assistant
Implemented the remaining rendering hardening.
What changed:
Added shared TUI text helpers in tui_text.go for ANSI/control stripping and display-width padding/truncation.
Dashboard preview now strips control sequences before rendering.
Every dashboard line, including footer and final counts, is capped to terminal width.
Drill-in/detail view now truncates by terminal display cells, not rune count, so CJK/emoji cannot overflow.
Added tests for terminal width matrix, resize behavior, control-sequence stripping, detail width safety, and sink ordering so TUI exits before dump/synthesis output.
Verified:
text
go test ./cmd/entire/cli/review -run 'TestTUIModel_DashboardPreviewStripsControlSequences|TestTUIModel_WindowResizeKeepsDashboardWithinNewWidth|TestDetailView_LinesFitTerminalWidth|TestComposeSinks_TUIWritersRunBeforePostRunWriters' -count=1
go test ./cmd/entire/cli/review -count=1
go test -race ./cmd/entire/cli/review -run TestRunMulti_SerialDispatchNoConcurrentSinkCalls -count=1
All passed. I also rebuilt bin/entire and smoke-tested ./bin/entire version. Build still emits the Go module stat-cache permission warning, but exits 0.
One unrelated file is still modified: .entire/settings.json. I left it untouched.
User
okay now what
Assistant
Using project-shipper again: the next step is to decide whether this is ready to package for PR or whether we want one more verification pass first.
Assistant
Next is packaging this cleanly.
Decide what to do with .entire/settings.json.
It is modified but unrelated to the rendering fix. I would leave it out of the commit unless you intentionally changed review config.
Run repo-level checks:
bash
mise run fmt
mise run lint
mise run test
We already ran focused review tests and the relevant race test; this is the broader pre-PR gate.
caps review TUI dashboard/detail lines to terminal display width
strips control sequences from preview/detail text
adds width/resize/sink-order regression coverage
I can run the repo checks and prep the commit next.
User
yes test all ci tests
Assistant
Using verification-before-completion for the CI run. I’ll run the repo’s CI test task exactly as documented: mise run test:ci.
Assistant
The CI task hit sandbox restrictions: Go could not write its build cache, and httptest could not bind a local port. Per the sandbox rules I’m rerunning the same CI task with escalation so it can use the normal Go cache and local test listeners.
Assistant
The escalated CI run is now underway. It started with the integration/race go test -tags=integration -race ./... phase, which is usually the longest part.
Assistant
No new output yet; the CI task is still in the race-enabled integration test phase. I’m continuing to wait for completion rather than interrupting it.
Assistant
The escalated run is progressing normally now; the packages that previously failed due local listener/cache restrictions are passing. I’m letting the rest of test:ci continue.
Assistant
I’m continuing from the CI run that was already in progress. The full test:ci path made it through unit/integration packages and is currently in the Vogon canary E2E stage.
Assistant
mise run test:ci passed.
It completed the race/tagged Go test suite plus canary E2E:
go test -tags=integration -race ./...: passed
cmd/entire/cli/review: passed
Vogon canary: 58/58 passed
Roger-roger canary: 4/4 passed
I had to rerun it outside the sandbox because the sandbox blocked Go cache access and localhost test listeners, but the escalated CI test run completed cleanly.
User
did you run lint tests
Assistant
Not yet. I ran mise run test:ci, which covers the Go test suite plus canary E2E, but it does not run mise run lint; I’m running lint now so we have that signal too.
Assistant
The sandboxed lint run failed for environment reasons: it could not access the Go build cache and golangci-lint could not resolve its schema URL. I’m rerunning the same lint command with the same escalation used for CI.
Assistant
Not initially. I had run mise run test:ci, which is the CI test suite, but not lint.
I just ran mise run lint too. The sandboxed attempt failed on cache/network restrictions, then the escalated run passed:
mise run lint -> 0 issues
User
okay proceed
Assistant
I’m checking the final worktree state now so I can separate the review-rendering changes from unrelated local state before taking the next step.
Assistant
The review changes are isolated to cmd/entire/cli/review/*. There is still an unrelated .entire/settings.json modification in the worktree, so I’ll leave that out of any commit.
Assistant
I’m going to make one focused commit for the review TUI hardening: width-safe dashboard/detail rendering, control-sequence sanitization, and the regression tests.
Assistant
git add hit the sandbox because this worktree’s real git index lives outside the writable root. I’m rerunning the same scoped stage operation with escalation.
Assistant
The staged set is clean: six review files only, with .entire/settings.json left unstaged. I’m committing that scope now.
Assistant
Committed the review TUI fix:
9044dc539 Fix review TUI wrapping
Verified:
mise run test:ci passed
mise run lint passed with 0 issues
Only remaining local change is the unrelated .entire/settings.json, left unstaged.
User
okay proceed and create pr
Assistant
Using github:yeet for the PR flow. I’ll verify the branch state, push the committed fix, then open a draft PR with the review/testing context.
Assistant
gh is installed but its active auth token is invalid for peyton-alt, so gh cannot create the PR. I’m checking the GitHub app tools next; if the connector can create the PR after push, we can still proceed without relying on gh auth.
Assistant
The branch is fix-review; only the local settings file is dirty. I’m pushing fix-review to origin and will target the default branch, which appears to be main from the review context.
Assistant
The branch pushed cleanly. I’m opening a draft PR now with a body that captures the wrapping root cause and the checks we ran.
Assistant
The GitHub connector can read the repo tools but is not allowed to create PRs for entireio/cli (403 Resource not accessible by integration). I’m checking the gh fallback once after the push; if it still reports the invalid token, the remaining blocker is local GitHub auth rather than the branch state.
Pushed branch fix-review with commit 9044dc539 Fix review TUI wrapping.
Validation already run:
mise run test:ci passed
mise run lint passed
Worktree note: .entire/settings.json is still locally modified and was not included in the commit/PR.
User
lint failed 1158
Assistant
Using github:gh-fix-ci for this. I’ll pull the failing check details for PR 1158, inspect the lint output, then patch and rerun the relevant verification locally.
Assistant
Root cause is narrow: GitHub’s standalone golangci-lint-action caught whitespace issues that the local mise run lint wrapper did not surface. There are two blank lines immediately inside for _, width := range ... { loops in the new tests; I’m removing only those and rerunning the relevant lint path.
Assistant
The patch is tiny and matches the CI errors exactly. I’m running both the package tests and the direct golangci-lint run path now, because the CI failure came from the standalone golangci step after the mise wrapper.
Assistant
golangci-lint on the review package is now clean. The package test hit the same sandbox Go cache restriction as before, so I’m rerunning it with a writable cache and also checking full lint.
Assistant
All local checks for the lint fix are green: review package tests, direct golangci-lint run ./..., and mise run lint. I’m amending the existing PR commit so the branch stays as one focused change.
Assistant
The amended commit is 7a255a987; it only drops the two blank lines that CI flagged. I’m force-pushing with lease to update PR 1158.
User
review comments on pr
Assistant
I’m first letting the push finish so PR 1158 is on the amended commit, then I’ll pull the PR review comments and separate actionable comments from summary/no-op comments.
Assistant
The push is still running in the checkpoint pre-push sync. I’m waiting on that before reading comments so the PR metadata reflects the current head.
Assistant
The PR branch is updated. I’m loading the review-comment workflow now and then I’ll fetch the comments on PR 1158.
Assistant
PR 1158 has four unresolved review threads. They are all low-risk and in scope: two stale comments/docs, one real test-name mismatch, and one detail-header visual regression where the horizontal rule became spaces. I’m addressing all four locally.
Assistant
The actual code changes are straightforward: restore the detail header fill with width-safe dashes, update stale comments to display-cell wording, and make the finished-dashboard test use the same long agent name it initialized.
Assistant
I added a regression assertion that the detail header still fills with rule characters, so that visual piece doesn’t drift again. Now I’m rerunning package tests and both lint paths.
Assistant
The package tests and full direct golangci-lint run ./... passed. mise run lint collided with the parallel direct golangci process, so I’m rerunning it serially now.
Assistant
The serial lint run is clean. I’m amending these review-comment fixes into the PR commit and updating the branch again.