---
name: execute-test
description: Execute one scoped browser, API, or CLI test packet in a fresh agent and return validated observations with durable evidence to a SnagBadger coordinator.
---

Read the supplied packet and [the response contract](../../../docs/integration/agent-testing.md), using the runner root's copy if installed separately. Work only on this test. Read `packet.context`: root-to-parent guidance followed by one emphasized test. Its original `test.body`, resolved instructions/settings and authored checkbox checklist are the execution contract. Follow free prose directly when no checklist was authored; preserve unknown frontmatter as data without executable authority. The coordinator has already prepared setup and owns lifecycle cleanup/recording.

For browser tests, use the supplied **isolated context/page handle**. Target/select it before browser actions; never substitute the default shared browser session or open an unrelated new tab. Use semantic snapshots/tool locators to act and inspect results. Save screenshots to real files, linking them to observations. Video is started/stopped by the coordinator.

For API and CLI tests, use the project's declared environment and record requests/responses or complete command output as diagnostic evidence. Keep observations separate from hypotheses. An unavailable prerequisite blocks execution; an assertion contradicting an established expectation fails it; uncertainty or interrupted execution is incomplete. Passing requires observed support for the expected outcomes.

Maintain one Attempt with stable packet.attemptId, timestamps, actual behavior, authored/observed reproduction steps, recorded interactions, evidence, and optional reproduction metadata. Evidence attachment entries require corresponding saved file paths in the response envelope. Structured diagnostics are JSON values. Evidence/interaction IDs must be unique and all references must resolve.

When the runtime exposes measured AI usage, include cumulative per-attempt `usage` following [the token contract](../../../docs/integration/test-run-viewer.md). Replace checkpoints rather than adding them. Missing usage is unavailable; never estimate it from text. Keep coordinator/shared work outside this attempt.

After each meaningful step, write a response file and invoke `progress --output ... --response ...` so interruption retains completed observations. Use outcome incomplete and endedAt null for progress. Avoid placing secrets in diagnostics; leave necessary sensitive artifacts for the configured evidence review rather than claiming they are sanitized.

Finish by writing the final envelope with the current request ID, ok true, and value containing attempt plus attachments. Invoke `complete` for that request. Report an observed failed/blocked/incomplete result as a successful transport response; ok false means the worker itself could not produce a valid attempt. Provide a compact outcome/evidence summary to the coordinator.

Complete exactly this attempt; the coordinator owns automatic retry passes and gives each retry to a fresh agent. Application fixes and tracker tickets are separate work.
