docs/tests.md
Tests
Run commands from the repository root. The justfile owns recurring commands; the documentation index routes to code and contract owners. Choose coverage before running it.
Commands
| Command | Coverage |
|---|---|
just test-go-package PACKAGE *ARGS | One Go package or package pattern, with optional Go test flags |
just test-go *ARGS | Default Go coverage: non-AgentHub root packages and the nested module, with Go's normal result cache |
just test-go-fresh | Same non-AgentHub Go coverage with -count=1 for deliberate fresh execution |
just test-go-agenthub *ARGS | AgentHub-owned Go packages only. Without ARGS, packages with a matching test stamp are skipped and listed |
just test-go-all *ARGS | Complete root and nested Go coverage, including AgentHub, with the same stamp skips |
just test-stamps-refresh | Every stamped AgentHub Go package and fixture checker, ignoring stamps; rewrites the stamps of those that pass |
just test-ruby-source | Ruby source tests using an existing bundled interpreter |
just test-dist | Isolated Linux distribution archive and installer fixtures, with the real config writer and a pseudo-terminal |
just test-agenthub-fixtures | Independent AgentHub literal checks; check-public.rb is stamped |
just test-agenthub-e2e | Builds, then runs only tests/suites/test_agenthub_process.py |
just test-hub-deep | Builds, then runs the hub deep tier: all AgentHub Go ignoring stamps, every fixture checker and both AgentHub Python suites |
just check-go | gofmt -l over tracked Go files and native go vet ./... of the root and nested modules; the first stage of test-quick, test-full-offline, test and vet |
just vet | check-go, then AgentHub and frontend cross-platform compile and vet; run at merge review |
just test-quick | Non-AgentHub Go, Ruby source tests, Python quick cases |
just test-full-offline | Root/nested Go with AgentHub stamp skips, Ruby source tests, AgentHub literals, all provider-free Python cases |
just test | Full aggregate with AgentHub stamp skips, including AgentHub literals and ordinary configured-model Python cases |
just test-llm | Provider-dependent Python cases, with live OpenAI separately opt-in |
just test-remote-muse-live | Opt-in real local then AF_UNIX-relayed Muse Spark responses, using existing built artifacts |
just test-muse-batch-native BINARY | Installed Muse batching against a loopback fixture, without login or online inference |
just build-two-file-acceptance FAMILY | Only client, service, builtin and the selected Muse or Claude bridge in this worktree's build/ |
just test-native-two-file-live PROVIDER/MODEL | Opt-in single-prompt, two-file native smoke with strict response-batch and next-request evidence; rebuilds only required artifacts |
just test-remote-claude-live | Opt-in real two-daemon Claude acceptance with consumer tools/plugins, user/tool PDFs and warm continuation, using existing built artifacts |
just test-claude-native-live | Opt-in Haiku structured-interface checks with the shared MCP proxy and a fake host |
just test-claude-catalog-live | Opt-in installed Claude model listing through the built bridge, without inference |
just test-claude-restore-native | Opt-in installed-native transcript loading and cleanup under private login-free roots, without a user prompt or inference |
just test-claude-entrypoint-native | Opt-in installed-native request attribution against a local fake API under private roots, with a dummy key and no Anthropic inference |
just test-claude-mcp-native | Opt-in installed-native MCP stdio initialization and mcp_reconnect through the Unix relay under private roots; no login, prompt or inference |
just test-claude-bridge-live | Opt-in bounded Haiku bridge catalog/usage, cold signed-history restoration and loaded-Agent end-to-end cases, using the built Claude bridge |
just test-claude-media-live | Only the bounded Haiku user/tool image/PDF, held-tool media steer and warm-media journey, using the built Claude bridge |
*ARGS means optional arguments, not a literal argument. Go recipes do not build
shipped binaries. Aggregate, AgentHub process and ordinary LLM recipes build
first. The Muse live recipe never builds. The Ruby source recipe requires the
bundled interpreter to have been built.
just test-go-package ./pkg/service -run '^TestBubblewrapRealBuiltin$' -v
uses the shipped builtin and its sibling bundled Ruby in build/, or the
builtin executable named by EZAGENT_TEST_BUILTIN. It copies both beside the
test binary and configures the builtin by absolute path, with no separate Ruby
service. It skips if the binaries
are absent or the host cannot create the required namespaces. The test uses
an isolated stdio fixture and does not call a model. It runs both Normal and
Offline; the latter also requires nsenter.
just test-go-package ./pkg/service -run '^TestBubblewrapRealSharedSystem$' -v
starts two separate stdio providers in the same real sandbox. It checks file
and PID sharing, cache script execution, provider recovery, shutdown, and home
persistence across restart. The POSIX shared-memory subtest uses system
python3 and skips if it is absent inside the sandbox.
just test-go-package ./pkg/service -run '^TestBubblewrapRealRestrictedSocket$' -v
checks the same local socket in each supported Bubblewrap network mode. The
provider must reach the restricted listener and list leaves, while the host
runtime path and trusted socket are absent and the private socket cannot be
removed or moved. When adding a mode, rerun this probe with that launch policy.
Pathname Unix sockets do not depend on the network namespace.
just test-go-package ./pkg/service -run '^TestBubblewrapReal(EngineSockets|DisablesNestedUserNamespaces)$' -v
checks that the launcher exposes only the selected test-owned Unix socket,
scrubs inherited engine settings and denies creation of a nested user namespace.
The tests do not need a container engine. They skip if Bubblewrap cannot start;
the nested-namespace test also needs util-linux unshare.
just test-go-package ./pkg/service -run '^TestBubblewrapRealOfflinePreview$' -v
uses the built tunnel provider in build/ (or EZAGENT_TEST_TUNNEL) to check
that both sandbox loopback families reach the tool's listener instead of a
host decoy on the same port. It checks that only loopback is up, DNS fails
without a nameserver, host loopback and available LAN listeners are unreachable
from the sandbox, and the host cannot reach an unforwarded sandbox port (an
unrelated host listener on that port number is not a failure; only the
sandbox's marker is). It skips when the host cannot create the namespaces or
lacks nsenter.
just test-go-package ./pkg/service -run '^TestBubblewrapBackgroundCapability$' -v
registers a real background capability over the restricted socket in Normal,
Offline and private-localhost, each behind its own prerequisite check, and
skips where the kernel lacks SO_PEERPIDFD.
Use test-go or test-quick for unrelated development. AgentHub-owned Go
packages are internal/agenthub/..., cmd/ez-agent-hub/...,
internal/hubfeature/... and pkg/ezhubapi/.... They remain in place and run
through test-go-agenthub; shared CLI, frontend and TUI regressions stay in the
default set. Run the Hub scope when changing those packages or shared code
whose behavior affects Hub TLS, transport, storage or lifecycle. A focused
test-go-package selection is still appropriate while editing.
Before merging a change to AgentHub-owned code or to internal/privatefile or
pkg/jsonlpipe, run just test-hub-deep.
test-go-all, test-full-offline and test explicitly include AgentHub. Do not
use those full-repository checks for unrelated work unless that coverage is
requested. Their AgentHub Go and fixture stages skip stamp-matched targets, and
a skipped target was not tested in that run. test-full-offline includes the
Go, Ruby and Python quick coverage; do not precede it with another Go aggregate
or follow it with an E2E suite it already contains. Ordinary just test also includes configured-model tests;
test-llm selects only Python llm cases, not Go/Ruby unit tests. Live OpenAI
remains separately opt-in.
Arguments to test, test-quick, test-full-offline and test-llm go to Python,
not Go. A leading suite, path or node selector runs only that Python scope after
building. A leading option such as -k retains the aggregate language stages.
Friendly aliases live in tests/run_tests.py.
The runner resolves only the first selector. Pass any further selectors as
paths relative to tests/, such as suites/test_background.py.
| 1 | just test-full-offline protocol |
| 2 | just test-full-offline tests/suites/test_builtin.py::TestBuiltinSubprocess::test_hello_and_announce_on_startup |
| 3 | just test-llm plugin-queries::test_leaf_stats_and_history_after_one_prompt --model=ollama/YOUR_MODEL |
Offline recipes pass --no-llm and cannot execute provider-dependent cases.
Run online or LLM-dependent tests only when the user explicitly requests them.
just vet runs check-go and the maintained AgentHub/frontend cross-platform
compile and vet checks. No test aggregate runs the cross-platform part. Cross-compilation does not establish runtime coverage.
The nested cd ez-agent-ruby && just test remains available for source-lock and
toolchain-cache shell checks as well as Go packages. Repository aggregates invoke
nested Go unit tests directly. A new Ruby runtime tree may run
ez-agent-ruby/runtime/profile-test.sh during its build; the quick recipe adds
neither another profile nor a forced cold rebuild.
Native two-file acceptance
The provider-free tests/suites/test_native_two_file.py suite runs the production
Claude and Muse bridges and builtin buffer through the standard daemon fixture.
The native processes are the existing pkg/service/agent fake-native fixtures,
with modes that request file reads and derive their answers only from MCP results.
They never read those files themselves. Muse emits one native two-call batch and
then invokes its MCP handlers serially. The suite compiles the fixtures into a
temporary build/ directory and removes it afterward. It needs prebuilt client,
service, builtin and both bridge artifacts; ordinary Go recipes do not build them.
| 1 | just build-two-file-acceptance claude |
| 2 | just build-muse-bridge |
| 3 | python3 tests/run_tests.py native-two-file --no-llm -s |
| 4 | just test-go-package ./pkg/service/agent -run 'TestConfiguredMuseBridgeAgentToolJourney|TestRemoteExternalMuseHeldToolContinuation|TestClaudeLoadedAgentSteerDuringHeldTool$' |
The acceptance creates two real temporary files whose random contents do not appear in the prompt. Transparent stdio audits record only the owned provider's completion requests and terminal events, plus the builtin's buffer dispatches and results. Assertions require all of the following:
- One terminal model response contains both reads with distinct call IDs and the expected file paths. Eventually reading both files across separate responses fails.
- The first real buffer result precedes the second host dispatch. No tool opts into parallel execution.
- The immediate next provider request contains both finalized results, matched to the original provider call IDs, with success status. Their content and call IDs must equal the persisted, sent tool-result turns. Native source-turn metadata is optional and is not required for ordinary Muse tool results.
- The final assistant answer contains both file contents. There are exactly two provider requests in this bounded journey, with no inference between results.
Claude retains its single-read regression and cancellation case. The latter holds
one real builtin result at the stdio boundary after a full two-call response,
then sends the normal daemon abort. After the prompt finishes as aborted, the
test releases that result while the daemon is still running and waits for a
post-flush audit marker. A normal RPC confirms the daemon is still serving.
The second tool must not dispatch and no next provider request may occur, both
after forwarding and in the complete logs after process retirement. These checks
use wire behavior, not internal phases, counters or timing assumptions.
The opt-in live recipe rebuilds only the client, service, builtin and selected
bridge from the current worktree. It makes one prompt, permits at most two
provider completion requests and has a 120-second prompt deadline. It does not
retry or accept a single-call fallback. It requires explicit authorization to
spend live inference; neither ordinary tests nor --no-llm can run it.
Provider-free recipe checks execute the real shell recipe with stubbed build
and pytest entrypoints, verifying exact model selection and optional argument
forwarding without a build, daemon launch or inference.
| 1 | # Online: run only at the authorized live-validation stage. |
| 2 | just test-native-two-file-live muse/muse-spark-1.3 |
| 3 | just test-native-two-file-live claude/claude-haiku-5-5 |
PROVIDER/MODEL selects the exact native ID, not a friendly model alias. Muse
uses the installed official launcher selected by --muse-command and the
existing config directory selected by --muse-native-config-home, as in the
relay fixture. Claude uses the installed claude on PATH and the standard
native-state alias. Both start under fresh config/state/runtime directories;
only the supported native login directories are aliased. No auth file is read
or copied, no app is installed or upgraded, and no production daemon is stopped.
The standard isolated built client stops the test daemon. Bridges own native
child cleanup; the harness checks retirement and purges only Claude's recorded
temporary projects. Audit records and temporary files are removed on teardown;
passing runs print the response and next-request call IDs as evidence.
Muse requires the native interface verified on 1.4.20-R8619.1, including the
experimental MSP turn/toolBatchSubmitted notification and exact MCP
_meta.callId join. Multi-call model support itself is not experimental. The
separate installed-native offline check runs the production backend against a
loopback fake Responses API under private, login-free roots. It verifies one
two-call batch, serial held handlers, distinct IDs despite equal arguments, and
both finalized results on the immediate next native request. An error result
retains Muse's native tool failed: prefix. This is not a configuration
exclusion test. The observed private project entry wins over a same-name global
endpoint on this version, but unrelated inherited MCP servers can still start.
See the configuration limitation.
The check never reads native login files or contacts a model endpoint. Select
the already-installed payload directly so the launcher cannot install or update it:
| 1 | just test-muse-batch-native /home/developer/.local/bin/muse-bin-1.4.20-R8619.1 |
That check establishes the native adapter contract, not live Muse daemon acceptance. The strict live smoke still fails if Muse returns successive single-call responses. It does not weaken that assertion or retry the prompt.
Live Muse local and relay acceptance
just test-remote-muse-live makes four completions with muse-spark-1.3 at
minimal thinking. Each local and relayed leaf answers an initial prompt, then
handles a separate background-completion steer on the same loaded leaf. It does
not use a fake provider or treat discovery as a completion. Run it only with
explicit permission to spend those four live completions.
Ordinary test runs skip this case unless --live-muse is supplied; --no-llm
still skips it even with that flag.
Prerequisites are Linux, Python test dependencies, the built client, service,
builtin and Muse bridge in build/, and the official installed Muse launcher
at /home/developer/.local/bin/muse with an existing native login entitled to
Muse Spark 1.3. The launcher must already have its native binary installed.
Acceptance never runs login, installs or updates Muse, or reads/copies an auth
file. Before launching anything, it reads only the official installation's
non-secret .muse-version metadata beside the resolved launcher and checks the
selected executable muse-bin-<version>. Missing/invalid metadata and missing
or non-executable payloads fail with their paths. Login/entitlement and network
availability are established only by the real completions, not a preflight
catalog. A missing prerequisite is a blocked acceptance, not a mock pass.
| 1 | just test-remote-muse-live |
| 2 | # Override only when the official installation or its native config is elsewhere: |
| 3 | just test-remote-muse-live --muse-command=/absolute/path/to/muse --muse-native-config-home=/home/USER/.config |
| 4 | # Offline checks for the acceptance flow, without rebuilding or contacting Muse: |
| 5 | python3 tests/run_tests.py remote-muse-fixture --no-llm |
| 6 | python3 tests/run_tests.py remote-providers --no-llm |
The test creates two fresh EzAgent configs, with separate config/state/runtime
directories and no LLM credentials supplied to either daemon. Builtin startup
may create its normal empty auth template. Only the host's isolated config
directory contains a muse symlink to the existing native configuration,
defaulting to ~/.config/muse. A host-only wrapper records native process
ownership without changing XDG directories. It does not restore the running
EzAgent configuration, runtime or state.
The host uses the real built bridge and exports muse/muse-spark-1.3; the consumer
saves only host/muse/muse-spark-1.3 and the host's isolated AF_UNIX socket.
Each completion must persist its unique requested token and the selected model
identity. The real bridge additionally requires native session/start to report
the requested model ID. The test checks consumer-owned roots, parent/tip turns,
one leaf per daemon, unchanged host history after relay use, and unchanged saved
selections. A registered background owner retains each leaf between executions;
the second completion comes through the normal finalized steer path. Exactly
one native process per leaf must handle both completions. It disables offered
tools/plugins and uses _suppress_auto_title.
Both daemons stop through the isolated built client on success or failure. Native
process-group termination stays with the bridge, which owns its native child
until it signals and reaps it. The wrapper's historical group numbers support
only an independent disappearance check. A still-present group fails the test;
the harness never sends a destructive signal based on a historical PID record.
No live-orchestrator client or stop is used.
On completion failure, pytest reports terminal frames and stored error-turn text
before deleting temporary state. Use that reported evidence, not paths into the
deleted temporary database. A native session-start failure can mean the existing
login cannot access the requested model. Missing installed-payload prerequisites
are reported separately before any daemon or native process starts.
Do not respond by copying credentials into the consumer or by retrying login in
the test. Remote unavailable flags point to socket/export discovery; confirm
the host config has remote_eligible: true and the socket points at the isolated
host. There are no automatic completion retries. Fix the prerequisite before
deliberately rerunning the two-request acceptance.
Claude bridge integration
just build-claude-bridge builds only the Claude executable in build/.
just test-claude-catalog-live uses that artifact and installed Claude to read
the native initialization catalog through the external discovery parser. It
isolates all three XDG roots, sends no user input, disables native session
persistence and checks that the bridge advertises only supported settings without
inventing token ceilings. It neither tests entitlement nor spends inference usage.
Offline internal/claudebridge tests cover controlled initialization replies,
aliases, omitted/malformed metadata, catalog bounds and cancellation/reaping.
just test-claude-bridge-live requires that artifact and explicitly spends the
provided claude-haiku-5-5 subscription. It does not build or run an aggregate.
The adapter case covers cumulative per-API usage and warm tool additions,
removals and schema updates while an old result is held. The loaded-Agent cases
use real storage, normal finalization and tool admission to cover text/thinking,
processed results, idle continuation, native restart, independent checkpoint
forks, lost-session readable recovery, held-tool cancellation and user steers
accepted while a host tool is blocked. The steer regression checks native
priority-next input, preserved input order and one host execution. Offline native
fixtures also complete a tool message and then exit or report failure before
opening its MCP handler, proving prompt failure without host dispatch.
just test-claude-media-live selects only the attachment journey. It runs through
real Agent storage, FiletypeGate and the built bridge at Haiku high thinking.
Small deterministic PNG/PDF fixtures check fresh user media, a steer while the
tool is held, finalized tool image/PDF results and a new attachment-bearing warm
prompt on the same owner. PDF markers appear only inside their bytes, not prompt
labels. The tool ID remains the original native ID and the host runs it once.
Offline tests cover mixed text/image/PDF order and metadata, labeled recovery
ownership, checkpoint suffix-only media, malformed/unsupported inline data,
FiletypeGate warnings and Muse's unchanged MCP text default. Loaded-owner gate
transition regressions cover enabling/disabling images or PDFs after idle and
while a result is held. They require successful newly gated recovery, preserved
tool-result IDs/media, one host execution and no restart for equivalent settings.
Native documents in
tool results use the supported owned PostToolUse replacement, not a user message.
The bounded TestClaudeBridgeErrorMediaLive case checks the distinct MCP error
path. Claude 2.1.322 omits that media and does not call PostToolUse. The bridge
must report the limitation and retain no unconsumable replacement, while the
canonical result and error flag remain intact. Offline cases cover accumulated
media above the former installed-history limit, recovery with that history,
documented encoded image-size accounting, no invented image-count/PDF ceiling,
and unchanged direct Anthropic acceptance. These are controlled data checks, not
live capacity stress or proof of a native maximum.
These cases preserve the installed native login. They isolate XDG directories,
use private temporary projects and record only owned CWD/launch-flag names, not
prompts, stderr, transcripts, tool data or credentials. Cleanup stops owned
children and invokes official claude purge for those exact temporary projects.
Ordinary Go runs skip live inference. Deterministic fixtures cover private-only
and redacted messages, split records, serial tool blocks, malformed associations,
post-boundary crashes, result matching and interrupt/drain. The socket relay also
has an offline native-transport check.
Two-service Claude acceptance
just test-remote-claude-live runs only the bounded real service-to-service case
in tests/suites/test_remote_claude_live.py. It requires existing service, client,
builtin and Claude bridge artifacts plus the official claude on PATH and an
existing native login. It neither builds nor runs a local-host completion first.
Only the host configures and exports the Claude provider. The consumer has only
the remote provider, a new empty HOME, no native state link, and a controlled PATH
where neither Claude nor the bridge resolves. Each daemon has
separate XDG config, state and runtime roots; only the host links its Claude
application state to the existing native directory. No auth files are read or
copied by the test.
The consumer discovers and selects the exported Haiku model at high thinking. A normal consumer capability peer executes one deterministic offered tool. Its plugin replaces the raw result with a unique finalized receipt, which must reach the real hosted model. Small user and tool PDFs come from the same fixture generator as the Go attachment checks. The test requires real text/thinking stream events, consumer-side assistant/native/history persistence, exact native tool/result association and the expected source-route tag. A generic background owner keeps the leaf loaded for a second prompt with a new token. One bridge launch, one native launch and one native session prove healthy warm continuation. The host's conversation database must remain unchanged, and a same-name host tool must never run. The capability IPC call ID and native tool-use ID are checked at their respective boundaries, not equated.
Both isolated daemons stop through the standard fixture. Claude's owned native
group and the bridge's PID are checked separately with read-only probes. Only
after both retire and daemon teardown succeeds does official claude purge
remove the recorded test project. A failed retirement/teardown check skips purge.
Offline fixtures inject native-group, bridge-PID and daemon teardown failures to
cover that ordering. This tests the existing
trusted AF_UNIX provider relay, not SSH, remote onboarding or a native feature
matrix. --live-claude is mandatory, and --no-llm still overrides it. The
remote-claude-fixture suite checks that opt-in guard and the real two-daemon
capability setup without inference.
Claude native interface checks
just test-claude-native-live uses the official claude on PATH, its existing
subscription setup, and claude-haiku-5-5. Run it only with explicit permission
for live inference. It does not build or launch an EzAgent daemon. Default
internal/claudebridge tests use a controlled native child and never infer.
The bounded live cases cover structured controls, native thinking capture, pre-tool IDs and serialized MCP calls, completed-record/stream ordering, warm input, checkpoint forks and source-session resume. They check finalized MCP results rather than exact final-answer wording. High adaptive thinking may omit thinking on a trivial tool prompt; a short reasoning follow-up checks signed capture when needed. Rare redacted blocks and error/race cases use fakes.
The fixture isolates all three XDG directories and a fresh workspace, retains
the installed native login without reading credentials, and reproduces the
installed state link. Native transcripts can still live outside XDG. After the
exact children stop, claude purge removes only the owned temporary project's
native data. See native bridge ownership and mapping.
Focused checks
During implementation, test the changed behavior and relevant callers. Select named regressions or the owning package rather than running every aggregate. For example, dispatcher changes can use these alternative selections:
| 1 | just test-go-package ./internal/agenthub/peer -run '^TestTypedDispatchDuplicateAndAbandonedInboxes$' |
| 2 | just test-go-package ./internal/agenthub/peer -race -run '^TestTypedDispatch' |
Use focused race coverage for changed concurrent ownership, cancellation or
shutdown. Broader race and maximum-capacity runs need an assigned owner and a
specific uncovered risk. Do not self-assign them as completion gates.
When Go tests build helper processes separately, parent -race alone does not
instrument those helpers. Follow the fixture's instrumentation support.
For Python-only feedback with current binaries already in build/, avoid an
unnecessary aggregate rebuild:
| 1 | python3 tests/run_tests.py protocol --no-llm |
python3 tests/run_tests.py cwd-activity --no-llm covers cwd summary alignment,
temporary/empty-leaf exclusion, empty-root startup cleanup, persisted unloaded
status after restart, and running/background/idle projection convergence
through shipped daemon sockets. Running work uses the controlled local provider
from the background suite, not an online model. Assertions poll the asynchronous
projection with bounded deadlines rather than treating acknowledgements as a
publication barrier.
Keep durable regressions for supported behavior. Test verification, persistence,
security and lifecycle guarantees at meaningful boundaries; do not mock the
behavior under assertion. Controlled fakes can supply dependencies, clocks,
transport results and failures while the real wrapper or API logic runs. Test
our policy and ownership rules rather than repeating the TLS library's own
coverage. Keep focused real-TLS tests for role wiring, certificate-disclosure
ordering and authenticated shutdown; shared connection machinery should not
require a separate full integration matrix for every caller.
Remove one-off probes after investigation. Keep tests
and their data with code, not under docs/. Review skill prose as documentation,
not as wording to freeze in tests.
In multi-agent work, assign one owner for each validation scope. Implementers
report focused commands, results and untested scope. Reviewers reuse those
results and check missing coverage rather than repeating the same tests.
At merge review, the integration owner runs the authoritative just build,
just vet and one selected offline aggregate after assembly and review. If the
user tests a build, run the checks on that same revision before handing it over
or while the user tests it. Required checks must pass before final merge approval
is requested. Approval itself does not trigger another run; revalidate only
when the merge needs conflict resolution or otherwise changes what was
validated. Standalone contributors own the integration step; finishing
an editing task needs focused checks, not a separate aggregate. If integration
finds a regression, fix it with spot tests before rerunning the necessary checks.
Documentation-only edits need relevant content/link checks. Rebuild when validating embedded resources.
Production timers
Test a production timer, deadline or polling interval with testing/synctest
instead of a real wait or a new package-variable timing seam. Wrap the test in
synctest.Test so its goroutines run on the bubble's fake clock. Keep real
listeners, such as httptest servers, outside the bubble and have their
handlers send Connection: close so no idle connection outlives a request.
In pkg/service tests, close the server's remoteProviders before the bubble
exits. Do not use synctest for a test that blocks on sync.Mutex, a real
socket or a subprocess, or that calls signal.Notify.
pkg/service/watchdog_lifecycle_test.go
and pkg/tui/inbox_commands_test.go are
examples.
Cache and timing
Keep recurring commands and flags consistent so Go can reuse passing results.
Do not add -count=1 or repetition counts by default. Use fresh execution
deliberately for reproduction, timing or flake investigation, either on a
focused selection or through just test-go-fresh for an assigned Go aggregate.
For deliberate fresh AgentHub or complete Go measurements, use
just test-go-agenthub -count=1 or just test-go-all -count=1. These commands
disable test-result caching, not Go's build cache. Like any Go flag, -count=1
also bypasses test stamps.
Reuse a result only when its tested source, helpers and relevant environment are unchanged. Failed packages, changed test binaries and different selections need new results. A cached pass is useful regression evidence, not fresh timing or flake evidence. Report the command, source revision, relevant environment, result and any coverage excluded from the selection.
Routine repeat validation should fit within ten minutes, including necessary build and focused race work. This is a budget, not a claim that current commands already meet it. An all-cached pass or renaming a slow run does not demonstrate that budget. Reduce duplicate setup and obsolete coverage while preserving distinct TLS/security, persistence and lifecycle assertions.
The Go recipes use EZ_AGENT_GO_TEST_TIMEOUT, defaulting to 30m per package.
That is a failure bound, not a whole-command runtime guarantee or an extension
of production deadlines. Aggregate arguments cannot set Go flags; use the
environment variable for their Go package timeout. Focused Go recipes accept an
explicit -timeout override.
Test stamps
Go's test result cache does not carry across git worktrees, so every new worktree would rerun all AgentHub packages. cmd/teststamp records, in the committed tests/agenthub-stamps.txt, a hash of the inputs at which each self-contained AgentHub test target last passed. The hash uses repository-relative paths, so a stamp recorded in one checkout matches in another that has the same toolchain.
A stamp replaces only the go test run of one self-contained package, or one
run of check-public.rb. It never replaces tests between packages, AgentHub
tests owned by non-hub packages such as internal/frontend, pkg/tui and
cmd/ez-agent, or any Python suite. A skipped target was not tested in that
run. The recipe output lists each one under "NOT RUN in this run, skipped by
stamp".
test-go-agenthub and test-go-all, and so test and test-full-offline,
skip each eligible package whose stamp matches. They run the rest in one
go test invocation and record every eligible package that passes. A package
whose latest attempted run failed, or produced no result, is left with no
matching stamp, so it runs next time. test-agenthub-fixtures stamps
check-public.rb against the trust corpus, the Ruby runtime's tracked inputs
under ez-agent-ruby/ and the interpreter's RUBY_DESCRIPTION. That checker
runs with this checkout's build/ez-agent-ruby whenever it is built, ignoring
EZ_AGENT_RUBY, because the stamp describes only that interpreter. A checkout
with no build runs it with the given interpreter and records no pass. Other
checkers always run and honor EZ_AGENT_RUBY.
Eligibility is computed on every run. A package's test closure, meaning the
package and the in-module packages its test binary links, may contain only
AgentHub packages, internal/privatefile and pkg/jsonlpipe.
cmd/ez-agent-hub and internal/agenthub/clienttransport are ineligible by
name. A string literal starting with ./ or ../ in a package's own Go files
names an input, as do leading string-literal arguments of filepath.Join or
path.Join that join to a path starting with ... Files they name are hashed,
and directories are hashed only below testdata. Any other directory, or a
path outside the repository, makes the package ineligible. A test that reaches
a file outside its package directory and the shared corpus through a computed
path is not detected, so use a literal relative path or keep the file under
testdata. A local replace, vendor directory or active go.work makes
every package ineligible. Ineligible AgentHub packages always run, and the
output names each one with its reason.
The closure hash covers the package's sources, tests, embeds and testdata,
files named by those literals, internal/agenthub/testdata, the non-test
sources of every in-module dependency, go.mod, go.sum and the Go
toolchain environment. Change hashVersion in
cmd/teststamp/inputs.go whenever the hashed input
set changes meaning, so existing stamps read as stale.
Any Go test flag passed to test-go-agenthub or test-go-all, or a non-empty
EZ_AGENT_MAXIMUM_CAPACITY, bypasses stamps. Every selected package runs with
go test's own output and exit status, and no pass is recorded, because a
selection such as -run says nothing about the whole package. A stamped
package that reports FAIL in a bypass run is marked failed, so it runs next
time. A package with no result keeps its stamp. EZ_AGENT_TEST_STAMPS=refresh on either recipe, or
just test-stamps-refresh, ignores matching stamps, runs everything and
rewrites the stamps of targets that pass. A non-empty EZ_AGENT_HUB_DEEP acts
as refresh for the Go stamps, because stamps recorded without the deep tests do
not cover them.
Other environment variables bypass stamps per package. A package whose own Go
files read a variable by literal name through os.Getenv, os.LookupEnv or
os.ExpandEnv runs whenever that variable is set to a non-empty value, as
internal/agenthub/service does for EZ_AGENT_CAPACITY_PROBE=1. The output
lists it with the variable. Its pass is not recorded, even under refresh, and
a FAIL marks its stamp failed. Other packages in the run keep their stamp
behavior. teststamp hash shows the variables each package reads, and
its limits cover reads the scan cannot name.
Each stamp line also counts wrap trials: runs where the closure hash changed while the package's own-files hash did not. They measure whether a key over only the package's own files would have been safe. They are reported and never affect skipping.
Only cmd/teststamp writes the stamp file. Never edit it by hand. Commit the
rewritten file with the source it was recorded against. Resolve a merge
conflict in it by taking either side whole and re-running the recipe, such as
just test-stamps-refresh, not by choosing lines. A file that still holds
conflict markers or a repeated target is discarded whole, so every target runs.
Hub deep tier
EZ_AGENT_HUB_DEEP=1 enables slow AgentHub coverage that ordinary runs skip:
- Eleven composed process scenarios in
tests/suites/test_agenthub_deployment.py.
Ordinary offline runs keep
healthy,entry-state-loss,relay-restartandentry-transition.relay-gracewaits out the real 65-second shipped grace and also needsEZ_AGENT_E2E_REAL_GRACE=1. - Nine maximum-population Go tests in
internal/agenthub/store,peer,directoryandservice. Each package gates them with itsrequireHubDeephelper, exported asdirectory.RequireHubDeepfor the external test package. Inservice, call it beforeparallelServiceFixture.
EZ_AGENT_MAXIMUM_CAPACITY=1 also enables those nine Go tests and, in
addition, the file-descriptor and memory heavy capacity tests.
EZ_AGENT_HUB_DEEP does not enable the capacity tests.
just test-hub-deep builds, sets EZ_AGENT_HUB_DEEP=1, runs every AgentHub Go
package ignoring stamps, runs every fixture checker, then runs
test_agenthub_deployment.py and test_agenthub_process.py. The deep profile
is a superset of the default one, so its passes record stamps. Run it before
merging a change to AgentHub-owned code or to internal/privatefile or
pkg/jsonlpipe. It is not a gate for unrelated work.
AgentHub fixtures
Executable fixtures and literals live under
internal/agenthub/testdata. Run
just test-agenthub-fixtures for their independent checks. It skips
check-public.rb when its stamp matches. These fixtures use
public deterministic test material, not user credentials.
| Corpus | Owner and scope |
|---|---|
| trust | Identity, signed records, pairing, invitations, TLS exporters, storage, gateway, configuration and application literals |
| private | Private administration vectors, configuration and accounting checks |
| circuit | Bootstrap, DATA/ACK, fixed-session and recovery literals |
| carrier | Endpoint envelopes and restricted pairing carrier literals |
| routing | Routing bytes, path selection and rejection cases |
| relay | Relay setup, attachment and control literals |
The local-control corpus is pkg/ezhubapi/testdata/control.json, consumed by pkg/ezhubapi/literal_test.go. Its contract owners are the typed library and local control.
Literal checks establish bytes and codec behavior, not production service
lifecycle or security acceptance. Package *_test.go files own runtime
regressions alongside the AgentHub packages.
AgentHub testkit owns reusable package fixtures;
process suites own shipped-process integration.
The contract inventory routes to behavior owners.
Isolation
Prefer the standard fixtures. tests/conftest.py owns
isolated daemon startup, readiness, model injection and shutdown.
tests/client.py owns the socket JSONL test client.
Package fixtures use test-owned state and join their runtime owners at cleanup.
The controlled global OnStart test checks listener availability with a real Unix
connection from its helper. Hub deployment tests separately require application
API readiness, one shipped Hub child, Hub control readiness, and application
socket creation before control socket creation. OnStart is asynchronous: those
observations need not precede fixture yield and do not prove that application
Accept ran before the child started.
The AgentHub service parallelServiceFixture helper limits concurrent fixtures
to four, including cleanup. Use it for independent fixtures, before allocating
resources and at only one test nesting level; nested acquisition can deadlock.
A table parent that only launches independent gated subtests can call
t.Parallel() without taking another fixture slot. Otherwise, Go waits for that
whole table before starting the next one, leaving fixture slots unused.
AgentHub fixtures advance a virtual scheduling clock to recorded deadlines instead of sleeping through them. TCP/TLS, transport and runtime clocks stay real, and separate cases own real wall-clock deadline coverage.
A Hub setup call such as registration, deletion, invitation or approval can be
refused with a definite conflict when preparation crosses a security second.
A fixture may then make a new decision only after a direct conflict error with
no result at the reviewed revision, and only after a fresh status read shows
the same revision, authority and inventory. Each decision sends a fresh request
for the same reviewed target, up to three in total. Never retry transport
uncertainty, a wrapped or ambiguous error, any other error, or output that
reports success. journeyTypedDecision and journeyDashboardConflict in
internal/frontend/hub_process_fixture_test.go
implement this rule.
Routine circuit-admission and ownership regressions use small component fixtures rather than repeating Hub onboarding, TLS or application roundtrips. The Python shipped-process journeys cover executable wiring and user-visible behavior. Do not repeat that journey for every ownership case or add another end-to-end matrix for each configuration setting.
EZ_AGENT_MAXIMUM_CAPACITY=1 enables the capacity tests, such as the
authenticated application maximum, 2,048 circuits and 1 GiB of retained
ciphertext. They are explicit stress profiles, not shipped defaults or product
maxima, and the largest need 16,384 file descriptors and 12 GiB of available
memory. Their skip messages state what each needs. Run them one package at a
time with an explicit -timeout. Keep their transport, persistence, lifecycle
and security scope rather than scaling them to the 524,288 logical admission
default. They check admitted accounting, not RSS or OOM safety. The variable
also enables the hub deep tier Go tests and bypasses stamps.
start_daemon waits up to 10 seconds for hello_ack with ready: true, retrying
early maintenance replies and connection failures rather than treating socket
acceptance as readiness. restart_daemon waits for the new listener to accept
connections. Both create test-specific runtime/state directories and stop their
isolated daemon cleanly.
Standalone subprocess tests use read_frame in tests/conftest.py. It reads
stdout descriptors directly and retains unread frames and partial lines across
calls, with a monotonic timeout. Do not mix it with buffered reads on the same
stdout pipe. test_subprocess_frames.py covers batching, partial lines, and EOF.
Ruby source tests use test_helper.rb
to replace XDG_CONFIG_HOME, XDG_STATE_HOME, and XDG_RUNTIME_DIR with private
temporary directories before loading the API. This applies to the source runner
and direct runs of individual test files. Children inherit those isolated paths
unless supplied their own fixture paths. Intentional API failures write tombstones
only into test state, not the caller's live audit directory. The helper drains
the shared incident recorder and removes its temporary tree on exit or failure.
The provider-free workflow service-exit test gates its Ruby history observer on
the held provider stream starting. Admission is then durably sent, so history
hydration cannot race the ready-to-sent transition. Observer failures terminate
the seed process and preserve its output in the Python failure report.
Workflow cancellation sends no abort before acceptance. A fake prompt RPC that
waits for abort therefore holds close for about 13 seconds. Answer it with
PreparedWorkflowTest.release_prompt_on_cancellation from
workflow_test_support.rb,
which releases the RPC once cancellation starts. Tests that need an unanswered
RPC must not use it.
Before any manual client/service launch or ad hoc daemon test, isolate all three
of XDG_CONFIG_HOME, XDG_STATE_HOME and XDG_RUNTIME_DIR. Subagents inherit
the running orchestrator's environment. Use built binaries under build/, not
$AGENTCLI, for test launches and shutdown. Stop only the exact test daemon with
the built client under the same isolated XDG environment. Never stop the live
orchestrator or use broad pkill/killall. Use kill only for a specific
unresponsive test daemon.
Never inspect, read, copy, hash, print or probe auth files. Config helpers may
copy config.yaml and record an external auth path, but only the service's
protected auth loader accesses credentials. Test config directories use mode
0700, including under a group-writable umask. Offline fixtures use synthetic,
provider-free configuration without reading user auth.
Computer-use checks
Requested manual and agent-driven tmux cases are in Computer-use checks. Select the affected interaction; they are not an automatic coding or merge gate.
Rendered regressions live in pkg/tui; native ownership and handoff
regressions live in internal/frontend.
The AgentHub process suite provides
scripted shipped-process coverage. just test-agenthub-e2e selects it explicitly;
do not repeat it if the selected offline aggregate or just test-hub-deep
already ran it. Its optional
tmux captures require explicit opt-in and an owned test session.
Live OpenAI
The live suite tests the public
OpenAI Responses runtime. Ordinary just test-llm skips live_openai cases.
Selecting openai-live through the friendly runner adds --live-openai;
direct pytest use must supply that option. Run only with explicit user approval.
Repeat --live-openai-subscription-ref and --live-openai-api-ref for configured
provider/model refs. Each ref is an independent case, so a missing subscription
model does not gate paid API cases. The labels describe the intended auth route;
configure that route in config.yaml. There are no dialect selectors or fixed
model rosters.
| 1 | just test-llm openai-live --live-openai-config-home="$HOME/.config" \ |
| 2 | --live-openai-subscription-ref=openai/gpt-6-luna \ |
| 3 | --live-openai-api-ref=paid/gpt-6-luna |
These aliases and model names are examples, not required entries. Explicit refs
replace the provider fallback for their route. Without subscription refs,
--live-openai-subscription-provider defaults to openai and expands that alias
to openai/gpt-6-luna; an empty value disables it. The optional
--live-openai-api-provider uses the same model fallback. Either provider option
also accepts a full ref unchanged.
For paid API only, disable the subscription fallback and repeat API refs:
| 1 | python3 -m pytest -q tests/suites/test_openai_live_acceptance.py --live-openai \ |
| 2 | --live-openai-config-home="$HOME/.config" \ |
| 3 | --live-openai-subscription-provider= \ |
| 4 | --live-openai-api-ref=paid/gpt-6-luna \ |
| 5 | --live-openai-api-ref=paid/YOUR_OTHER_MODEL |
Repeatable --live-openai-http-ref selects refs already configured with
responses.websocket: false. The suite does not change transport settings.
For HTTP only, disable the subscription fallback and select the configured ref:
| 1 | just test-llm openai-live --live-openai-config-home="$HOME/.config" \ |
| 2 | --live-openai-subscription-provider= \ |
| 3 | --live-openai-http-ref=http-optout/gpt-6-luna |
Each case checks local model configuration before provider I/O, then exercises a
no-tool prompt, a buffer read of a harmless prepared /tmp file, and a follow-up.
The buffer prompt specifies operator="read" and the exact file:/tmp/... name.
A successful durable result is required, not an exact number of retries or calls.
WebSocket cases require full initial context, incremental continuation on the
same socket, and full context after daemon restart. Configured HTTP optouts
require HTTP before and after restart. Checks use secret-free transport telemetry.
--live-openai-config-home selects the source XDG config home, not its ez-agent
subdirectory. Without it, the fixture uses inherited XDG_CONFIG_HOME, falling
back to ~/.config. It copies only that home's ez-agent/config.yaml into a
private test config home and isolates config, state and runtime XDG paths.
Config directories have mode 0700. An explicit absolute auth_file stays
external; otherwise the default is the source home's ez-agent/auth.yaml.
Relative auth paths and %USER_CONFIG_DIR% are anchored to the source config
directory. The test rig never reads or copies auth. Only the service's protected
auth loader accesses it. The standard daemon fixture owns shutdown and teardown;
ordinary offline fixtures are unchanged.
Offline subscription regressions
pkg/service/config/chatgpt_lifecycle_test.go owns stateful local HTTP coverage
of login, signed OIDC, protected save/reload, refresh generations across restart,
and Responses inference. The Linux suite
tests/suites/test_chatgpt_offline_application.py uses test-only overlays and
standard isolated daemons to exercise configurator handoff, normal prompts,
rotations, and shutdown during consumed renewal. Narrow OAuth pairing, redaction,
permissions, cross-process exclusion, and authorization watcher tests remain
separate. Use fixture-supported GOFLAGS=-race when instrumenting separately
compiled helpers; parent go test -race alone does not instrument them.
Synthetic routing and expiry acceleration never ship or change production TLS
or scheduling. These tests do not establish live OpenAI renewal success.
Background bash regressions
tests/suites/test_background.py is full-offline coverage for generic ownership
RPCs, correlated conflicts, client state/configuration eligibility, abort/delete
kill routing, sticky late-completion rejection, provider loss, and the builtin's
initial-result/completion/buffer/removal contract. Package tests in
pkg/service/background_test.go, pkg/ezagentapi/background_test.go, and
cmd/ez-agent-builtin/internal/builtin/runcommand/background_test.go cover unloaded
registration, eviction/deletion races, detached cancellation, live and empty
captures, timeout while registration waits, completion admission ordering,
terminal status, rejected steers, and shutdown joining. Buffer and compaction
regressions exercise read-only task metadata and registry reminders.
The CLI background suite also checks bundled Ruby Workflow waiting and follow-up. If its first model request misses the admission deadline, it captures startup markers and output even from a live child, plus pre-cleanup process status, the executable path where available, and the daemon-log path. If the child is still the public Go launcher on Linux, failure-only capture records process and lock state and requests a stack dump from the pidfd-pinned child before bounded cleanup. Lock holders are inspected, never signalled. Capture drains both output pipes and preserves partial output and the original failure if diagnostics fail. It does not extend the admission deadline, retry the request, or trace successful runs.