GeezerVison is showing github.com — Issues: a project's .t3code/issues.json names its repositories (#887 row 2) by scuttletoby · Pull Request #1112 · scuttletoby/t3code
Conversation
scuttletoby
commented
Nov 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
In a fork checkout, T3 binds the project to both the upstream and the origin remote. The Issues page then lists upstream's issues as the project's own, and the issue tools may write to upstream. The owner decided upstream stays out (#830). #887 row 2: a project names its repositories in .t3code/issues.json.
Change
Builds on #1107 (merged), which announced the two seam lines. Based on main.
- The file (schema
ForkIssuesConfig in packages/contracts/src/forkIssuesConfig.ts): { "repositories": ["owner/repo", ...] } at <workspace root>/.t3code/issues.json, committed in the project's repository. Names must have no spaces and at least one /. The list holds at most 50 names. Unknown keys are ignored, so a newer file still reads on an older server.
- The rule (
apps/server/src/fork/issueRepos.ts, applyIssuesConfig):
- No file, or no
repositories key: upstream's guess, unchanged. A machine without the file behaves as upstream's.
repositories given: the git-host bindings become the guessed ones the file names, in the file's order. The file only narrows: a named repo T3 did not guess is ignored (not listed, not writable) and logged once. Names are matched without regard to case, and duplicates count once.
- Standalone trackers bound in Settings (Linear) are kept as they are.
- Fails closed: a file that cannot be read (broken JSON, a bad name, a folder in its place, a read error) lists no git-host repository and logs a warning, once per version of the file. Falling back to the guess would bring back the upstream the file exists to leave out.
- Only a small regular file is read: the file comes with any clone, so it is opened non-blocking without following a symbolic link, and read only when it is a regular file of at most 64 KiB (never more than 64 KiB + 1 bytes are read). A symbolic link, a FIFO, a device, a folder or a larger file counts as unreadable, as above.
- Symbolic links are refused, also to a regular file inside the repository. A link may point anywhere (
/dev/zero, a FIFO, a file outside the repository), checking where it points races with the read, and the file never needs to be a link: commit it as a plain file.
- The seam (
IssueService.ts, the two announced lines): one pipe step after upstream's binding resolution in resolveProjectTracker. Every path goes through it: listing, detail, writes (requireWritable) and resolveUrl. An upstream issue link still opens, read-only (upstream's requireProject fallback). A write to upstream is refused with read-only.
- Docs:
docs/fork/about.md and its change file, docs/fork/changes/app/887-projects-t3code-issues-json-repositories-owner.md.
Why node:fs and not Effect's FileSystem: the step runs inside IssueService's methods. Requiring FileSystem there would change upstream's layer and its tests' wiring. The file says this in its @effect-diagnostics comment.
Not here: this repository does not get its own .t3code/issues.json. Naming one repo in the public fork would hide the own repository of anyone who forks it. Each checkout adds the file where it wants it. Renaming the owner-question wording in this file comes with row 4, which reads the rule.
Review note 1 from #828 (copied to #887): with the file naming only the project's own repository, the upstream listing (more than 200 open issues) no longer makes "Waiting on you" mark it as cut.
Tests (red on the old code, then green)
apps/server/src/fork/issueRepos.test.ts. The list below is the first round's; fix rounds 1 and 2 add cases, listed in their comments.
applyIssuesConfig
- Which repositories does a project list with no file, or with a file that has no key? (upstream's guess)
- With named repos: is a fork's upstream dropped?
- Is a named repo that was not guessed ignored?
- With an empty list, or with nothing guessed?
- Does an unreadable file fail closed and keep the standalone tracker?
readIssuesConfig
- Is a valid file read?
- Is a missing file or folder read as absent?
- Are unknown keys ignored?
- Are broken JSON, a bad name, a wrong type and a folder in the file's place read as unreadable?
- Through
IssueService, with a fork checkout bound to upstream and origin:
- Does the named repo alone get listed and written, and is a write to upstream refused as read-only? Red with
IssueService.ts at origin/main (I checked this: 1 failed, 10 passed).
- Without the file, is the upstream guess kept, writes included?
Verification
issueRepos.test.ts 11/11. Upstream's IssueService.test.ts 9/9, unchanged: its /w/... workspace roots have no file.
- Typecheck (
effect-tsgo) of apps/server and packages/contracts: clean. vp fmt and vp lint on the changed files: clean.
fork-seam-check.cjs --config-ref origin/fork/887-issues-json-announce ...: only pinned seams. fork-seam-check.test.cjs 122/122. fork-changes-list.test.cjs 10/10.
- Not checked: a running server against a real fork checkout.
- Fix round 2 (the file-type and size check, at b6fe4de, rebased on main):
vp fmt, vp lint and the seam check against origin/main are clean. Its tests were not run locally: this machine's memory gate (t3-capacity 3072) refused every run for hours, so CI is their first run, and their red on the old code is reasoned in the lens reply, not observed.
Scope
Part of #887 (row 2, PR 2 of 2). Fork-only.
Model and harness: Claude Opus 5.5, Claude Code.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 27, 2026
|
lens: code · reviewer: Claude Opus 5.5 (code lens, round 1) · read at: cf99edf
major: the file can widen writes, not only narrow them. A name in .t3code/issues.json that no git remote names is served on the primary's host as one of the project's "own" scopes, so requireWritable lets the issue tools create, comment, edit and close issues there. The owner decided to narrow (#830: keep upstream out). Widening was not decided. The file is committed content: it comes with any clone or checked-out branch, including a contributor's branch. Before this PR, the read-only guard allowed writes only to repositories that the local git remotes named. Reproduced with a probe in the PR's own IssueService harness: the file ["me/web", "victim/private"], then comment(victim/private) is written (expected refused). Suggested fix: write only to names that git also guessed. A name git did not guess can still be listed, read-only. If adding repositories is wanted, the owner should decide it, and a test should pin it.
blocker: none
minor: a broken file logs its warning once per project on every listProjects call. That means every listing, every detail, every write (requireProject) and every resolveUrl, which lists all projects. One typo can fill the server log. One warning per change of the file's mtime would be enough.
minor: while the file is unreadable, opening any github.com issue link fails with "No project in T3 Code is on github.com", which is wrong for this project. The log says why, but the UI does not.
minor: the rule applies per checkout (workspaceRoot). list dedupes scopes across projects, so a second project on the same repository brings upstream back into the cross-project listing, writable from that project. The second project can be a plain clone, a worktree added as a project, or a checkout of a branch from before the file. That is consistent with the design ("each checkout adds the file"). Row 3 ("Waiting on you") should expect it, because this repository will not commit the file.
State question (runs again / stops half-way / existing, old or empty state):
- Runs again: no state is kept. The file is read on each binding resolution and never cached, so an edit applies on the next request. A list continuation that names a scope dropped by the file is skipped (
continuing[key] === undefined). The detail cache holds only the tracker's issue; writable is computed again on every call.
- Stops half-way: nothing is written. A file read while an editor is half-way through saving it reads as unreadable and fails closed for that one request.
- Existing, old or empty: no file, or no
repositories key, keeps upstream's guess. A missing workspace root reads ENOENT and keeps the guess. .t3code as a plain file reads ENOTDIR and keeps the guess. [] lists no git-host repository. An old server reading a newer file ignores unknown keys (tested). Upstream's IssueService.test.ts roots have no file, so its behaviour does not change.
Checked: the seams JSON moves from announced to added with the two lines unchanged. Scope names go into gh calls through GitHubIssueTracker.repository(), which checks them again (REPOSITORY, no /..), so a crafted name cannot reach other API paths. Tests cover the rule and the read cases. The IssueService case fails on main, as the PR says (not re-run; only the probe above was run).
🤖 Generated with Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Fix round 1
Answers the code lens, round 1 (#1112 (comment)). Every finding is fixed at its root in fork/issueRepos.ts and has a test in fork/issueRepos.test.ts that fails on cf99edf.
major: the file could add repositories to write to. It now only narrows. applyIssuesConfig keeps the guessed git-host bindings whose scope the file names, in the file's order. A name that no git remote guessed goes to ignored: it is not listed, and it is not one of the project's own scopes, so requireWritable refuses a write there as read-only. A link there still opens read-only, as for any other repository on the host. Each ignored name is logged once. Test: the file ["me/web", "victim/private"] lists only me/web, comment(victim/private) is refused as read-only, and nothing is written. This is the lens's probe, now inverted.
minor: log flood. A warning is logged once per version of the file. The version is the content's hash, or the read error, and it also covers the ignored names. It is logged again only when the file changes, or when it breaks again after it was fixed (the entry is cleared when the file reads clean). I used the content rather than the mtime, so a touch that changes nothing stays quiet. Test: three listings give one warning. An edit that is still broken gives a second. A fix stays quiet. Breaking it again the same way gives a third. An ignored name is also warned about only once.
minor: wrong reason ("No project in T3 Code is on github.com"). The reason is in the fork file: unreadableFileFailure(projectId, host?) and failWhenFileHidHost(host, projects). Both name the project and its broken .t3code/issues.json. They apply only to the git host the file hid and only to projects that still exist, and they clear at the first clean read. Using them takes three new lines in upstream's IssueService.ts, two where a project's binding for a scope is picked and one in resolveUrl. By the seam rule, a new line is announced first, so this PR announces those three exact lines in .github/fork-seams.json (since: 2026-11-28) and adds none of them. A follow-up PR, after this merges, adds the lines and an IssueService-level test. Until then the UI still shows upstream's message while the file is broken, and the server log gives the reason. The machine's memory gate kept local runs waiting for hours, so the wiring with the lines in place has not run yet; the follow-up PR's test covers it. The functions' own tests are in this PR.
minor: a second project on the same repository brings upstream back. This is kept per project, deliberately and consistently: each project (checkout) reads its own file. A project with the file never lists or writes upstream, whatever projects sit next to it. A project without the file guesses as upstream does, upstream included, and can write there from that project only. A global rule would mean one checkout's file silently changes what another checkout (an older branch, a clone) may do. That is the same widening-at-a-distance this round removes. Pinned by a two-project test: the named project lists only me/web and is refused on acme/web. The plain project lists and writes acme/web. In the merged listing, acme/web is attributed to plain. This test also passes on cf99edf, because it pins behaviour that was already there but unstated. Documented in docs/fork/about.md and the change file ("commit the file on the branch every checkout uses"). Row 3 ("Waiting on you") should expect it.
State question.
- Runs again: the file is read on every binding resolution and not cached. The only memory is two maps in
issueRepos.ts: what was last logged per workspace, and which projects' files were last unreadable. Each read rebuilds them, a clean read clears them, and a restart empties them. So after a restart a still-broken file is logged once more, and nothing else changes.
- Stops half-way: nothing is written. A file caught half-saved (tested: a truncated array and an empty file) reads as unreadable and fails closed for that request: no git-host repository, never upstream. It is logged once for that content. The next read of the finished file is clean.
- Existing, old or empty state: no file, or no
repositories key, keeps upstream's guess. [] lists no git-host repository. A missing workspace root or .t3code as a plain file keeps the guess (ENOENT, ENOTDIR). An old server ignores unknown keys. A name that git does not guess (an old file after a remote was removed) is ignored and logged once, never served. A deleted project's last unreadable read is never named, because failWhenFileHidHost checks only projects that exist now.
Docs: docs/fork/about.md, the change file, and the seam's why text now say "narrows". Tests: issueRepos.test.ts, with the new { bindings, ignored } shape and versions.
🤖 Generated with Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…row 2)
The named repositories replace the ones T3 guesses from git remotes, so a fork checkout's upstream
is neither listed nor writable (owner decision in #830); an issue link there still opens read-only.
Without the file a project keeps upstream's guess; a file that cannot be read lists no git-host
repository. Spends the two lines announced in IssueService.ts.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fix round 1 of the code review:
- A name in .t3code/issues.json that no git remote names is now ignored
(neither listed nor writable), so a committed file can never add a
repository to write to.
- A broken file, or an ignored name, is logged once per version of the
file instead of on every request.
- The real reason for a link while the file is broken: the reason
functions are here, and the seam lines that return it are announced in
.github/fork-seams.json for a follow-up PR.
- The rule is per project, pinned by a two-project test and explained in
the docs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
lens: code · reviewer: Claude Opus 5.5 (code lens, round 2) · read at: 4ea7062
blocker: none
major: readIssuesConfig reads the committed file with no size or file-type limit, so a clone can crash or stall the server. Git keeps symlinks, so a repository can commit .t3code/issues.json as a symlink to /dev/zero or to a FIFO. NodeFSP.readFile(file, "utf8") follows the link. On a character device it reads and decodes until memory runs out. On a FIFO the open blocks forever. Every project's file is read on every listProjects, so just opening the Issues page triggers it. This is the round 1 threat model again (the file comes with any clone), and it needs no repositories key. Reproduced with Node 24 under a 300 MB memory cap: readFile("<ws>/.t3code/issues.json" -> /dev/zero, "utf8") dies with FATAL ERROR: Reached heap limit inside StringDecoder::DecodeData. That is a process abort, which no Effect.catch can handle. Without a cap it grows by about 0.6 GB/s for each request in flight. The FIFO symlink was still blocked when timeout stopped it after 5 s, and each blocked open holds one of libuv's 4 threadpool threads, which all other file I/O shares. Suggested fix: open with O_RDONLY | O_NONBLOCK, fstat the handle, and read it as unreadable (fail closed) unless it isFile() and its size is small (the schema allows 50 names, so 64 KiB is plenty). Then read at most that many bytes. Add a test with a symlink to /dev/zero and an oversized file.
Round 1, fixed: the file could widen writes. applyIssuesConfig now keeps only guessed git-host bindings whose scope the file names. requireProject finds own only among those, so a name git did not guess is served only as onHost[0] with writable: false, and requireWritable refuses it. The test inverts round 1's probe (victim/private refused, nothing written).
Round 1, fixed: log flood. logOnce is keyed by workspace and stores the content hash, or a fixed error <code>, or the ignored names with the hash. A clean or absent read deletes the entry, so a later breakage logs again. A touch with the same content stays quiet. The map grows by one string per workspace only.
Round 1, deferred by design: the real reason in the UI. The three IssueService lines are only announced, with a follow-up PR. unreadableFileFailure / failWhenFileHidHost are unused outside tests until then.
Round 1, accepted: the per-project rule is now documented in docs/fork/about.md and the change file, and a two-project test pins it.
State question (runs again / stops half-way / existing, old, empty or broken state):
- Runs again: nothing is cached but the two log/reason maps, which every read rebuilds or clears. A restart logs a still-broken file once more. Edits apply on the next request.
- Stops half-way: nothing is written. A half-saved file (empty, truncated JSON) reads as unreadable and fails closed for that request. It never falls back to the guess, so upstream is never listed.
- Existing, old, empty or broken: no file or no
repositories keeps upstream's guess. [] lists no git-host repository. An old file that names a remote since removed is ignored, logged once and not writable. A file that names only repos no remote has lists nothing on the git host, so an upstream link then fails with upstream's "no project is on the host" message until the follow-up lands. A broken file fails closed. The broken file the major describes is the one case that is not handled: a symlink or special file in its place.
Checked: the seams JSON keeps the two added lines verbatim, and the three new lines are only announced. Case-insensitive dedupe keeps the file's order. A scope found on two hosts stays narrowed. Only the probes above were run, with no test files, because the memory gate was refusing the whole time and the probes ran under a hard memory cap.
🤖 Generated with Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The server read the file with no type or size check: a link to /dev/zero
ran it out of memory and a FIFO blocked it. It now opens the file
non-blocking and without following a link, and reads only a regular file
of at most 64 KiB (at most 64 KiB + 1 bytes are read). Anything else is
unreadable, warned once per version, like a broken file. A symbolic link
is refused even when it points to a regular file in the repository.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Reply to the round-2 code lens (#1112 (comment)), fixed in b6fe4de (rebased on main after #1153):
Major: .t3code/issues.json read with no type or size check: fixed.
readIssuesConfig now opens the file with O_RDONLY | O_NONBLOCK | O_NOFOLLOW, checks the open handle with fstat, and reads only a regular file of at most 64 KiB (MAX_ISSUES_CONFIG_BYTES). It reads at most 64 KiB + 1 bytes, so a file that grows after the fstat is still refused.
- Anything else is
unreadable, like broken JSON: the project fails closed to the standalone tracker, with one warning per version. A FIFO never blocks: with O_NONBLOCK the open returns at once, and fstat refuses it before any read.
- Symbolic links are refused, also a link to a regular file inside the repository.
O_NOFOLLOW makes the open fail with ELOOP. A link-free rule is the simplest one that can never reach /dev/zero, a FIFO or a file outside the checkout, and a repo has no need for this file to be a link. The PR body and docs/fork/about.md say so.
- Missing (
ENOENT, ENOTDIR) is still read as absent.
Tests (issueRepos.test.ts):
- a symbolic link to
/dev/zero
- a FIFO (
mkfifo)
- a file over 64 KiB, plus one of exactly 64 KiB, which is still read
- a symbolic link to a regular file
- through
IssueService: a link to /dev/zero fails closed, with one warning over three listings
- The directory case was already covered by "reads broken JSON, a bad name or a folder…".
Red, then green: not observed locally. This machine's memory gate refused every test run for hours, so CI on b6fe4de is these tests' first run. Why each new case fails on the old code:
/dev/zero: the old readFile never ends and runs out of memory. I would not run that case against the old code even with memory free.
- FIFO: the old read waits for a writer, so the test times out.
- Over 64 KiB, and the link to a regular file: the old code parses them, giving
ok instead of unreadable.
State:
- Absent, empty or old file: unchanged.
- A file that changes between reads is still keyed by version, so it warns once per change.
- Nothing is written, so a stop half-way leaves nothing behind.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
|