Repository navigation
Closed
Description
Before submitting
- I searched existing issues and did not find a duplicate. Related but different: [Bug]: watch_pull_request reports watching=true when required glab is missing #33382 (missing
glabstill reportswatching: true) and [Bug]: watch_pull_request ends the watch after 8 consecutive failed reads, even when the failures are transient network errors #18894 (closed, about ending a watch on transient failures). - I included enough detail to reproduce or investigate the problem.
Area
apps/server: GitHubCredentials (gh token lookup) and PullRequestWatchReactor
Steps to reproduce
- On Linux, put a
ghwrapper ahead of the realghon the server's PATH. The wrapper writes one line to stdout before it execs gh:(In my case the wrapper ran#!/bin/sh echo "hello from wrapper" exec /usr/bin/gh "$@"
mise use -g gh, which printsmise ~/.config/mise/config.toml tools: [email protected]to stdout.) - Start T3 Code. From a thread,
link_pull_requestand thenwatch_pull_requesta GitHub PR. Both returnwatching: true. - Push a change. Let CI fail, then let it pass.
Expected behavior
- The token lookup rejects
gh auth tokenoutput that is not a single token-shaped line, or takes its last non-empty line, and reports a clear credential error. - A watch that can never read its PR wakes the thread with "could not read it", as it does for other repeated read failures.
- Tokens never appear in logs.
Actual behavior
GitHubCredentialsusesstdout.trim()ofgh auth tokenas the token. The value contains a newline, soHeaders.appendthrows before any request is sent. Every GitHub API call fails withPullRequestProviderError { reason: "failed", detail: "Could not reach GitHub at github.com." }.- In
PullRequestWatchReactor.readGroup, a"failed"reason clearsreadFailuresbefore rethrowing, so it never reachesREAD_FAILURE_LIMITandgiveUpnever runs. The watch stays on, never reads the PR, and never wakes the thread. Failed checks, passing checks and comments all go unreported. - The
TypeErrormessage includes the full header value, so the GitHub OAuth token is written in plain text toserver.trace.ndjsonon every 2-minute sweep.
Impact
PR watching is silently broken for every GitHub PR on the machine. Agents end their turn as instructed and are never woken, so users have to prompt every thread waiting on CI. There is no visible error in the UI.
Version or commit
0.1.7 (Linux AppImage)
Environment
Arch Linux (Omarchy), mise 2026.11.4, gh 2.103.3 (via mise), a ~/.local/bin/gh wrapper ahead of the real gh on PATH.
Logs or stack traces
From when a watch ended (it was unwatched by hand after 3 hours):
"pull request watch ended", { "pullRequest": "github.com/<owner>/<repo>#139", "reason": "stopped",
"minutes": 186, "quietMinutes": 186, "wakes": 0, "reads": 0, "partial": false }
Every sweep (token redacted):
"pull request watch check failed"
PullRequestOperationError(operation: detail)
-> PullRequestProviderError(provider: github, operation: getChangeRequest, reason: failed,
detail: "Could not reach GitHub at github.com.")
-> GitHubApiRequestError(operation: getPullRequestDetail)
-> GraphQLClientError(PullRequestCore) -> TransportError (POST https://api.github.com/graphql)
-> TypeError: Headers.append: "Bearer mise ~/.config/mise/config.toml tools: [email protected]\ngho_<REDACTED>" is an invalid header value.
Screenshots, recordings, or supporting files
No response
Workaround
Make sure gh auth token prints only the token. In my case that meant sending the wrapper's mise use output to /dev/null. The 5-minute token cache then picks up a clean token without a restart.
Metadata
Metadata
Assignees
Labels
No labels
Activity
juliusmarminge commentedon Nov 11, 2026
Closing as a local misconfiguration, not a T3 Code bug.
Your
ghwrapper writes to stdout. That breaks every tool that reads gh output, not just T3 Code:gh api ... | jq,$(gh auth token), and any script that parsesghbreaks the same way. A wrapper must not touch stdout. Send its output to stderr (>&2) or remove it, and runningmise use -g ghon every gh call is a bad idea anyway. Install gh once, or put mise's shims dir on PATH.We are not going to guess which line of the output is the real token.