Skip to content

Conversation

@konard
Copy link
Contributor

@konard konard commented Dec 27, 2025

Summary

Add logging of GitHub API rate limit usage at key points during solve command execution to help identify expensive operations that consume the most API limits.

  • Add github-rate-limit-logger.lib.mjs module for reusable rate limit tracking
  • Log rate limits at session start, after repository setup, after PR setup, after AI tool execution, and session summary
  • Add --github-rate-limits-logging flag (disabled by default, use when debugging API usage)
  • Add delta tracking to show how many API calls each operation consumes
  • Add test experiment script experiments/test-github-rate-limit-logger.mjs

Example Output

When enabled with --github-rate-limits-logging:

📊 GitHub API: 751/5000 used (15%) (resets in 32m) [session start]
📊 GitHub API: 780/5000 used (16%) [+29 since last check] (resets in 31m) [after repository setup]
📊 GitHub API: 785/5000 used (16%) [+5 since last check] (resets in 30m) [after PR setup]
📊 GitHub API: 789/5000 used (16%) [+4 since last check] (resets in 28m) [after AI tool execution]

📊 GitHub API Rate Limit Summary:
   Total API calls this session: 38
   Final usage: 789/5000 (16%)
   Remaining: 4211 requests
   Resets in: 28m

How to Enable

The rate limit logging is disabled by default. To enable it for debugging, use:

solve <issue-url> --github-rate-limits-logging

Test Plan

  • Run eslint checks - passing
  • Run prettier format checks - passing
  • Test rate limit logger via experiment script - node experiments/test-github-rate-limit-logger.mjs
  • CI checks passing

Fixes #1002

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #1002
@konard konard self-assigned this Dec 27, 2025
Add logging of GitHub API rate limit usage at key points during solve
command execution to help identify expensive operations.

- Add github-rate-limit-logger.lib.mjs module for rate limit tracking
- Log rate limits at session start, after repo setup, after PR setup,
  after AI tool execution, and session summary
- Add --github-rate-limits-logging flag (enabled by default)
- Add delta tracking to identify API calls per operation
- Add test experiment script

Fixes #1002

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Make sure we log limits usage for each and every access to GitHub API feat: add GitHub API rate limit logging to solve command Dec 27, 2025
@konard konard marked this pull request as ready for review December 27, 2025 16:20
@konard
Copy link
Contributor Author

konard commented Dec 27, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $6.923136 USD
  • Calculated by Anthropic: $4.417150 USD
  • Difference: $-2.505986 (-36.20%)
    📎 Log file uploaded as GitHub Gist (1124KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Contributor Author

konard commented Jan 11, 2026

Resolve conflicts.

The core issue was that we have some command, that stuck and was spending lots of GitHub API limits, so instead of --disable-github-rate-limits-logging, we should have --github-rate-limits-logging option, which is disabled by default. So we should be able enabled it if needed for debugging, but by default it will be not enabled. So no need for --disable-github-rate-limits-logging option, only --github-rate-limits-logging.

@konard konard marked this pull request as draft January 11, 2026 01:51
@konard
Copy link
Contributor Author

konard commented Jan 11, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-01-11T01:51:08.374Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

…ault

- Resolve merge conflict in src/solve.config.lib.mjs
- Change --github-rate-limits-logging to be disabled by default
- Update logging logic to check for `=== true` instead of `!== false`
- Update changeset and test files to reflect new behavior

Per feedback: logging can be enabled with --github-rate-limits-logging
when debugging API usage issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@konard konard marked this pull request as ready for review January 11, 2026 02:00
@konard
Copy link
Contributor Author

konard commented Jan 11, 2026

🤖 Changes Applied

Based on your feedback, I've made the following changes:

1. Resolved merge conflicts

  • Merged main branch and resolved conflict in src/solve.config.lib.mjs
  • Kept new options from main (--prompt-playwright-mcp, --prompt-check-sibling-pull-requests)

2. Changed default behavior

  • --github-rate-limits-logging is now disabled by default
  • Enable with --github-rate-limits-logging when debugging API usage
  • Removed --no-github-rate-limits-logging option (no longer needed since logging is disabled by default)

Files changed:

  • src/solve.config.lib.mjs: Changed default from true to false
  • src/solve.mjs: Updated check from !== false to === true
  • src/github-rate-limit-logger.lib.mjs: Changed initial value to false
  • .changeset/github-rate-limit-logging.md: Updated documentation
  • experiments/test-github-rate-limit-logger.mjs: Updated test to verify disabled by default

CI Status: ✅ All checks passing

The PR is now ready for review.


🤖 Generated with Claude Code

@konard
Copy link
Contributor Author

konard commented Jan 11, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $2.853328 USD
  • Calculated by Anthropic: $1.700640 USD
  • Difference: $-1.152688 (-40.40%)
    📎 Log file uploaded as GitHub Gist (453KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure we log limits usage for each and every access to GitHub API

2 participants