GeezerVison is showing github.com — fix(shared): derive file candidates from thread evidence by juliusmarminge · Pull Request #21927 · pingdotgg/t3code
Conversation
Relative file references currently resolve only against the thread workspace, even when the agent read the file in another checkout or outside every project. This layer adds conservative candidates derived from visible thread activity; it does not change ordinary resolution or open any files.
It collects file/tool/search paths and literal command operands, follows a simple cd only within one command, and matches unique whole path suffixes or one evidenced outside folder. Ambiguous, bare, parent/home and already-evidenced root targets stay unchanged. Clients in the next layer verify the candidate and retain every existing root entry.
Rebuilt from @yair’s #20861, addressing #10553. The ordinary resolver remains unchanged; no project probing, shell execution, server state or wire changes.
Verification: 226 focused shared cases pass across markdown, file links, paths and thread search. Three new behavior tests in the existing markdown suite replace the original standalone collector matrix; a substantive collector regression and the UNC/quoted-operand fixes were checked red then green. Scoped shared types, lint and formatting pass. Windows comparison is unit-tested; no Windows shell or native client execution is claimed. Integrated app evidence belongs to the dependent client layer.
Post-publication finding fixed: relative file-change, tool and search evidence now resolves against the supplied cwd before indexing. Absolute paths keep their spelling; null/nonabsolute roots invent no target, and the immutable-item cache still invalidates when cwd changes. Six behavioral assertions failed across the same three existing tests before the fix; all 226 shared cases, shared types, lint and formatting pass at 11ceb63040. No new test definitions were added.
Independent full-stack review: six pre-integration rounds plus one clean integrated round on both Opus and Sol. The core patches replayed unchanged; 149 markdown cases passed again on the integrated head.
Implementation: GPT-6.1-Sol in Codex; tests: GPT-6-Astra in Codex; independent full-stack review: Claude Opus 5.5 and GPT-6-Sol.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
juliusmarminge
changed the title
misc 02/thread file candidates
fix(shared): derive file candidates from thread evidence
Oct 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This PR adds a new public shared-library capability with substantial command parsing, path resolution, indexing, and matching logic. Existing product behavior is preserved and current production callers do not use it, but the implementation is too substantial for automatic approval.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
| Provider |
Metric |
Main baseline |
This PR |
Impact |
PR ceiling |
|
| Codex |
Total thread wire |
4.9 KiB |
5.0 KiB |
+23 B (+0.5%) |
6.8 KiB |
✅ |
| Codex |
Thread snapshot wire |
3.8 KiB |
3.8 KiB |
0 B (0.0%) |
4.9 KiB |
✅ |
| Codex |
Live turn WebSocket wire |
1.2 KiB |
1.2 KiB |
+23 B (+1.9%) |
2.0 KiB |
✅ |
| Codex |
Live turn WebSocket decoded |
20.8 KiB |
20.9 KiB |
+41 B (+0.2%) |
29.3 KiB |
✅ |
| Codex |
Live turn messages |
1 |
2 |
+1 (+100.0%) |
8 |
✅ |
| Claude |
Total thread wire |
5.0 KiB |
5.0 KiB |
0 B (0.0%) |
6.8 KiB |
✅ |
| Claude |
Thread snapshot wire |
3.8 KiB |
3.8 KiB |
0 B (0.0%) |
4.9 KiB |
✅ |
| Claude |
Live turn WebSocket wire |
1.2 KiB |
1.2 KiB |
0 B (0.0%) |
2.0 KiB |
✅ |
| Claude |
Live turn WebSocket decoded |
21.2 KiB |
21.2 KiB |
0 B (0.0%) |
29.3 KiB |
✅ |
| Claude |
Live turn messages |
2 |
2 |
0 (0.0%) |
8 |
✅ |
Baseline: f0fb0e8 · PR result: 11ceb63 · Source CI: success
Scenario and decoded snapshot size
10 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.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
e3ff6f97-563d-4001-be52-6d982caa1313
📥 Commits
-
Reviewing files that changed from the base of the PR and between ecf5bf3 and 11ceb63.
📒 Files selected for processing: 2
-
packages/shared/src/markdownLinks.test.ts
packages/shared/src/threadFilePaths.ts
Limit details: You’ve used all 10 included reviews currently available.
📝 Walkthrough
-
The shared package adds utilities to collect file paths from thread items, index and match those paths, and resolve relative Markdown links to thread-evidenced file candidates. It also exports the path utilities and adds tests for collection, matching, and candidate resolution.
Changes: Thread File Path Resolution
| Layer / File(s) |
Summary |
Collect paths from thread items packages/shared/src/threadFilePaths.ts, packages/shared/src/markdownLinks.test.ts |
Path collection handles supported thread items and limited shell syntax. It normalizes, caches, and deduplicates collected paths. Tests cover command-derived path evidence. |
Index and match path evidence packages/shared/src/threadFilePaths.ts, packages/shared/src/markdownLinks.test.ts |
The index stores absolute paths and directories. Matching rejects invalid or ambiguous references and returns unique file or directory matches. Tests cover path segments, positions, case handling, and rejection cases. |
Resolve Markdown-link candidates packages/shared/src/markdownLinks.ts, packages/shared/package.json, packages/shared/src/markdownLinks.test.ts |
resolveThreadFilePathCandidate matches parseable relative links against the thread index and preserves parsed positions. The package exports the path utilities. Tests cover collection and candidate resolution. |
Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant ThreadItems
participant collectThreadFilePaths
participant createThreadFilePathIndex
participant resolveThreadFilePathCandidate
ThreadItems->>collectThreadFilePaths: Provide supported item path evidence
collectThreadFilePaths->>createThreadFilePathIndex: Supply collected absolute paths
createThreadFilePathIndex->>resolveThreadFilePathCandidate: Provide path index
resolveThreadFilePathCandidate->>resolveThreadFilePathCandidate: Match relative link and preserve parsed position
Loading
Suggested reviewers: maria-rcks
Merge Risk: ⚪ Minimal · up to 11ceb
-
No actionable issue is established for this layer. It is ready to merge after normal checks.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly and concisely describes the primary change: deriving file candidates from thread evidence in the shared package. |
| Description check |
 |
