refactor(server): thread search and git project lookup read V2 - #14015
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This is a large production orchestration refactor that replaces legacy projection reads and infrastructure with V2 services, including a deliberate change to search visibility and GitManager settings resolution. The breadth of deleted shared infrastructure and changed runtime wiring warrants human review. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
13f83a8 to
d75890c
Compare
Thread search is a small ThreadSearch service over the V2 projection, so it covers V2 threads only. GitManager resolves a thread's project through ProjectionStoreV2 and a workspace root through ProjectStoreV2. The V1 lookup missed V2-native threads, so per-project git settings silently fell back to the environment for them. With no readers left, ProjectionSnapshotQuery, ProjectionPipeline, the V1 orchestration runtime layer, the liveness and plan-progress registries only the snapshot query read, and the pipeline-only repositories are deleted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreadSearchError carried only its cause. It now records whether the SQL query or the row decode failed, so a log line is actionable without the cause. The search query stays out of the error because it is user content. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
| import { OrchestrationCommandReceiptRepositoryLive } from "../persistence/Layers/OrchestrationCommandReceipts.ts"; | ||
| import { OrchestrationEventStoreLive } from "../persistence/Layers/OrchestrationEventStore.ts"; |
There was a problem hiding this comment.
These newly added service-layer imports use named Live bindings rather than module namespaces. Could you import each service module as a namespace and reference its layer through that namespace in OrchestrationEventInfrastructureLayerLive? This keeps service wiring consistent with the Effect service boundary convention.
Posted via Macroscope — Effect Service Conventions
|
Correction to my Effect Service Conventions inline comment on Posted via Macroscope — Effect Service Conventions |
4631865 to
5095efd
Compare
613a1b2
into
t3code/codex-turn-mapping
Stacked on #14012.
After #14012,
ProjectionSnapshotQueryhad two readers left, thread search and GitManager's per-project settings lookup. The lookup was also a bug (Bug 3 in the design): GitManager resolved a thread's project from the V1projection_threadstable, so a V2-native thread never matched. Per-project git settings (commit/PR writer model, writing style, worktree submodules) then silently fell back to the environment defaults for every thread created since V2.What changed
ThreadSearchservice (orchestration-v2/ThreadSearch.ts) runs the same ranked query over the V2 projection: one best match per active thread in an active project, user messages over assistant ones, then newest first. It keeps the snippet rules, escaped LIKE and limit. It no longer searches V1 transcripts that haven't been imported yet (the approved design puts V1 search out of scope). wssearchThreadsand the MCPt3_thread_searchtool use it.ProjectionStoreV2.getThreadShell, and a bare cwd resolves throughProjectStoreV2.findActiveByWorkspaceRoot. Both are required services now, not an optional snapshot query.server.tsprovides them to the GitManager layer.ProjectionSnapshotQuery(service, layer, and the tests of its search and enrichment)ProjectionPipeline(service, layer, test)orchestration/runtimeLayer.ts;OrchestrationEventInfrastructureLayerLivemoved toorchestration-v2/runtimeLayer.tsThreadBackgroundLivenessandThreadPlanProgress, registries only the snapshot query readisPersistenceError, the exportedparseAttachmentIdFromRelativePath, and the exports ofMONITOR_TASK_TYPES/INERT_TASK_TYPESNo wire or contract schema change.
Verification
vp exec tsc --noEmit -p .in apps/server and packages/contracts: 0error TS/warning TS.vpr knip:check: clean.vp linton touched files: no new warnings.vp test run, in small groups, all passing:ThreadSearch.test.ts(real SQLite): user over assistant, newest user wins, streaming/system/archived/deleted threads and deleted projects excluded, limit, literal%.GitManager.test.ts(115), including a new case: a V2-native thread (created only throughProjectionStoreV2, cwd outside the project root) gets its project'stextGenerationModelSelectionoverride. It fails against the old V1 lookup and passes now.McpHttpServer.test.ts,worktree/registration.test.ts,PullRequestSyncReactor.test.ts,ws.test.ts,serverRuntimeStartup.test.ts,runtimeLayer.test.ts,ProjectionRepositories.test.ts,integration/transferBudgetV2.integration.test.tsLegacyV1Cutover.integration.test.ts,LegacyV1ThreadImporter.test.ts,V1ImportBoundary.test.ts,ProjectSettingsUpgrade.integration.test.ts,055_*(3 files),056_*OrchestratorReplayFixtures.integration.test.ts+.contract.test.ts,OrchestratorReplayRecovery.integration.test.tsModel: Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code