Repository navigation
fix(server): restore the reads and test isolation the 20261116 sync merge dropped - #466
Merged
Merged
Conversation
…erge dropped The sync merge 721ba11 (#428) kept fork code where upstream had narrowed reads, and dropped one fork test isolation, so 14 server tests failed on main: - FoundationPersistence: a fork test lost Layer.fresh, so its run.silence.check effects leaked into later shared-database tests. - control-reads: delegated tasks read the parent's whole history again (upstream getRunProviderRecords, subagentChildThreadIds and run-scoped completion delivery reads were dropped); fork continueAdmissions and EndedRunTurnItems walked the thread. - ProjectionStore.fork: the subagent usage-limit lookup lost its partial index to upstream's new type index; two fork tests asserted fork-only details upstream replaced (archived_at column, type-index plan). Closes #449 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tannerpolley
marked this pull request as ready for review
November 17, 2026 22:40
This was referenced Nov 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
14 server tests failed on main after the upstream sync merge
721ba11236(#428). Both parents pass them, the fork parentd9c88282aband the nightly7d32075e37. Each failure comes from how the merge combined the two sides.Root cause per failure group
FoundationPersistence: 9 tests
Merge hunk:
FoundationPersistence.test.ts, "filters worker replay and live queues". The fork wrapped this test inEffect.scoped(…).pipe(Effect.provide(Layer.fresh(layerTest)))(added in 436c0d0). Upstream pingdotgg#35993 removed theEffect.scopedwrapper, and the merge took upstream's version, which dropped the fork'sLayer.fresh.The test writes completed runs that have no assistant reply. The fork's silent-completion check in
EventSink.tsenqueues arun.silence.checkeffect for each one. Without a fresh layer, those two pending effects stay in the shared in-memory database for every later test in theit.layerblock. The extra effects explain every failure in this group: two claims, never claimingprovider-turn.start, title-cap misses, requeue counts of 2–4, and the 120 s lease hang. Logged before the first failing test:Fix: restore
.pipe(Effect.scoped, Effect.provide(Layer.fresh(layerTest))).Effect.scopedmust sit inside the provide so the test'sacquireReleaserestore runs before the fresh database closes. This was test isolation only; no product bug.Orchestrator.control-reads: 2 tests
These tests come from upstream (nightly). They catch fork reads that walk a thread's history.
dispatchDelegatedTaskRequest: upstream readsgetRunProviderRecords(parentThreadId, parentRunId, parentNodeId); the merge kept the fork'sgetThreadRecords(parent, [runs, nodes, subagents, providerThreads, providerTurns, attempts]). Fix: use upstream's run-scoped read. The fork's broad read stays only for a run-less delegation (parentRunId === null), minussubagents, which nothing used.reuseManagedChildreads only.thread, so its parameter type is nowProjectionRecords<never>.finalizeAppOwnedSubagent: the merge dropped upstream'ssubagentChildThreadIds: [childThreadId]filter on the parent subagent read. Fix: restore the filter. The loop already skips other children.offerDelegatedCompletionDelivery: upstream reads only the parent run and its provider thread; the merge kept the fork's read of all runs and provider threads. Fix: userunIds/providerThreadIdsfilters. The fork'sparentRunId === nullpath (thread-level cohort) is kept.message.dispatch: the fork'scontinueAdmissions(IssueWorkCommands.ts) loaded the full thread shell for each queued run just to readlinkedIssueandrole. Fix: read the thread row (getThread), keeping the deleted-thread skip that the shell read gave.queued-run.cancel: the fork'sEndedRunTurnItemsreads byturnItemRunIdplus a status filter, which seeksthread_ordinal_idx (thread_id=?). Fix: inProjectionStore's turn-item read, use upstream's existingrowid IN (…)seek for a run filter too, not only a type filter.ProjectionStore.fork: 3 tests
turn_items_thread_type_idx (thread_id, type, status), and the planner now picks it over the fork's partialusage_limit_idx. Fix:INDEXED BY orchestration_v2_projection_turn_items_usage_limit_idxon that fork subquery.AND t.archived_at IS NULLin place ofjson_extract(payload_json,'$.archivedAt') IS NULL). Real archive events write the column: the thread upsert inProjectionStore.tssetsarchived_atfromnullableStringField(payload, "archivedAt"). The test archived byjson_setonpayload_jsonalone. No test asserted the column after an archive event, so I added one assertion to the closest archive projection test,ProjectionSettlement.test.ts("sql: a subagent thread becomes a candidate once its parent is done"):thread.archivedevent applied through the projector writesarchived_at. The fork test now sets the column with the payload, as a real archive does (owner-approved).rowid IN (…)through upstream's covering type index, and dropped the fork-onlyINDEXED BY …_recovery_idxbranch. The new plan is bounded:SEARCH orchestration_v2_projection_turn_items USING COVERING INDEX orchestration_v2_projection_turn_items_thread_type_idx (thread_id=? AND type=? AND status=?). The expected plan line was updated (owner-approved); the filtering and order assertions stay. The test title still says "recovery index".turn_items_recovery_idxusage: after this change, no query names it, on either side. The index is created by an upstream migration (Migrations/OrchestrationV2/RecoveryIndexes.ts), not a fork one, and nightly doesn't name it either. The planner may still pick it for queries without a hint. Not dropped here; that is a follow-up decision.Evidence
On main
4a0f11ee58(logs from the #449 investigation):On this branch:
No test was skipped or weakened. The branch merges cleanly onto the current
origin/main(1077162d6d).Closes #449
Done by Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code