The description explains the problem, implementation, scope limits, linked issue and prior work, verification results, limitations, and agent usage. It does not include a separate explicit maintainer … |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Description check
-
Explanation
The description explains the problem, implementation, scope limits, linked issue and prior work, verification results, limitations, and agent usage. It does not include a separate explicit maintainer approval comment, but the overall description is complete and focused.
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt
Note This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @juliusmarminge, and thanks for the credit. Your PR body lists a few gaps it couldn't verify, so I tested the stack on three of them: remote access, real agent runs, and my thread history. The live runs used cd7a007b83. I reran the replay and the parser checks below at d6a63e5f31, after 11ceb63040; the results didn't change.
Real agent runs over a remote origin. I built the stack and served it on a tailnet address. The browser connected over plain HTTP, so isSecureContext was false. Real Claude Haiku 5.5 threads did the tool calls themselves, against made-up fixtures:
- a project thread whose agent read a gitignored worktree, a sibling repo and an outside folder;
- a "No project" thread.
Every chip opened the right file: the ignored worktree, the outside folder, and a 4 s recording, which loaded in the player at 0:04. A same-named file at the project root still won. The only failure was "Copy full path" ("Failed to copy"), and that's the browser's secure-context rule for clipboard writes, not this stack.
Replay of my history. This covers 162 threads (98 Claude, 64 Codex) and 392 distinct relative file references. It mirrors useThreadFilePath's verification and ChatMarkdown's fallback, and checks every target on disk:
What the 4 missing links have in common. In every case, the only evidence was a command like cd <dir> && rg -n foo src/a.ts | head. The command parser drops a command's evidence entirely when it contains a pipe, a glob, a redirect, or the '"'"' escaping that wrapped shells use for inner single quotes:
| command |
stack |
#20861 |
cd /work/other && cat src/a.ts |
/work/other/src/a.ts |
same |
cd /work/other && cat src/a.ts | head -20 |
nothing |
/work/other/src/a.ts |
cd /work/other && cat src/a.ts 2>/dev/null |
nothing |
/work/other/src/a.ts |
cd /work/other && ls src/*.ts |
nothing |
/work/other |
/bin/bash -lc 'cd /work/other && cat src/a.ts' |
/work/other/src/a.ts |
/work/other only |
/bin/bash -lc 'cd /work/other && grep '"'"'x'"'"' src/a.ts' |
nothing |
/work/other only |
Unwrapping bash -lc is an improvement over #20861. But agents very often end a command with | head, | tail or 2>/dev/null. A cd in a leading && chain still sets the directory of every stage in the pipeline that follows. So that cd could be kept, with only the unsupported tokens skipped (glob words, redirect targets) rather than the whole command. The verification gate would still catch anything wrong. My older, frozen pre-0.1.0 database shows the same pattern, more strongly: 9 links lost this way, against 1 gained.
One correction to my original PR body: those 139 threads were 82 Claude and 57 Codex threads, not all Claude.
(The replay ran on a private copy of my database, which has been deleted. Only counts are reported here.)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for this. Before a bug fix is taken further, the bug is reproduced on current main, and here it did not appear.
I ran the scenario from the issue on current main (c76ba84) in the web client. I set up two sibling checkouts, app-a and app-b, where only app-b has src/api/rules/categories.ts. In a thread on app-a, a real agent turn ran cd ../app-b && cat src/api/rules/categories.ts and answered with [categories.ts:7](rules/categories.ts:7) plus the inline code rules/categories.ts:7.
Clicking the chip opened app-b/src/api/rules/categories.ts with line 7 highlighted, and "Copy full path" on both the link and the inline-code chip copied the app-b path. Main already resolves these references when they are opened or copied, through #35036 (other projects in the environment) and #36364 (folders the agent worked in during the turn). The only place the stale app-a path still shows is the chip's hover target, and this pull request does not change that on its own either.
Since the user-facing problem is already gone on main and these helpers have no caller here, there is no remaining bug for this change to fix. If the evidence-based matcher catches cases the existing lookup misses, a pull request that wires it in and shows such a case failing on main would be the way to bring it back.
Closing this pull request. If it still happens for you, please open an issue with the exact steps, what you see, and the version and platform you are on; a fix is picked up from there.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
macroscope-review
Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews
size:L
100-499 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|