Skip to content

11 server tests fail on main: FoundationPersistence (9) and Orchestrator.control-reads (2) #449

Closed

Description

@tannerpolley

Found by the independent review of PR #443 on 2026-11-17. Both files fail the same way on clean main 0f7b792335 and on the #443 head, so #443 didn't cause them.

  • apps/server/src/orchestration-v2/Orchestrator.control-reads.test.ts: 2 of 33 fail.
    • delegated-task history read volume: "expected 49655 to be at most 2479.4";
    • the message.dispatch query plan shows SEARCH … waiting_link_idx.
  • FoundationPersistence.test.ts: 9 of 70 fail.
    • durable-effect recovery;
    • single-worker claiming;
    • provider-turn start beside title work;
    • the pending-title cap;
    • then "does not reclaim a running effect after its process-local lease expires", which hangs to the 120 s timeout, and 5 more after it.

The read-volume failure could be a real performance regression, since it reads about 20 times more than the test allows.

To find out:

Run the tests as agent-heavy with the vite-plus fallback PATH. Never use ~/.t3/userdata.

Activity

  1. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Three more failures already on main, found by the #434 worker (PR #459): apps/server/src/orchestration-v2/ProjectionStore.fork.test.ts fails 3 tests on main 2178125d7c, and the same 3 on the PR branch. That makes 14 known failures on main: control-reads 2, FoundationPersistence 9, ProjectionStore.fork 3. The investigation running for this issue should cover this file too.

  2. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Detail from the PR #459 review. Two of the three ProjectionStore.fork.test.ts failures are query-plan checks (:1222, :1332). The third, :906, checks a value and may be a real bug. getLimitRecoveryCandidates still returns an archived thread that hit a usage-limit failure ("expected {…} to equal undefined", the first case in that loop). That could auto-resume an archived thread once the limit resets. Not verified at runtime. Treat it as the top priority of this issue.

  3. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    More failures already on main, found by the #452 worker (PR #460) and re-run on main:

    • Web: apps/web/src/lib/openIssueLink.test.ts (now openRepositoryIssueLink.test.ts) still expects Forgejo to count as an issue host. That's probably a stale test left from refactor(issues): use GitHub as the only active issue host #431 (GitHub only).
    • Web: the ChatMarkdown.browser.test.tsx double-click selection test fails.
    • Lint: the touched issue files carry 32 lint diagnostics, which fail check:changed's lint step and the pre-commit hook. The PR had to commit with --no-verify.
    • Typecheck: apps/mobile has 3 typecheck errors.

    The archived-thread recovery case (ProjectionStore.fork.test.ts:906) is still the top priority.

  4. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Investigation result (2026-11-17)

    All 14 failures came from the fork's sync merge 721ba11236, "chore(sync): merge upstream nightly 20261116.4800", which landed through PR #428 as 7abb7f1cbe. They are sync regressions, not upstream bugs and not older fork bugs.

    • Upstream main 13ecf5b22e and the nightly 7d32075e37: control-reads 31/31 and FoundationPersistence 64/64 pass.
    • Fork parent d9c88282ab: control-reads 29/29, FoundationPersistence 67/67 and ProjectionStore.fork 14/14 pass.
    • The merge and every main commit since fail the same 11 + 3. The cause is how the two sides were combined; no single commit on either side causes it.

    Runtime risk. The failing tests describe real behavior:

    • two workers claiming one durable effect ("allows only one worker to claim": 2 instead of 1);
    • title generations taking every effect worker, so provider-turn.start is never claimed;
    • recovery after process loss requeuing 2–4 effects instead of 1;
    • a delegated task reading about 20 times the allowed history (49,655 against a limit of about 2,479);
    • an archived thread with a usage-limit failure still counted as a recovery candidate;
    • the recovery-index and queued-message queries not using their indexes.

    These may explain the unexplained stalls in #367.

    Full failure messages and per-commit logs are in the investigator's report (thread result). The fix comes next, on main.

  5. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code status: Done

    Issue: #449 11 server tests fail on main: FoundationPersistence (9) and Orchestrator.control-reads (2)

    Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-449-fix-2026-11-17

    Model: claude-opus-5-5

    Branch: issue-449-11-server-tests-fail-on-main

    Updated: 2026-11-17T22:27:46.268Z

  6. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code closeout: done

    Issue: #449 11 server tests fail on main: FoundationPersistence (9) and Orchestrator.control-reads (2)
    Thread: thread:delegated-task:command%3Amcp%3A53eed4d4-49de-4205-ba6f-a35a0b15b7c9%3Adelegate-task%3Aissue-449-fix-2026-11-17
    Model: claude-opus-5-5
    Branch: issue-449-11-server-tests-fail-on-main
    Completed: 2026-11-17T22:27:45.880Z

    All 14 tests that failed on main now pass on my branch, and draft PR #466 is open with "Closes #449". I haven't merged it.

    Verification: the four affected test files pass (123/123), including the 3 originally named plus ProjectionSettlement.test.ts, where I added the assertion you asked for. vp run check:changed also passes (format, lint, knip, typecheck, 8 test files). The branch merges cleanly onto the current origin/main. The PR body lists the 14 failing tests on main and the passing run on the branch.

    Why it failed, by group:

    • FoundationPersistence (9): the merge took upstream's version of the "filters worker replay and live queues" test, which dropped the fork's Layer.fresh(layerTest). That test leaves two pending run.silence.check effects from the fork's silent-completion check. Without the fresh layer they stayed in the shared test database and broke every later claim, title-cap, lease and requeue test. The fix puts back .pipe(Effect.scoped, Effect.provide(Layer.fresh(layerTest))). This was test isolation only, not a product bug.
    • control-reads (2): these tests come from upstream and catch fork reads that walk a thread's whole history.
      • For delegated tasks, the merge kept the fork's broad reads in three places where upstream had narrowed them. I put back upstream's getRunProviderRecords, the subagentChildThreadIds filter, and run-scoped reads in offerDelegatedCompletionDelivery. The fork's run-less delegation keeps working.
      • continueAdmissions loaded the full thread shell; it now reads only the thread row, still skipping deleted threads.
      • EndedRunTurnItems walked the thread; turn-item reads filtered by run now use upstream's existing rowid IN (…) lookup.
    • ProjectionStore.fork (3):
      • The subagent usage-limit lookup lost its index to a new upstream index, so I pinned it with INDEXED BY on the fork's usage-limit index.
      • The other two were stale tests. I fixed them as you approved: the archive step now also sets the archived_at column, and the expected query plan line is now upstream's bounded covering-index search.

    Your two conditions:

    • Archive proof: no existing test checked archived_at after a real archive event. I added one assertion to "sql: a subagent thread becomes a candidate once its parent is done" in ProjectionSettlement.test.ts. It passes, so the archived-thread auto-resume risk wasn't real. The PR quotes the assertion.
    • turn_items_recovery_idx: no query names it now, upstream or fork. An upstream migration creates it, not a fork one, so dropping it is your follow-up call. The planner can still pick it on its own. I left it in place.

    The test at ProjectionStore.fork.test.ts:1222 is still titled "search the recovery index", which no longer matches; I didn't rename it.

    PR #466, head 376ee7a, checks and reviews: none reported yet (draft, no checks running, no review)

  7. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Correction to the 2026-11-17 "Investigation result" comment's runtime-risk list, based on the root cause in PR #466:

    • FoundationPersistence (9): these were not product bugs. The merge dropped Layer.fresh(layerTest) from one upstream test, which left two run.silence.check effects in the shared test database. Those leftovers broke every later claim, title-cap, lease and requeue test. So "two workers claim one effect", "title generations block turns" and "over-requeue" were test artifacts, not live behavior.
    • Archived-thread recovery: this was a stale test, not a bug. A real archive writes the archived_at column, which the new assertion in ProjectionSettlement.test.ts confirms.
    • control-reads (2): these are real read regressions. The merge kept the fork's broad delegated-task reads where upstream had narrowed them. That is the part that could add load, and it's the part relevant to Server event loop stalls for up to 11 s every few minutes, and every request in flight stalls with it #367.

    PR #466 is in Checker review before merge. Follow-up for the owner to decide: the upstream-created turn_items_recovery_idx index is no longer named by any query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions