Skip to content

chore(agents): run the agent tooling tests apart from the package tests - #737

Merged
scottlovegrove merged 3 commits into
mainfrom
scottl/split-agent-tests
Dec 3, 2026
Merged

scottlovegrove merged 3 commits into
mainfrom
scottl/split-agent-tests

Conversation

@scottlovegrove

@scottlovegrove scottlovegrove commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Publishing runs npm test through prepublishOnly, and npm test also ran the agent tooling's tests in .agents/scripts/. A slow agent-tooling test timing out there broke outline-cli's 3.2.0 publish, and this repo has the same setup. Publishing should only run the tests for what it publishes.

npm test (vitest.config.ts) now covers only the package's own tests. The agent tooling's tests move to vitest.agents.config.ts and a new npm run test:agents script. test.yml runs it right after npm test, on every pull request and every push to main and next, so every test still runs in CI and both suites run on every merge, without the agent tooling's being on the publish path.

npm run verify gains an onlyWhenChanged option on its steps. The new tests:agents step runs only when something those tests read changed since main (.agents/, its config, the agent docs, src/test-support/, the workflows, package.json, the lockfile, tsconfig.json, lefthook.yml and the agent configs), when a file was deleted or renamed (instructions.test.ts checks every file the agent docs name exists), or when nothing changed, since verify then checks the tree anyway. Otherwise it prints - tests:agents skipped: nothing it reads changed since main; CI runs it on every pull request and counts as passed. It starts after the package's tests: package-contents.test.ts packs dist/, which those rewrite, and two vitest pools side by side slow each other into timeouts.

The agent tooling's tsconfig no longer loads vitest/globals, since vitest.agents.config.ts doesn't enable globals. AGENTS.md, CODEBASE.md, CONTRIBUTING.md, docs/agents.md and the verify and write-tests skills describe the split.

Publishing runs npm test through prepublishOnly. A slow agent-tooling
test timing out there broke outline-cli's 3.2.0 publish, and the same
setup is here: npm test also ran the tests in .agents/scripts.

npm test now runs only the package's own tests. The agent tooling's
tests get their own config, vitest.agents.config.ts, and script,
npm run test:agents. CI runs it on every pull request, after npm test.
npm run verify runs it only when something those tests read changed
since main, through a new onlyWhenChanged on verify steps; otherwise
it says it skipped them and CI runs them.
@scottlovegrove scottlovegrove self-assigned this Dec 3, 2026

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR cleanly splits the test suites: npm test now runs only the package's tests, the agent tooling's tests move to vitest.agents.config.ts behind a new npm run test:agents script that CI runs on every pull request, and verify gains a well-tested onlyWhenChanged skip so agent tests run locally only when something they read has changed. The split is coherent end to end, and the config changes preserve behavior the agent tests rely on.

Few things worth tightening:

  • With prepublishOnly no longer covering the agent tooling, no workflow runs npm run test:agents on merge to main — the release workflow could run it in its own job or step (off the publish path) to keep merge-skew breakage detectable and stay within the Tests standard.

I also included a few optional follow-up notes in the details below.

Optional follow-up notes (4)
  • P3 .agents/scripts/lib/verify.ts:80: When nothing changed since the base, changes is [] but changed is still { paths: [] }, so tests:agents is skipped right after verify prints "No changes since main; checking the tree anyway." The message promises the whole tree runs, then the agent tests don't. Either pass undefined when changes.length === 0 (running every step, matching the message) or reword the no-changes message so the skip isn't a contradiction. The existing test for this case only uses pass('lint'), so no onlyWhenChanged step exercises it.
  • P3 .agents/scripts/lib/verify.ts:80: This new changed shadows the existing const changed = changedCodePaths(before, after) in the "Files changed during the run" block a few lines below, so the same name now means two different things in one function. Renaming one of them (e.g. stepsChanges here, or changedPaths there) keeps the two concerns distinct.
  • P3 vitest.config.ts:11: The split itself is unguarded. Nothing fails if this include regains .agents/ (publishing runs the agent tests again — the timeout that broke a publish) or if a test file lands outside both src/ and .agents/scripts/ and so runs in neither npm test nor npm run test:agents. steps.test.ts already reads repo config to compare verify with CI, so a test asserting every tracked *.test.ts is matched by exactly one of the two configs' include would pin both directions.
  • P3 package.json:22: Before this split, npm run test:watch (plain vitest) also watched the agent tooling's tests; now it watches only the package's tests, and there is no watch counterpart for test:agents. Anyone iterating on .agents/scripts/ has to rerun the full test:agents command each cycle. Consider a test:agents:watch script (vitest --config vitest.agents.config.ts), or mention the manual command in the write-tests skill.

Share Feedback • Review Logs • Trace

Comment thread .github/workflows/test.yml Resolved
…n unchanged tree

npm run verify skipped the agent tooling tests when nothing changed,
right after saying it checks the tree anyway, and when a file was
deleted or renamed, though instructions.test.ts checks every file the
agent docs name. It now runs them in both cases.

test.yml also runs on pushes to main and next, so both test suites run
on every merge without the agent tooling's being on the publish path.

The agent tooling's tsconfig no longer loads vitest's global types, as
their config doesn't enable globals. The test helpers folder is shared
between instructions.test.ts and verify's step, and the docs say
pre-push runs only the package's tests.
@scottlovegrove
scottlovegrove merged commit 7bcfad4 into main Dec 3, 2026
6 checks passed
@scottlovegrove
scottlovegrove deleted the scottl/split-agent-tests branch December 3, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants