Repository navigation
fix(gh): distinguish secondary rate limit from auth failure + skill scope-doc correction (#341) - #344
Merged
Merged
Conversation
`gh auth status` calls /user, which returns 403 during a GitHub secondary rate limit (abuse detection). gh interprets that 403 as 'token invalid' and prints exactly that. airc surfaced it verbatim — Carl saw 'GitHub token is invalid' during a rate-limit cooldown, ran 'gh auth login' fruitlessly, and got nowhere because the token was actually fine. The /rate_limit endpoint is reachable during secondary rate limits. If it works, the token works. Use it as the discriminator. Three sites use 'gh auth status' as a preflight or status check; all three got the same fix shape: - cmd_connect.sh (airc join preflight): instead of dying with 'token invalid' and pointing at gh auth login, dies with 'rate-limited; wait 5-15 min' when /rate_limit is reachable. Includes a brief explanation of why gh misreports. - cmd_doctor.sh: '[BLOCKED] gh authenticated' becomes '[BLOCKED] gh secondary rate limit (abuse detection) — token is fine' under the same condition, with 'wait then re-run' guidance instead of 'gh auth login -s gist'. Same fix applied to the downstream gist-API-reachable check. - cmd_status.sh: 'gh auth: ✗ INVALID' becomes 'gh auth: RATE-LIMITED' under the same condition, so a user inspecting status mid-cooldown gets accurate information. Hit on this Mac mid-Carl-QA pass: a 15-second issue-comment polling Monitor combined with rapid PR/issue/comment activity tripped GitHub's secondary rate limit. 'gh auth status' said 'token invalid'. 'airc join' surfaced the same. Both wrong. Doesn't touch cmd_send.sh's auth_failure path — that runs off a bearer report, not a direct gh probe, and needs a separate look at the Python bearer's auth_failure logic. Filed as a follow-up under #341. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rc/) The /join skill claimed non-git-repo cwds put state in ~/.airc/. Code actually writes to $PWD/.airc/ (detect_scope in airc:162). README is correct on three different lines (256, 375, 501) — only the skill disagrees. Carl reading the skill expects ~/.airc/, sees state appear in /Users/joel/Development/.airc/ when running from a non-project dir, gets confused. Per-cwd-by-default is intentional — multi-tab on one machine: each tab in its own dir = distinct identity, never colliding. The fix updates the skill text to match actual behavior + mentions AIRC_HOME as the override knob. Identified during the Carl QA pass tracked at #341. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 30, 2026
canary→main: fresh-Mac install fixed + cryptography migration + CI honesty + UX cleanups (#341)
#349
Merged
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
…al command on the user (#352) fix(join skill): auto-trigger gh auth login instead of telling the user Carl on the other tab tried /join, hit 'gh auth invalid', and saw the agent dump 'Run this in the prompt: ! gh auth login -h github.com -s gist' back at them. Joel had to close Claude and re-auth manually. install.sh already does this auto-trigger when stdin is TTY (via #339); the skill just had stale text saying "install + 'gh auth login'" without telling the agent to RUN it. Updated /join SKILL.md section 1: - Spell out the auto-trigger pattern explicitly: agent runs `gh auth login -h github.com -s gist -p https -w` itself via Bash. -h/-p/-w skip every interactive prompt; -w uses browser device code; gh blocks until the user completes auth in the browser → Bash blocks with it → success returns → agent continues to airc join. - Note device-code-line surfacing — Bash output buffering can hide it if the agent isn't deliberately quoting it back to the user. - Add the rate-limit-vs-real-auth pre-flight (mirrors the cmd_connect.sh fix from #344): probe `gh api rate_limit` first; if reachable, the token is fine and gh is misreporting a secondary-rate-limit 403 as 'token invalid'. Tell the user to wait, not re-auth. Doc-only — no code change. The skill text is the agent's runtime prompt; updating it changes behavior on the next /join invocation across every Claude Code session that picks up the new skill. Co-authored-by: joel <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
…ebug session (#353) Previous fix (#352) added a 'pre-flight diagnose' step that the agent narrated to the user — Carl typing /join saw 'running gh api rate_limit ... token is actually fine ... issue #341 case ... proceeding with join'. That looks like a bug. The diagnose should be a silent gate, not a story the user sits through. Reframed the section: don't pre-flight at all. Just run airc join. If airc itself surfaces a gh-auth message (rate-limited / token invalid / auth invalid), react minimally: - 'rate-limited' → tell user verbatim, do nothing else (airc already disambiguated via #344's cmd_connect.sh pre-flight; re-probing is redundant and chatter) - 'token invalid' → run 'gh auth login -h github.com -s gist -p https -w' silently, surface only the device-code line for the user, then retry - 'gh missing' → install + auth, one short line, proceed The principle stated explicitly: Carl running /join should see airc events + outcomes, not auth-handling internals. Internal disambiguation silent; user-actionable result one short sentence. Joel caught this on the 2-tab cross-machine test minutes after #352 landed — the agent dutifully followed #352's instructions, ran the narrated pre-flight, and produced exactly the "looks like a bug" output Carl shouldn't see. Co-authored-by: joel <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 30, 2026
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
… format) (#364) * docs+install: airc skills auto-install into Codex too (same SKILL.md format) Joel installed Codex on the test rig — first non-Claude-Code agent to hit the QA pass. Investigation: Codex CLI uses ~/.codex/skills/<name>/ SKILL.md with YAML frontmatter + markdown body — IDENTICAL on-disk format to Claude Code's ~/.claude/skills/. Pre-fix, install.sh only symlinked into ~/.claude/skills, so Codex sessions had no airc surface even with Codex installed. install.sh: extract the skill-install loop into _install_airc_skills_into (target_dir, agent_label) and call it twice: 1. Always for $SKILLS_TARGET (Claude Code; pre-existing behavior). 2. Conditionally for $HOME/.codex/skills when both `command -v codex` succeeds AND ~/.codex exists (i.e. Codex has been run at least once and created its config dir). Honors CODEX_SKILLS_TARGET env var the same way SKILLS_TARGET supports overrides for tests. Output now distinguishes per-agent: -> Skill (claude-code): /join -> Skill (codex): /join uninstall.sh: matching cleanup walks BOTH skill dirs and removes any symlink resolving into the airc clone. Doesn't touch .system/ dirs or non-airc symlinks (resolve target check protects against accidentally nuking other plugins). Help block updated. integrations/openai-codex/README.md: full refresh. - Stale 'gh-rooted IRC over Tailscale' wording dropped (post-3c the gist IS the wire; no Tailscale). - Stale 'airc teardown --flush && airc join <gist-id>' recovery hint dropped — post-#344 auth failures point at gh auth login directly. - Adds Codex skill auto-install detail + visibility into the new per-agent install output. - Adds the full verb surface (whois, away, kick, identity, uninstall, update, daemon) which the prior README only listed a subset of. - Surfaces known gaps (Claude-Code-specific bits in skill text → #357, DM E2EE silent-plaintext → #358) so Codex agents reading the doc know what NOT to trust yet. Tested on this Mac: live install run produced 23 skill symlinks under ~/.codex/skills, all resolving to ~/.airc-src/skills/<name>/. Codex should now expose the same /join /msg /list etc. surface that Claude Code does. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(install): auto-write Codex network permission profile (no manual sandbox flag needed) Joel hit this on the QA rig: Codex's default sandbox blocks subcommand network egress, so every airc verb invoked from inside Codex fails with `error connecting to github.com` (or, because gh's auth probe also fails, the indirect `token in keyring is invalid` misreport). Telling users to relaunch Codex with `--sandbox danger-full-access` or wire up `--ask-for-approval on-request` is the friction Joel called out. Skills can't declare required permissions in Codex's current skill format, so the cleanest automation is to write a scoped network- permission profile into ~/.codex/config.toml at install time. install.sh, when it detects Codex (same probe as the skill-symlink path: `command -v codex && [ -d ~/.codex ]`), now appends a named permission profile scoped to ONLY the gh hosts airc uses: [permissions.airc.network] enabled = true mode = "limited" domains = { "github.com" = "allow", "api.github.com" = "allow", "gist.github.com" = "allow" } …and sets `default_permissions = "airc"` at the file's top level, but ONLY if no default is currently set. A user with a different default keeps it; install.sh prints how to invoke airc-needing sessions explicitly via `codex --profile airc`. Idempotent: grep guards check for existing `[permissions.airc.network]` header + `default_permissions =` line before writing. Re-runs of install.sh on a configured machine produce no changes (no spurious "Added airc network profile" line). Honors AIRC_SKIP_CODEX_CONFIG=1 for users (or test harnesses) who want the skill symlinks but NOT the config write — same shape as AIRC_SKIP_PREREQS=1 for the package install loop. Tested on this Mac: first run added both blocks (top-level key + [permissions.airc.network] section). Second run was a no-op (no output line, no file change). Verified: cat ~/.codex/config.toml shows the profile + matches Codex's documented format. Doesn't use the codex CLI for the write because there is no `codex config` subcommand — Codex offers per-invocation `-c key=value` overrides + named profile loading via `-p`, but no persistent-edit CLI. File-edit + grep idempotency is the standard pattern install.sh already uses for shellrc PATH addition. README updated to document the auto-config + the AIRC_SKIP_CODEX_CONFIG escape hatch. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(install): add [permissions.airc.filesystem] alongside network block (silences Codex warning) Joel's Codex first-encounter QA surfaced the warning: Permissions profile 'airc' does not define any recognized filesystem entries for this version of Codex. Filesystem access will remain restricted. The original [permissions.airc.network] block (added in 867c161) granted network access to gh's domains but left filesystem entries empty. Codex's default-restricted filesystem then silently blocks airc verbs that mutate state (identity bootstrap, airc update, the per-cwd state writes), even though the user thought the airc profile was the default. Adds a paired [permissions.airc.filesystem] block scoped to airc's actual footprint: ~/.airc-src/ airc clone + .venv (airc update, identity bootstrap) ~/.airc/ user-default state dir ~/.local/bin/airc + relay binary symlinks (write needed for uninstall) Plus a [permissions.airc.filesystem.':project_roots'] sub-section for the per-cwd .airc/ + .airc.general/ directories (per-project airc state + #general sidecar). Codex's TOML syntax for filesystem permissions per the config reference: permissions.<name>.filesystem.<path-or-glob> = "read" | "write" | "none" :project_roots is the special token for per-project scoping. Idempotent: grep guard checks for existing [permissions.airc.filesystem] header before writing. Same shape as the network block. Tested on this Mac: live install.sh re-run wrote the new block once, second run was a no-op (no spurious changes), config.toml has both [permissions.airc.network] and [permissions.airc.filesystem] sections with the airc.filesystem.':project_roots' sub-section. Codex first-encounter (Joel's QA tab) should pick this up on next restart and the filesystem warning should clear. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: joel <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
2 of 5 tasks
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
…loses #367) (#369) The user-visible bug: in environments where gh's auth probe is flaky (Codex sandbox especially — openai/codex#10695), airc join's preflight hard-died with "token invalid" even when the scope's airc monitor was already running and bearer was actively reading/writing gh gists. The skill then reacted to the (wrong) token-invalid message by trying gh auth login -w (which also fails in the same flaky env), and Carl saw a multi-step debug-loop wreckage on a scope that was actually fine. Joel's call: "if the skill constantly causes this, it seems broken to everyone. do the most correct and robust [fix]." Two-layer fix. LAYER 1 — cmd_connect.sh: trust-existing-monitor short-circuit ------------------------------------------------------------------- Hoist the "this scope's monitor is already running" detection (which already lived at lines ~438 below) to BEFORE the gh-auth preflight. On a hit (live PID in airc.pid), emit the same canonical message + return 0. No preflight runs. The gh-auth probe was always meant to catch "user is about to do real work, ensure their gh credential is healthy first" — but if real work is ALREADY HAPPENING in this scope (live monitor → live bearer → live gh API calls), the running monitor's own health is the authoritative signal, not an out-of-band probe. Stale pidfile (file present, no live PIDs) falls through to the canonical cleanup block below — that path was already correct, no duplication. LAYER 2 — /join skill: airc status as ground truth ------------------------------------------------------------------- Adds a section to skills/join/SKILL.md explicitly telling the agent: `airc status` is the authoritative signal for whether this scope is in the mesh. It's local-only — no gh probe, no network call. When gh-auth-status probes disagree with airc status, trust airc status. Also adds explicit handling for the "monitor already running" exit: that's a successful no-op, NOT a failure. Run `airc status` once to confirm + narrate "already in the mesh as <nick> in <rooms>". Do NOT re-arm a Monitor (would dual-tail the same scope). Generalizes beyond Codex — same fix unblocks the rate-limit-misreport class (#344-era) AND any future "gh probe noisy but airc actually works" class. Tested on this Mac: airc join with a live monitor in the scope now emits the canonical "monitor already running" message and exits 0 WITHOUT firing the gh-auth preflight. Before this change, the preflight always fired first; on environments where it flaked, that was the source of the cascade. Co-authored-by: joel <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
2 of 5 tasks
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.
Two small Carl-UX fixes from the QA pass on #341.
1. Rate-limit-vs-auth diagnose
gh auth statuscalls/user, which returns 403 during a GitHub secondary rate limit (abuse detection). gh interprets the 403 as 'token invalid' and prints exactly that. airc surfaced it verbatim — Carl saw 'GitHub token is invalid' during a rate-limit cooldown, ran 'gh auth login' fruitlessly, and got nowhere because the token was actually fine.The
/rate_limitendpoint is reachable during secondary rate limits. If it works, the token works. Use it as the discriminator.Three sites fixed (all use
gh auth statusas a preflight or status check):cmd_connect.sh(airc joinpreflight): dies with 'GitHub rate-limited — retry in 5-15 min (token is fine)' when/rate_limitis reachable, with a brief explanation of why gh misreports.cmd_doctor.sh: '[BLOCKED] gh authenticated' becomes '[BLOCKED] gh secondary rate limit (abuse detection) — token is fine' under the same condition. Same fix applied to the downstream gist-API-reachable check.cmd_status.sh: 'gh auth: ✗ INVALID' becomes 'gh auth: RATE-LIMITED (secondary; token is fine — wait 5-15 min)'.Live-tested on this Mac (which tripped the secondary rate limit during the QA pass when a 15s issue-comment polling Monitor combined with rapid PR/issue/comment activity). Pre-fix
airc joindied with 'token invalid'; post-fix it dies with the accurate rate-limit message.Doesn't touch
cmd_send.sh'sauth_failurepath — that runs off a bearer report, not a direct gh probe, and needs a separate look at the Python bearer's auth_failure determination logic. Filed as a follow-up under #341.2. /join skill scope-doc correction
The /join skill said non-git-repo cwds put state in
~/.airc/. Code actually writes to$PWD/.airc/(detect_scopeinairc:162). README is correct on three different lines (256, 375, 501) — only the skill disagreed. Carl reading the skill expected~/.airc/, saw state appear in/Users/joel/Development/.airc/when running from a non-project dir, got confused.Per-cwd-by-default is intentional — multi-tab on one machine: each tab in its own dir = distinct identity, never colliding. The fix updates the skill text to match actual behavior + mentions
AIRC_HOMEas the override knob.Test plan
airc joinfrom a clean cwd while secondary rate limit is active → prints actionable 'rate-limited; wait 5-15 min' instead of 'token invalid'airc joinwith a genuinely revoked / missing token → still prints original 'token invalid' message +gh auth loginguidanceairc doctormid-rate-limit → '[BLOCKED] gh secondary rate limit ...' instead of '[BLOCKED] gh authenticated'airc statusmid-rate-limit → 'gh auth: RATE-LIMITED' line instead of '✗ INVALID'🤖 Generated with Claude Code