e2e/: E2E tests with real agent calls (see e2e/README.md)
Command Layout
The visible CLI is organized around a set of noun groups plus a small set of
top-level verbs. The groups are the canonical home for each verb. Newer
experimental command families are discoverable through entire labs and
their canonical paths are always runnable.
Experimental commands are gated by a build-time visibility flag (the
cmd/entire/cli/experimental package): they are shown — grouped under an
"Experimental commands:" help section — in developer and nightly builds, and
hidden in stable release builds. Visibility is toggled by experimental.Visible
(default "true"), which GoReleaser stamps "false" only on stable tags
(.Prerelease empty); nightly (vX.Y.Z-nightly.*) and local builds leave it at
the default. Register a command as experimental with instead of . Gating only controls visibility —
the commands are always runnable in every build.
I’m using pfleidi:task-implement to follow the issue/worktree lifecycle, then pfleidi:testing once review timing is settled; pfleidi:human-review will define the agreed Hunk review boundary. I’ll first acknowledge COR-1450 to the coordinator, re-read the live issue, and inspect the implementation guidance before touching repository files.
Assistant
Please choose the review timing for COR-1450:
Review once code-ready — recommended. This looks like one coherent removal. Selecting it authorizes a sequence of small, focused, verified local commits without per-commit approval—and nothing more. It does not authorize pushing, amending, opening a PR, or final acceptance.
Review before each commit. Better if you prefer tighter checkpoints or expect the removal to become large/risky.
Which mode do you want?
User
Review when code ready
Assistant
Review timing is fixed to one branch-wide Hunk review when the code is ready, with local slice-commit authority only. I’m now invoking pfleidi:testing before any repository edit; its TDD and test-quality guidance will govern the removal slices. I’m also loading the live Entire/Herdr guidance, then I’ll inspect the sync path and settings loader read-only.
Assistant
pfleidi:testing requires a clean full unit baseline before the first edit, so I’m running mise run test now. The repo-requested /go:discover-related skill is not available in this session’s skill catalog; I’ll use read-only rg/git inspection as the fallback to map existing mirror/settings patterns and avoid duplication.
Assistant
The focused area is healthy so far, and the baseline is still finishing. Source search confirms the task is concentrated in repo_mirror.go, layered settings, and their unit tests; generated core API support remains server-contract code and is outside this CLI-path removal. I’m waiting for the complete baseline before editing.
Assistant
The full unit baseline is clean: 10,491 tests passed with 7 skipped. I’m now tracing the exact public behavior tests and loader mechanics so the RED step proves two contracts directly: legacy async_mirror_requests:false is harmless and mirror creation still uses the async route, while --wait-timeout exposes only the single async deadline.
Assistant
The design check found a real choice: the settings loader uses DisallowUnknownFields, so simply deleting the field would make existing files fail startup. I’m checking the repository’s precedent for retired settings before asking you to choose ignored versus migrated; no files have been edited.
Assistant
The loader is not safe by default: EntireSettings is decoded with DisallowUnknownFields, so deleting the field outright would reject existing files at startup.
I recommend ignore: remove the setting from the layered/runtime model, accept async_mirror_requests only in a compatibility decode shim, and never act on or rewrite it. All other unknown keys remain errors. Migration would require startup-time writes to both shared and local settings files, adding unnecessary side effects.
Should I implement the ignored-key compatibility path?
User
I don't expect anyone to have this value configured. The current settings only exist as a killswitch in case something breaks dramatically. Does this change things?
Assistant
It reinforces the ignore choice; it doesn’t eliminate the compatibility requirement.
The live acceptance criteria explicitly require an existing key not to break startup, and the current changelog advertises "async_mirror_requests": false as an opt-out. Even if nobody likely used it, silently accepting that one retired key is cheap and avoids startup failures. No migration or file rewrite is warranted.
I’ll proceed with the compatibility-only ignored-key shim unless you want the acceptance criterion changed.
User
Okay, do it
Assistant
Decision settled: the retired key will be accepted only by a compatibility decoder and otherwise ignored, with no startup-time file rewrite. I’m beginning the RED step by changing the command-level contract tests first; production code remains untouched until those tests fail for the expected sync-route/help-text reasons.
Assistant
The RED checks failed exactly as intended: the legacy key still forced POST /mirrors, and help still documented both modes. I’ve removed the runtime branch and sync-only output/state handling, and updated retained wizard coverage to exercise the async request route. I’m checking this first slice before touching the settings model.
Assistant
The async-only command slice is green: focused mirror tests, the full CLI package, and repository lint all pass. I’m committing this focused slice now; it removes the synchronous branch and its dead tests while preserving async failure, timeout, progress, concurrency, and wizard coverage.
Assistant
The first slice is committed locally as 65b5efb90c. For the settings slice, I’m replacing the old layered-value and round-trip tests with compatibility contracts: both shared and local legacy keys must load without effect or automatic rewrite, and byte-level historical settings parsing must remain compatible.
Assistant
The compatibility slice is green at its focused boundary. The shim accepts only the retired key while preserving strict rejection of unrelated unknown settings, and both layered Load and historical LoadFromBytes are covered; tests also verify loading does not rewrite either settings file.
Assistant
The settings slice now passes focused compatibility/strictness tests, the full settings package, the full CLI package, and lint. I’m committing it as the second focused slice, then I’ll run the complete code-ready verification before opening Hunk.
Assistant
Both implementation slices are committed locally. I’m running the repository’s complete mise run check gate now—format, lint, unit/integration tests, and the zero-cost Vogon canary—so the branch reaches the code-ready boundary with current whole-repo evidence before Hunk review. No real-agent E2E tests will be run.
Assistant
The full gate’s formatting and lint phases are clean; the race-enabled integration/unit suite is still running. I’ll keep it under observation and check for any formatter-created diff before Hunk.
Assistant
The race-enabled suite is still active without failures or additional output. This phase is normally the slow part of test:ci; I’m continuing to wait rather than interrupting it.
Assistant
The full code-ready gate passed: formatter and lint clean, race-enabled unit/integration suite clean, and both Vogon and Roger-Roger canaries passed. The worktree is clean and two commits ahead. I’m now invoking pfleidi:human-review; it will create or reuse wB’s Hunk review tab rooted at this worktree and open the complete branch diff against origin/main.
Assistant
The branch-wide review is open in wB:t3 (Hunk review), pane wB:p3 (Hunk review), showing the complete diff against origin/main.
mise run check passed fully, including race-enabled unit/integration tests and canaries. No push or PR has been created.
Please review in Hunk, leave any inline comments, then tell me when the review is complete.
User
Can you walk me through how settingsDecodeCompat works? As I said: I think anyone outside this company ever setting this setting is almost zero.
Assistant
I’ll line the Hunk view up on the compatibility wrapper and explain both its mechanics and whether its cost is justified given your “effectively nobody configured this” assumption. I won’t change the branch while review is active.
Assistant
I’ve positioned Hunk on the relevant block.
settingsDecodeCompat is a temporary decoding wrapper, not runtime configuration:
*EntireSettings is embedded, so all current settings decode normally into the real settings object.
RemovedAsyncMirrorRequests recognizes the old JSON key and stores its raw bytes temporarily.
Nothing reads that field, so true, false, or any other JSON value has no effect.
The wrapper is discarded after decoding.
DisallowUnknownFields() remains enabled, so every other unknown key still fails as before.
Loading performs no file write; tests confirm both project and local files remain unchanged.
The helper is used for project settings, local-layer merging, and historical settings loaded from bytes.
Your usage estimate changes the tradeoff, but not dramatically. If the acceptance criterion did not exist, I’d favor deleting the key outright and accepting the vanishingly rare startup error. However, the opt-out shipped and was advertised in the changelog, while a startup failure is severe. This shim is narrowly scoped and costs about 15 lines without weakening strict validation.
User
the problem with this approach is that we won't easily get rid of it. If someone set the async setting today this approach won't break them but removing it in the future will.
Assistant
Exactly. This shim doesn’t solve compatibility permanently—it creates a tombstone that must remain forever unless we accept the same break later. Even an automatic migration only helps users who run the migration-bearing release; anyone skipping it still breaks.
Given this was a short-lived emergency killswitch with effectively no expected users, the cleaner choice is:
Remove the setting and compatibility shim completely now.
Keep strict unknown-field behavior.
Change the acceptance criterion that requires old keys to remain loadable.
Accept that the unlikely configured user must delete the obsolete key after upgrading.
I recommend that approach. Do you want me to remove the shim and update COR-1450’s acceptance criterion accordingly?
User
Yes, I don't like the idea of tombstones remaining in this state forever. We should point out the tradeoffs in the upcoming pr/trail but I don't think we should make this a future problem to keep around.
Assistant
Agreed. This is a scope/criterion change, so I’ll record Sven’s decision directly on COR-1450 and notify the coordinator once. Then I’ll revise the tests RED-first to require normal strict rejection, remove the compatibility shim, verify the correction, and reload the same Hunk review. The PR description will explicitly call out the deliberate compatibility tradeoff.
Assistant
The revised tests went RED exactly because the tombstone still accepted the key in project, local, and byte-loaded settings. I’ve removed the shim and restored the original strict decoder paths; I’m now verifying the deliberate rejection behavior and the unchanged async-only mirror path.
Assistant
The correction is green: focused settings and mirror tests, both full affected packages, and lint pass. I’m reloading the same branch-wide Hunk session now so you can inspect the no-tombstone version before I create the focused correction commit.
Assistant
The corrected review is reloaded in wB:t3 (Hunk review).
The compatibility wrapper is gone. async_mirror_requests now follows ordinary strict unknown-field handling in project, local, and byte-loaded settings. Focused tests, both affected packages, and lint pass.
Please confirm the revised Hunk diff is approved; then I’ll create the focused correction commit and rerun the full gate.
User
I left a comment
Assistant
I’ll read the new Hunk comment, identify its exact file/line and current relevance, then present the intended response before making any edit.
Assistant
Selected Hunk comment user:1788469242286-1 at cmd/entire/cli/settings/settings_test.go:641:
I don't think we should test for settings that were once accepted but aren't anymore. The same goes for other tests related to the async mirror requests setting.
It is current and unambiguous. I’ll delete the project/local and byte-loader rejection tests entirely. The earlier command-level legacy-setting test is already gone, and I’ll verify no async_mirror_requests test references remain. Generic unknown-key tests will continue to protect strict decoding.
Assistant
The comment is addressed: all tests specific to the retired setting are deleted, no non-changelog references remain, generic strict-decoding tests remain, the settings package passes, and lint is clean. I’m reloading Hunk once more for your final inspection; I will not clear the comment or commit until you approve.
Assistant
The Hunk review is reloaded with your comment addressed:
Removed all tests specific to the retired setting.
Removed the compatibility shim.
No async_mirror_requests references remain outside historical changelog entries.
Generic strict unknown-field coverage remains.
Settings tests and lint pass.
Please confirm the revised diff is approved.
User
commit and continue
Assistant
Review approved. Before the correction commit, I’m rerunning the required full mise run check on the exact approved tree. Once green, I’ll commit the no-tombstone correction, then prepare the draft-PR handoff and ask separately before any push or PR creation as required.
Assistant
Formatting and lint are clean; the race-enabled full suite is still running with no failures reported. I’m waiting for the canary phase as well before committing.
Assistant
The full suite remains active without output or failures; this matches the earlier timing for the long CLI/race package. I’m continuing to monitor it.
Assistant
The approved tree has passed the full mise run check gate, including lint, race-enabled tests, integration tests, and both zero-cost canaries. I’m committing the final review correction now, then I’ll prepare the draft PR handoff and stop for your required push/PR permission.
Assistant
The review correction is committed as 7967a5ca59; the branch is clean and now has three focused commits. I’m using the pfleidi:pr workflow next to prepare the draft PR description and its explicit merge gate, without pushing or creating anything remotely yet.
Assistant
One scope-check command used a mistyped merge-base SHA and caused Git’s partial-clone fallback to attempt an irrelevant fetch; it did not change the tree. I have the correct merge base now and am rerunning the read-only check before syncing from origin/main.
Assistant
The pre-PR sync merged current origin/main cleanly; upstream changes were confined to gitrepo, with no conflicts in this removal. Because the candidate changed through that merge, I’m rerunning the repository’s single required aggregate gate, mise run check, on the exact synced tree.
Assistant
The synced candidate is through formatting and lint with zero issues; the race-enabled test and integration aggregate is still running. No files have changed during the gate so far.
Assistant
The long-running test aggregate remains quiet and active, which is normal for this suite. I’m continuing to wait on the same process; I haven’t started any remote action or modified the tree.
Assistant
Committed and synced with latest origin/main. The branch is clean at 8e11938e5d, and mise run check passes fully.
session (alias: sessions): list, info, tokens, stop, attach, adopt, resume, current.
resume with a branch arg switches to it and resumes its session; with no arg
it opens an interactive picker of stopped sessions (across all worktrees),
resolving each to its branch and pointing at the owning worktree when the
branch is checked out elsewhere. Resume keeps an existing local session log
as-is by default (--force overwrites it from the checkpoint).
adopt moves an active session from another repo or worktree into the current
worktree and resets target-local checkpoint bookkeeping so future commits link
to the adopted session from the new location.
checkpoint (aliases: cp, checkpoints): list, explain, tokens, search.
explain also takes --repo <owner/name>, the drill-down for a cross-repo
search hit: it reads the checkpoint from that repo's entire-api cell over
HTTP (/repos/{repo_id}/checkpoints/{id} plus .../transcript/raw) rather
than fetching git objects, so a foreign checkpoint never enters this repo's
object store, ref namespace, or tokens profile. It needs a full checkpoint
ID and a pushed checkpoint; --commit, --session, --search-all, and
--generate are rejected with it, and naming the current repo is a no-op
that falls through to the local path. See checkpoint_api_reader.go
(apiCheckpointReader, which implements the two checkpoint reader tiers and
deliberately not Writer) and explain_repo.go.
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, contexts, use, plus
token (prints the active control-plane bearer to stdout for scripting/curl;
honors ENTIRE_TOKEN, else the refreshed active-context login JWT). token
also takes --jurisdiction <slug> (e.g. us, eu), which instead mints a
jurisdictional identity token (RFC 8693 exchange, scope=openid,
aud=<jurisdiction host>) for that jurisdiction's entire-api cells (e.g.
https://aws-us-east-2.api.entire.io/api/v1), which reject the control-plane
bearer; it exchanges ENTIRE_TOKEN when set (deriving the environment from the
env token's aud), else the active login. auth status shows the caller's
home jurisdiction so the slug is discoverable. logout
takes --everywhere (revoke every session on the active core, not just the
current one) and --all-contexts (log out of every saved login)
doctor: bare runs the scan-and-fix flow, plus trace, logs, bundle
repo: control-plane repository lifecycle — create, list, get, delete,
clone, plus the mirror and visibility subtrees. Git content operations
(log, diff, …) are intentionally out of scope. The mirror subtree is
server-side (create, list, get, remove, collaborators) with one
exception: mirror use repoints the current clone's git remote at a mirror
(local git config only — it creates nothing server-side). Interactively it
picks among the repo's placements and asks whether to replace the remote
(preserving the old URL under --upstream) or add a separate one;
non-interactively it repoints --remote directly. Both use and clone
choose a placement through the shared selectPlacement picker. clone
accepts a native /et/<project>/<repo> ref, a mirror /gh/<owner>/<repo>
ref, or a full entire:// URL passed through verbatim. Every ref names its
forge: the leading token alone decides which grammar is tried, and the bare
<project>/<repo> shorthand was removed because both forges take that shape
and nothing in it says which was meant (#2252).
Requiring the prefix is a namesquatting guard, not tidiness: without it,
whichever namespace the CLI defaulted to could shadow the other, and
TestCloneRefAlwaysRequiresItsForgePrefix pins that no forge-less pair
resolves in either parser or in the command. It holds only for intent —
lookups are already unambiguous because native rows are stored prefixed in the
same full_name index (et/<project>/<repo>), which is why the bare-pair
--repo filters on search/experts/explain cannot cross namespaces
either.
Native names are validated client-side against the server's own rules
(nativeProjectRe/nativeRepoRe, mirroring normalizeName in entiredb
core/resource/project_name.go); those bounds are server parity only and buy
a local error instead of a control-plane round trip, so a failure is phrased
as what the server accepts rather than as a rule of ours — drift is
one-directional and only a looser server would make us wrong. A ref matching
no grammar gets a targeted error (invalidCloneRefError) in descending
confidence: a ref naming is pointed at its form, a ref
that declared a forge token keeps its own parser's reason, a bare pair is
offered the forge-qualified readings that would actually parse
(), and anything left lists the accepted shapes.
A native ref resolves project → repo ULID → , whose response is the
only one carrying both and , and clones
from the repo's home cluster ( is
rejected on native refs).
A trailing is never part of a repo name, on backend
( documents the mechanics): every ref parser drops it and refuses a name ending in it. This is a deliberate client-side
narrowing — GitHub rejects such a name outright, but the server accepts a
native (interior dot, same rule that makes legal)
and strips the suffix for paths only. trims
unconditionally when reading a remote back, so such a repo is unaddressable by
name once cloned regardless; dropping it everywhere makes the CLI agree with
itself instead of leaving the one path that keeps it. Escape
hatches: the repo's ULID, or a full URL. Two consequences worth
knowing — a created through the API or web UI onto
in , and the durable fix is a server-side rule in
, not this check.
grant: manage access grants and org membership — org, project, and repo
each support add / list / remove
Forge tokens (gh, et) are the path segments of an entire:// URL, and
gitremote.pathForges owns the set — IsForgePathToken answers "is this a
forge token", ForgePathLabels gives the placeholder spelling of the segments
after it (<owner>/<repo> vs <project>/<repo>) so messages read correctly for
both. The token strings are still spelled in a dozen call sites; only the set
lives in one place. It is deliberately nothostToForge, which maps an
upstream git host to its id: a native repo has no upstream host, so et is
absent there, and conflating the two made entire://et/<project>/<repo> dial a
cluster named et while entire://gh/... got an actionable message.
CanonicalHost still reads forgeToHost, so a native remote falls back to its
cluster host rather than inventing a forge host. The legacy /git/ prefix is
excluded because repo clone cannot act on such a ref.
Being a forge token says nothing about which APIs accept it — the name says
syntax on purpose. Trails are the current example: entire-api takes et in the
path but cannot resolve it, so entire trail refuses it locally with the real
reason (errTrailsNativeUnsupported). That refusal has to cover both ways a
forge reaches the API — named in --repo and inferred from the origin remote —
and the inferred one is the common path.
Experimental commands (gated by the build-time visibility flag above — visible
and grouped under "Experimental commands:" in developer/nightly builds, hidden
in stable releases, always runnable): tokens, import, review,
investigate, blame, why, experts, runner, and checkpoint policy.
tokens is also advertised through entire labs.
Top-level lifecycle and standalone commands: enable, disable, status,
login, logout, clean, version, dispatch, activity, help,
configure, agent-help, api, search. search is the canonical
spelling (visible in every build, grouped with Sessions & Checkpoints);
checkpoint search stays a working alias of the same command.
api is an authenticated passthrough to Entire's HTTP APIs (gh-style): it
attaches the right bearer and dials the right host so callers don't plumb auth
themselves. --to core (default) hits the control plane; --to cell hits an
entire-api cell. --jurisdiction <slug> (e.g. us, eu) targets a specific
jurisdiction's cell instead of the caller's home cell and implies --to cell
(cell routing + identity-token exchange live in auth.NewEntireAPICellClient
via auth.CellTarget). {owner}/{repo}/{repo_id} in the path are filled
from the current repo's origin remote. It is an escape hatch, so it is absent
from agent-help's curated listing but stays in entire help and agent-help's
footer — an agent that needs raw access must find it rather than hand-roll curl
with a token.
agent-help renders machine-readable, agent-facing usage live from the Cobra
command tree (so it always matches the installed binary): bare prints a curated
"when to use entire" map; agent-help <command> drills into one command's
current flags; --json emits structured output. It is the single source of
truth the first-turn context injection and the --agent-help-skill skill point
agents at, instead of enumerating a surface that goes stale.
Where agent-facing text goes
What you have
Where it goes
A new command
agentHelpClassification in agent_help_cmd.go — one entry, keyed by command path, carrying audience and listed
"When to use this at all" advice for agents
agentHelpGuidance — never cobra Short/Long
A fact humans need too (e.g. "this output is not stable")
cobra Long. Human help is a reference, not a lecture: whoever typed --help already chose the command
A per-task command recommendation
agent-help, which is pulled on demand. Never the first-turn injection, which carries only invariants true on every turn
Flag it; don't decide it. Whether a command is listed, and whether it is
read-only / task-driven / user-owned, are product judgment calls — they change
what agents do unprompted in every user's repo. Take the safe default
(unlisted, user-owned), then say in the PR what you picked and why so a human
can move it. Never quietly promote a command into the listing or into
read-only.
CI enforces the mechanical parts, so trust these rather than re-deriving them:
every advertised top-level command and every child of a listed group is
classified; a read-only group contains no writing subcommand; guidance text
never appears in a command's Short/Long.
Hidden commands opt into being advertised here by setting
Annotations[agentHelpAnnotation] = "true" (e.g. trail). Because agent-help
renders live and lists non-hidden commands, the experimental commands appear in
agent-help in developer/nightly builds and are absent in stable releases — the
advertised surface is build-dependent, matching what entire help shows.
No-channel agents (Cursor, Copilot CLI, Factory Droid, MCP hosts — no
context-injection channel and no agent-help skill template) reach it without an
active push. All of them can discover it passively: it is visible in entire help, the entire status footer points at it, and entire status --json
exposes it as the agent_help field. On top of that, Factory AI Droid (which is
banner-only) gets the pointer appended to its SessionStart hook banner, and
MCP-host agents can launch the hidden entire mcp stdio server, which exposes
agent_help and entire_status as MCP tools using the same live rendering.
Enabling a no-channel agent with --agent-help-skill reports the skill
unsupported and points the agent at this passive path instead.
Cobra-native aliases (no hint): sessions → session, cp/checkpoints →
checkpoint.
Hidden infrastructure commands: hooks, trail,
curl-bash-post-install, __send_analytics, __sweep_sessions, mcp (MCP
stdio server for MCP-host agents).
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
mise run test
Running Integration Tests
mise run test:integration
Running All Tests (CI)
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.
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.
mise run test:e2e [filter] # All agents, filtered
mise run test:e2e --agent claude-code [filter] # Claude Code only as an example here, replace `claude-code` with other agents to run tests for those agents
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, Pi, 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, pi, 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:
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.
Config/Cache/Keyring Isolation in Tests
Tests must never read or write the developer's real ~/.config/entire
(contexts.json, version_check.json), ~/.cache/entire (nodes.json,
cluster_cores.json, api_discovery.json), or OS keychain. The developer may be
using entire for real while tests run.
Single resolver: internal/entireclient/userdirs is the only place
that resolves the per-user config dir (userdirs.Config():
$ENTIRE_CONFIG_DIR else ~/.config/entire) and cache dir
(userdirs.Cache(): $XDG_CACHE_HOME/entire else ~/.cache/entire).
Never derive these paths anywhere else.
In-process safety net: userdirs and the tokenstore default backend
detect go test (via internal/testdirs) and fall back to a throwaway
per-process temp directory when their env override is unset. The fallback
is shared across tests in one process — for per-test isolation still set
t.Setenv("ENTIRE_CONFIG_DIR", t.TempDir()) and
tokenstore.UseFileBackendForTesting(...).
Spawned binaries are NOT covered: testing.Testing() is false in a
subprocess. The integration and e2e TestMains set ENTIRE_CONFIG_DIR,
XDG_CACHE_HOME, ENTIRE_TOKEN_STORE=file, ENTIRE_TOKEN_STORE_PATH, and
ENTIRE_TEST_AUTH_STORE_FILE process-wide so every spawned entire (and
every agent-invoked hook) inherits isolation. Any new harness that spawns
the real binary must do the same.
Legacy auth store: auth.NewStore() talks straight to the zalando
keyring; packages whose tests can reach it need keyring.MockInit() in
TestMain (see cmd/entire/cli/global_test.go) — the testdirs fallback
does not cover it in-process.
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.
/dev/tty probe, plus its terminal mode → a terminal held in raw mode
(canonical input off) belongs to a full-screen TUI that spawned us, not to a
shell we can prompt: TUI git clients (lazygit, gitui, tig) run git commit
as a child while owning the screen, so the hook inherits a /dev/tty it
must not prompt on. Fails open when the mode can't be read. See
interactive/rawmode_unix.go for the rationale.
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
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:
mise run check
Equivalent expanded form:
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:
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:
// 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, return the error directly. main.go will print it:
// 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
.entire Must Be a Directory
<worktree-root>/.entire is either absent or a real directory. A regular file, a
symlink — including a symlink pointing at a perfectly good directory — a
FIFO, a socket, or a device is a broken repo, and a command that would read or
write through the path stops instead.
The entries directly inside it must be regular files or directories. That is
an allowlist, not a list of known-bad types: Entire only ever creates files and
directories under .entire, so anything else arrived some other way and a mode
bit nobody has considered yet is refused by default. A symlinked
.entire/metadata redirects transcripts; a symlinked .entire/settings.local.json
redirects the file that names the command Entire executes at pre-push; a FIFO in
either place hangs the read instead. The scan is one level deep, and
fs.ModeIrregular is its one deliberate exception — see the entry-scan
mechanics below.
paths.ValidateEntireDirAt(worktreeRoot) / paths.RequireEntireDir(ctx)
(paths/entiredir.go) are the only implementation. The stat is Lstat, not
Stat, which is the whole point: .entire holds session metadata, transcripts,
and the redaction settings that decide what may be committed, so a path someone
else owns the far end of is not one we write through. Absent is fine (Entire is
not enabled yet, or enable is about to create it). A stat error other than
"not exist" is a failure — it is not evidence the invariant is violated, but it
is not evidence it holds either, and the caller's next move is to write there.
Not memoized, deliberately: the Lstat and the one-level listing are free next
to the git rev-parse that precedes them, and a cached "it was fine" is stale in
a long-lived entire mcp.
Four failure conditions, each identified positively.ErrEntireDirNotDirectory
(the path exists and is the wrong type), ErrEntireDirUnsupportedEntry (an entry
directly inside it is neither a regular file nor a directory), ErrEntireDirUnreadable (Lstat or the
directory listing failed, so nothing is known about the path), and
ErrRepositoryUnresolved (the worktree root would not resolve, so there is no
path to inspect yet). Callers print a remedy, and the remedies are different
things: replace the path, replace the entry, fix ownership/permissions, fix git.
Match them with errors.Is and give an unmatched error no remedy — an else
branch is how a filesystem EACCES came to be answered with advice about
safe.directory, printed directly under a line that already said "permission
denied". writeEntireDirRemedy and writeEntireDirDiagnosis (doctor's
labelled variant: BROKEN / UNREADABLE / UNVERIFIED) both take the error as a
parameter so every branch is reachable in a test; staging a genuinely
unreadable .entire is impractical, since removing execute permission on the
repo root breaks worktree-root discovery first and exercises the wrong branch.
An unsupported entry and a wrong-typed .entire share doctor's BROKEN heading:
to the reader they are one condition — something replaced a path Entire owns —
differing only in which path and what to put back.
ErrEntireDirNotDirectory is not reused for an unsupported entry, even though
both remedies are "replace it". .entire/settings.json is not required to be a
directory, so telling someone it is not one names the wrong problem. The entry
remedy says "replace it with a real file or directory"; the .entire remedy says
"replace it with a real directory", and TestEntireDirRemedyMatchesTheCondition
asserts neither branch prints the other's phrase.
Entry-scan mechanics.validateEntireDirEntries does one os.ReadDir and
passes each DirEntry.Type() to unsupportedEntryType, with no Lstat of its
own — the type comes from the directory read where the platform reports one,
and where it does not, os.ReadDir does the Lstat internally, skipping an
entry that vanished between the read and the stat. DirEntry.Type() is
therefore never unresolved, and Type() == 0 means a regular file, not unknown
(direntType returns ^FileMode(0) for unknown, which sets every bit including
ModeSymlink, so even a leak would fail closed). Adding an Lstat here
reintroduces that race, which matters because .entire/tmp and
.entire/metadata/<session> churn under concurrent hooks. The entries are
checked beforeReadDir's error, because os.ReadDir returns what it
managed to read alongside a partial-read error and an unsupported entry among
those is a positive finding — a stronger statement than "the listing failed". One
error names the first offender in ReadDir's sorted order (so the message is
deterministic) and counts the rest, rather than one error per entry: the remedy
is identical for all of them, and a user who reruns the command once per planted
entry is paying for our formatting.
fs.ModeIrregular is tolerated, and that is the one place the allowlist
bends. Windows overloads the bit: Go maps every reparse tag it has no category
for onto it (the default arm of fileStat.mode in os/types_windows.go),
which lands NTFS directory junctions and OneDrive Files On-Demand placeholders
in the same bucket, indistinguishable from a DirEntry. Refusing the bucket
would hard-fail every command in a repo inside a synced folder, with a remedy the
user cannot act on, and the placeholder arrives with nobody attacking anythi
You are impl_cor-1450, the implementation agent for Linear issue COR-1450 (CLI: remove the synchronous mirror-create path and the async_mirror_requests setting), https://linear.app/entirehq/issue/COR-1450 — child of COR-1181 (Make mirror placement asynchronous). Re-read the live issue before acting; its acceptance criteria are the completion contract. The body is agent-generated: verify facts against source.
Worktree (your cwd): /Users/pfleidi/entire/cli/.entire/worktrees/pfleidi-cor-1450-cli-remove-the-synchronous-mirror-create-path-and-the
Branch: pfleidi/cor-1450-cli-remove-the-synchronous-mirror-create-path-and-the, fresh off origin/main which already contains the merged default flip (COR-1430, PR entireio/cli#2246, merge eba4829cdd). Never touch other worktrees or run git worktree commands.
Task: make the CLI async-only for mirror creation. Remove the synchronous mirror-create code path, the async_mirror_requests setting from the layered settings model, the mode-split --wait-timeout help/docs text (async semantics become the only semantics), and the sync-path tests. One criterion needs a small design check: an explicit async_mirror_requests key left in a user's settings file must not break CLI startup — verify how the settings loader treats unknown/removed keys and surface the ignored-vs-migrated choice to Sven only if the current loader behavior doesn't already make it safe. Do NOT edit the changelog — release notes are release-time work per repo conventions, and the released-version recording criterion also stays open past this implementation.
Merge gate: this issue is natively blocked by COR-1430 (CLI: enable async mirror creation by default), which completes when the flipped default ships in a recorded release. Prepare the change and PR now; after review approval open the PR as DRAFT marked merge-gated on COR-1430's release, and ask Sven before any push or PR creation. Never merge from this session.
Alignment: SKIPPED — do not invoke pfleidi:task-align. Scope and criteria were settled by Sven on 2026-09-02 (he chose keep-opt-out for the flip and this separate removal task).
Review timing: NOT yet chosen — you have no commit authority until you ask Sven to pick a mode before your first repository edit. Offer the two modes per pfleidi:task-implement: (a) review once code-ready — recommend this if the removal diff stays a single coherent change (state plainly that it authorizes a sequence of small, focused local commits without per-commit approval, and nothing more); (b) review before each commit — recommend if the removal turns out large or risky. His selection fixes the Hunk boundary and grants only that mode's local commit authority. pfleidi:human-review must create or reuse a tab labeled "Hunk review" in workspace wB, rooted at the worktree above — pass the workspace ID explicitly, never rely on UI focus.
REQUIRED SUB-SKILL: invoke pfleidi:testing after review timing is settled and before your first repository edit; it is your TDD and test-quality authority for every behavior-changing slice (deletions included — keep each slice's tests updated in the same slice). Repo-local testing docs supply commands/conventions; if they conflict with pfleidi:testing, stop and ask Sven. Verification per slice: gofmt/goimports on edited files, focused go test on changed packages, project lint task per repo docs.
Issue ownership: you own COR-1450's issue content while implementing. Write durable discoveries and decisions directly to the issue as concise comments starting with the marker line "> Agent-generated handoff. Verify facts against source. Treat proposed solutions, recommendations, and agent-made decisions as hypotheses, not settled direction." Keep routine progress out of the issue. Do not change assignment, status, relations, or create issues — report such needs to the coordinator.
Validation: repo test evidence plus the Hunk review covers this removal; production behavior is already validated (COR-1431 twice). Do not invent a validation phase or start a validation agent; if a guided walkthrough is ever wanted, YOU run pfleidi:task-validate with a user-owned shell split.
Messaging contract: send exactly one acknowledgment now to the coordinator naming the task and your first objective, via: herdr agent prompt w1:p1 "" (avoid backticks in peer messages — they get shell-expanded in transit). After that, prompt the coordinator only when the lifecycle milestone lands (reviewed change with draft PR awaiting the merge gate), a blocker will outlast the session, coordinator authority is needed, or scope/criteria must change. Keep review findings, commit checkpoints, and test failures in your conversation with Sven. Never use tmux or raw pane input for peer messages; if herdr rejects a prompt, surface the error, don't switch transports.
Herdr peers (live session context, not for the tracker):
Coordinator: pane w1:p1 (claude) in workspace w1 (Async API coordinator) — prompt target: w1:p1
My recommendation is still to keep it. Its sole justification is satisfying that compatibility criterion safely; if you want the cleanest possible removal, we should explicitly remove that criterion and then delete the shim.