chore(desktop): stop rebuilding a git repo for every question-relay test - #95851
chore(desktop): stop rebuilding a git repo for every question-relay test#95851posthog[bot] wants to merge 1 commit into
Conversation
The question-relay suite built a throwaway git repo in `beforeEach`, but no test in the file runs git or starts a session - the repo only supplies a `repositoryPath` value. Build it once per file instead, and give the hooks that still need a repo per test a 30s budget, because the six sequential git subprocesses can pass Vitest's 10s default on a loaded runner. Generated-By: PostHog Desktop Task-Id: c4419abc-ad95-4cd6-a227-209119aa8881
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
🤖 CI report✅ Trunk lane — non-backend laneThis PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes. |
There was a problem hiding this comment.
Approved.
Test-only refactor confined to one package: moves a git-repo fixture from per-test to per-file setup where no test in question-relay.test.ts actually touches the filesystem, and widens hook timeouts for the git-repo-writing suite. No production code, CI config, or API/data-model changes; diff matches the description.
- 3 of the 3 changed files are governed by
products/desktop/AGENT_APPROVALS.md.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 0L, 0F substantive, 26L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T0 auto-approve: T0-deterministic (26L, 3F, single-area, chore) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ c1bbab6 · reviewed head c1bbab6 |
HostHog preview —
|

Problem
Error: Hook timed out in 10000ms.from thebeforeEachinquestion-relay.test.ts, taking 2 of 2,337 tests down while 125 of 126 files passed.createTestRepo()spawns six sequentialgitsubprocesses plus file writes. The hook ran it for all 51 tests in the file, so one file paid for 306 process spawns. On a shared 4-vCPU runner that setup sometimes passes Vitest's 10s default hook budget, andretry: 0turns the raw failure into a red check.Changes
question-relay.test.tsstarts a session, reads a file, or runs git —repo.pathis only passed as arepositoryPathconfig value. The fixture now runs once per file inbeforeAll, andbeforeEachbuilds only theAgentServer, which touches no disk.agent-server.test.tskeeps its per-test repo, because its tests do write into it, and gets the longer hook budget instead.TEST_REPO_HOOK_TIMEOUT_MS(30s), a shared constant next tocreateTestRepothat records why the default is not enough.retryis untouched.vitest.config.base.tsholdsretry: 0on purpose so Trunk sees raw pass/fail.question-relay.test.tsbeforequestion-relay.test.tsafteragent-server.test.tsafterHow did you test this code?
vitest run src/server/question-relay.test.tsin the sandbox: 51 passed, and the file's test time fell from 1218ms to 109ms.vitest run src/server/agent-server.test.ts: 204 passed, 6 failed. Those 6 (buildCloudSystemPrompt) fail identically on unmodifiedmasterin this sandbox, so they are environment-dependent and not caused by this change.tsc --noEmitandbiome checkare clean on the package.Sandbox note
createTestRepocommits in a throwaway temp repo, so the suite needsPOSTHOG_ALLOW_UNSIGNED_GIT=1to run inside the cloud sandbox, where a git guard blockscommit.Automatic notifications
Docs update
None. No user-facing behavior, API, or documented workflow changes.
🤖 Agent context
Autonomy: Fully autonomous
/simplifypass was done by rereading the diff, since the skill was not available in the session.server, so per-describe scoping would have created several repos per file rather than fewer. CheckingAgentServershowed the constructor never readsrepositoryPath— only session start and PR flows do, and this file exercises neither — so one repo per file is both cheaper and safe.agent-server.test.ts, whose tests write into the repo, kept its per-test fixture.resume-saga.test.tshas the same per-testcreateTestReposhape and was left alone: it has not been observed failing, and widening past the reported symptom was not warranted. It is the next candidate if this flake class returns.gh pr list --state open --searchfor this area found no existing PR.Created with PostHog Desktop from this inbox report.