fix: preserve search evidence and asynchronous job ownership - #299
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ebb1fc3e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return true, false, err | ||
| } | ||
| return stored != nil, nil | ||
| return true, coverage != nil && coverage.Complete, nil |
There was a problem hiding this comment.
Treat stale thread coverage as unknown
When stored.SourceUpdatedAt is newer than the completed threads coverage, this returns complete=true, so an empty duplicate or collision result is exposed as complete negative evidence even though the thread snapshot predates the latest repository observation. buildTUISyncStatus already classifies this exact timestamp relationship as stale; apply the same freshness check here before claiming complete coverage.
AGENTS.md reference: AGENTS.md:L12-L16
Useful? React with 👍 / 👎.
Summary
Make search results, related-work findings, and asynchronous tool results reflect the evidence actually available. This also removes duplicate owners for thread identity, relationship parsing, and ranking expressions, and repairs queued-job ownership across process loss.
This PR follows a repository audit and reproduced defects; no separate issue was supplied.
Problem and expected behavior
Thread search could bury title matches, lose merge-state facts, or apply cursors to a changed query. Evidence lookup also did work proportional to unrelated matches. Related-work checks could turn zero-signal neighbors into findings and report completeness despite missing thread coverage or a bounded candidate population.
Successful indexing could produce an invalid detailed MCP job response; source reads lost completeness metadata, and validation groups lacked readable attempt handoffs. An abandoned queued job remained queued indefinitely, while a running job marked failed by another process could continue executing.
Change and scope
Review order follows the commits: search; evidence ownership; MCP and job lifecycle; then the requested Go MCP SDK prerelease update.
Contract and boundary impact
Evidence and regression coverage
Validation performed
make verify— passed with SDK v1.8.0-pre.2 on the current base, including uncached short tests, vet, full lint, module tidiness, generated outputs, and documentation checks.go test -race -short -p=1 -parallel=4 -count=1 -timeout 120s ./internal/app ./internal/corpus -run 'Test.*Job|Test.*Owner|Test.*Reconcil|TestRelatedWork|TestDuplicateAndCollision'— passed during the prior audit with SDK v1.7.0 on the updated SQLite base.go test -race -short -p=1 -parallel=4 -timeout 600s ./internal/app ./internal/corpus ./internal/mcpserver ./internal/workspace— all four packages passed; this broader audit run used SDK v1.7.0 and began before the upstream SQLite update.go test ./internal/mcpserver ./internal/mcpcontract ./internal/mcpadapter ./internal/app— passed with SDK v1.8.0-pre.2.go test -race ./internal/mcpserver -run 'TestToolCancellationReachesReader|TestStructuredCancellationIsNotRetryable' -count=1— passed with SDK v1.8.0-pre.2.git diff --check— passed.Compatibility and safety
docs/search-audit.md; no new global ranking-quality or concurrency-throughput claim is made.Review checklist
type(scope): outcome.