Repository navigation
fix(channels): keep group GitHub reads working after a rate-limited connection - #1394
Merged
zhaozhaozz merged 1 commit intoNov 26, 2026
Conversation
…onnection A group turn registered its per-repository reader before connecting it. When the first connection hit GitHub's rate limit, RepositoryExplorer rethrew it, so the reader stayed without a client and every later read in the turn answered github_read_token_required, even after the window reset. The group tool set has no github_read_token tool, so the model could not recover and reported the bot's credentials as broken. Group and assistant repository tools now go through RepositoryExplorer.executeConnected: it connects before every call, answers a rate limit as an observation with the bucket, the reset time and a statement that credentials and permissions are fine, and mints no token while a refused connection's window is still used up (each mint would count against the read-token limit). Task-side execute and github_read_token keep their contract. Fixes agent-CI-Infra#1393
Collaborator
Author
|
Reviewed head |
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.
Fixes #1393
Problem
In a group assistant turn, the first GitHub read that hits a rate limit breaks every later read in that turn. In production (DM开发群 daily report, 2026-11-26 01:00–01:15 UTC), the first
github_searchwas refused because the openJiuwen-ai installation's window was used up until 01:10. The next 11github_read/github_searchcalls all returnedgithub_read_token_required, including the calls made after the reset. The report then asked an administrator to restore the bot's read credential, but the installation was healthy.Cause
github()insrc/channels/service-session.tsregistered the per-repository reader inexplorersfirst and only then connected it withexecute('github_read_token', {}).RepositoryExplorer.executerethrowsgithub_rate_limited, soentry.errorwas never set and the explorer kept noclient. Every later call reached!this.clientand answeredgithub_read_token_required. Nothing connected again, and the group tool set has nogithub_read_tokentool, so the model could not recover either.src/service-roles/resources.ts(the assistants' repository tools) connected before every call, so it was not sticky. A rate limit still left it as a thrownTaskError, though. The task-tool dispatcher (src/roles/task-tools.ts) hands onlyHttpErrorrefusals back to the model, and the management assistant sets norepairInvalid. So on Pi this error propagated out of the tool call instead of reaching the model as an observation.Fix
New
RepositoryExplorer.executeConnected(name, args)insrc/agent/exploration.ts, used only by the two sessions that offer nogithub_read_tokentool (group turns andServiceRepositories):error: 'github_rate_limited';bucket, for exampleinstallation:175700149;reset_at, ornullwhen GitHub gave no time;detail;instructionsaying that the credentials and permissions are fine and that the model should retry afterreset_at.ReadTokens.maxIssued(10). The production turn made 11 calls, so it would have ended withgithub_read_token_limit, which is again sticky and misleading.The task path stays as it is.
execute()still rethrowsgithub_rate_limited, so a task attempt waits for the reset.github_read_tokenis still an explicit tool for tasks, and reads without it still answergithub_read_token_required. The new ST asserts the rethrow.docs/design/agent-and-harness-runtime.mddescribes the two contracts.Side effect: in groups, a connection failure that is not a rate limit (for example
github_unavailable) is no longer cached for the rest of the turn. The next call tries again, as the assistant path already did.Tests
test/st/src/channels/channel-service-bindings.test.mjs, a new group turn case. The installation window is used up for about 1.5 s. Then:github_readreturnsgithub_rate_limitedwith the bucket,reset_atand the instruction.github_searchin the same window gets the same answer and no new token.reset_at,github_readreturns the PRs.No observation in the turn contains
github_read_token_required. Two tokens are minted (the refused connection and the one after the reset), and both are revoked.On
main'sservice-session.tsthe same case fails: calls 2 and 3 return{ repository, result: { error: 'github_read_token_required' } }.test/st/src/agent/repository-exploration.test.mjs, the same sequence throughServiceRepositories(assistant tools). It also checks that the task-sideexecute('github_read_token')still rejects withgithub_rate_limited.Verification
Head
6a5ca1d5(onmain52980755), Node 22.19.0:npm ciexit 0;(cd runner && npm ci)exit 0.npm run checkexit 0.npm testexit 1: 2844 tests, 2836 passed, 8 failed in 3 sets that this change does not touch. Each one passes when it runs alone:distributed-nodes:node_agent_connect_timeoutunder parallel load. Passes alone:node test/framework/test-sets.mjs --jobs 1 test/st/src/cluster/distributed-nodes.test.mjs.codex-harness: two "stopped promptly" timing assertions under parallel load. Passes alone with the same command.runner-transport:EADDRINUSEon Unix sockets. Under this worktree the socket paths are 147 characters, above the 108-bytesun_pathlimit. It fails alone too, for the same reason. With a shortTMPDIRit passes:TMPDIR=<worktree>/.tmp/s node --test test/ut/manager/runner-transport.test.mjsgives 4/4.repository-explorationandchannel-service-bindings).