Repository navigation
install-tend: fix oauth-token.sh returning an invalid token on macOS - #398
Merged
Merged
Conversation
The wrapper's grep extraction ran past the token's last char into the
next TUI line ("Store this token securely…"), returning a malformed
bearer that the API rejected with 401. Captured TUI: token and the
following line are joined by ANSI styling alone — no whitespace
separator — so after CSI strip + `tr -d '\r\n'`, the character class
greedily consumed "Store" too.
Fix:
- Widen PTY to 250 cols via `stty` in a shell wrapper so Ink doesn't
wrap the ~108-char token; the trailing newline becomes a natural
right boundary.
- Drop `tr -d '\n'`; rely on grep not crossing newlines.
- Redirect script(1)'s stdout passthrough to stderr so it doesn't
pollute the caller's `TOKEN=$(./oauth-token.sh)` capture (pre-existing
leak, masked by the broken extraction).
- Length sanity check (80 ≤ len ≤ 200) as a safety net.
- Correct the comment about why script(1) is needed: it's for stdout
rendering (Ink checks isTTY), not the OAuth callback server (which
binds fine without a TTY).
Verified end-to-end: extracted long-lived token returns "role":"assistant"
from api.anthropic.com/v1/messages.
Also update SKILL.md so install-tend sessions on Windows route directly
to Manual instead of attempting the bash + script(1) wrapper.
Co-Authored-By: Claude <[email protected]>
tend-agent
approved these changes
May 8, 2026
Merged
max-sixty
added a commit
that referenced
this pull request
May 13, 2026
Bumps generator to 0.0.18. ## Headline Expose the `__TEND_DELETE__` sentinel so TOML overrides can reach RFC 7396 delete-key semantics — useful for dropping a generator-injected key (e.g. `on.schedule` from a scheduled workflow) while keeping the rest. Closes #439, thanks @jrdncstr for reporting. ## Other changes since 0.0.17 - fix(action): sum usage and num_turns across all result entries (#437) - diag(action): upload execution-output.json (#408) - fix(mention): run setup before PR checkout so stale PRs don't drop mentions (#391) - fix(running-in-ci): base skill worktree on default branch (#401) - install-tend: fix oauth-token.sh returning an invalid token on macOS (#398) - oauth-token.sh: don't tee the OAuth token to stderr (#421) - Skill hardening: bang-escape guidance, review-reviewers corruption scans, dedup rules, $GITHUB_RUN_ID requirement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The wrapper's grep extraction ran past the token's last char into the next TUI line (
Store this token securely…), returning a malformed bearer thatapi.anthropic.comrejected with401 Invalid bearer token. The token and the following line are joined in the captured TUI by ANSI styling alone — no whitespace — so after CSI strip +tr -d '\r\n', the[A-Za-z0-9_-]*class greedily consumedStoretoo. Wrapper exited 0 and the bot got a token that looked plausible, silently brickingtend installruns that used the CLI path.Changes
sttyinside a shell wrapper, so Ink renders the ~108-char token on a single line. End-of-line then becomes a natural right boundary.tr -d '\n'; rely ongrep -oEnot crossing newlines, which makes the "runs into Store" failure mode structurally impossible regardless of label wording.script(1)'s stdout passthrough to stderr — pre-existing leak that pollutedTOKEN=$(./oauth-token.sh)callers; was masked by the broken extraction. The user still sees the TUI on their terminal via stderr.script(1)is needed. The OAuth callback server binds fine without a TTY (verified by runningclaude setup-tokenwith no TTY — boundlocalhost:50706and connected to claude.com); what needs a TTY is stdout, because Ink only renders whenprocess.stdout.isTTY.SKILL.md: route Windows sessions directly to the Manual fallback (the wrapper depends onbash+script(1), validated only on macOS/Linux).Verification
End-to-end with a real
claude setup-tokenburn: extracted token returns"role":"assistant"fromapi.anthropic.com/v1/messageswithAuthorization: Bearer <token>andanthropic-beta: oauth-2025-04-20. Confirms the original 401 failure mode is gone.