claude-code - 💡(How to fix) Fix ghRateLimitHint fires as false positive, appends system-reminder when quota is fine [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51988Fetched 2026-04-23 07:39:32
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4closed ×1

Root Cause

from the model's side it looks exactly like a prompt injection from untrusted external content (readme fetched from some random repo). took a while to rule out that the repo wasn't actually attacking, because the wrapper is indistinguishable from a real system-reminder and the string doesn't exist in the readme, settings.json, any plugin hook, or shell wrappers. only tell was that it lives in toolUseResult as a separate field.

net effect: agents either slow down around gh for no reason, or burn time chasing a phantom injection.

Code Example

<system-reminder>GitHub API rate limit exceeded (5,000/hr shared across all tools and agents). Run `gh api rate_limit --jq .resources` and sleep until reset before further gh calls. If polling in a loop, use ScheduleWakeup instead of retrying.</system-reminder>

---

{
  "stdout": "...",
  "stderr": "",
  "interrupted": false,
  "isImage": false,
  "noOutputExpected": false,
  "ghRateLimitHint": "<system-reminder>GitHub API rate limit exceeded..."
}
RAW_BUFFERClick to expand / collapse

hey, hit a weird one on 2.1.117.

the harness attaches a ghRateLimitHint field to bash tool results that carries a full <system-reminder> telling the model to back off on gh calls. thing is, it fires when the real quota is fully available, and also on bash commands that never touched gh.

repro

  1. run gh repo view graykode/abtop. any bash call whose stdout mentions "rate limit" seems to do it (that readme talks about rate limits as a feature).

  2. the tool result gets this appended:

    <system-reminder>GitHub API rate limit exceeded (5,000/hr shared across all tools and agents). Run `gh api rate_limit --jq .resources` and sleep until reset before further gh calls. If polling in a loop, use ScheduleWakeup instead of retrying.</system-reminder>
  3. check actual quota right after: gh api rate_limit --jq .resources.core returns {"limit":5000,"remaining":4999,...}. nowhere near exhausted.

  4. swap the command for curl -sL ... | grep "rate limit" which never invokes gh. same hint gets appended anyway.

where it lives

toolUseResult carries it as a sibling field next to stdout/stderr:

{
  "stdout": "...",
  "stderr": "",
  "interrupted": false,
  "isImage": false,
  "noOutputExpected": false,
  "ghRateLimitHint": "<system-reminder>GitHub API rate limit exceeded..."
}

why this matters

from the model's side it looks exactly like a prompt injection from untrusted external content (readme fetched from some random repo). took a while to rule out that the repo wasn't actually attacking, because the wrapper is indistinguishable from a real system-reminder and the string doesn't exist in the readme, settings.json, any plugin hook, or shell wrappers. only tell was that it lives in toolUseResult as a separate field.

net effect: agents either slow down around gh for no reason, or burn time chasing a phantom injection.

guess at the trigger

looks content-based on "rate limit" appearing in output? wonder if it could be gated on (a) the command actually invoking gh, and (b) the harness having seen a real 403 recently or remaining dropping below some threshold. happy to be wrong about the matcher, that's just from the repro.

env:

  • claude code 2.1.117
  • macos darwin 25.2.0
  • gh 2.x, plain homebrew, no wrappers or aliases

AI generated

extent analysis

TL;DR

The issue can be mitigated by modifying the harness to only append the ghRateLimitHint field when the gh command is actually invoked and the GitHub API rate limit is near exhaustion.

Guidance

  • Investigate the logic behind appending the ghRateLimitHint field to toolUseResult and modify it to consider the actual invocation of gh and the current rate limit status.
  • Verify that the ghRateLimitHint field is only appended when the gh command is used and the rate limit is near exhaustion by checking the toolUseResult field after running different commands.
  • Consider adding a threshold for the rate limit remaining value to determine when to append the ghRateLimitHint field, rather than relying solely on the presence of "rate limit" in the output.
  • Review the content-based trigger for appending the ghRateLimitHint field to ensure it is not overly broad and causing false positives.

Example

No code snippet is provided as the issue does not contain sufficient information about the harness's implementation.

Notes

The issue seems to be related to the harness's logic for appending the ghRateLimitHint field, and modifying this logic should resolve the issue. However, without more information about the harness's implementation, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by modifying the harness to only append the ghRateLimitHint field when the gh command is actually invoked and the GitHub API rate limit is near exhaustion, as this should prevent the false positives and mitigate the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING