Repository navigation
Conversation
|
@doistbot /review |
doistbot
left a comment
There was a problem hiding this comment.
Nice fix — when the channel lookup hits a rate limit, tdc thread view now still renders the thread (with channel:<id> in text, null in JSON) instead of failing outright, and the 429 hint now steers agents away from immediate retries.
Few things worth tightening:
- The default
viewThreadpath callsassertChannelIsPublicbeforegetChannelName, so a 429 on that separatechannels.getChannelscall still aborts the view before the new guard kicks in — the tests mockassertChannelIsPublic, so this path isn't exercised. Worth handling its rate limit the same way so both default and--jsonviews actually survive the limit. - Minor: the updated hint is a good step, though agents may still retry instantly if nothing discourages it — the degradation itself helps a lot here.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (2)
src/commands/thread/view.ts:54: This introduces a second channel-fallback prefix:
channel:CH100here, whilesrc/commands/inbox.ts:152already falls back withch:${thread.channelId}. Consumers parsing either command's output would have to handle both spellings. Pick one prefix (probablych:, since it shipped first) or reuse a shared helper so the fallback format stays consistent.src/commands/thread/thread.test.ts:882: This covers
--json, but the PR also changes--ndjsonthread output so the first line can carrychannelName: nullwhen the channel lookup is rate limited. That serialization contract is currently untested, so a regression in the ndjson branch would pass the suite. Add a test that parses the first ndjson line and asserts{ type: 'thread', channelName: null }.
Channel lookups are the only call in `thread view` with a per-user rate limit, so a bulk read of threads hits it first. The thread and comments have already loaded by then, and the channel name is only a label. On a 429, thread view now shows the channel id instead of failing, and --json / --ndjson output sets channelName to null. Any other error still fails as before. The 429 hint now says to wait a minute or two, and that retrying sooner keeps the limit in place. The old "Wait a moment" read as "retry now". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inbox already shows `ch:<id>` for a channel it can't name, so thread view now uses the same prefix instead of adding `channel:<id>`. Also covers the --ndjson shape when the channel lookup is rate limited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b3d3e09 to
059beee
Compare
|
@doistbot /review |
doistbot
left a comment
There was a problem hiding this comment.
This PR makes tdc thread view degrade gracefully when the channel-name lookup hits a 429: the thread still renders with ch:<id> in place of the channel name (and channelName: null in JSON/NDJSON), while all other errors keep failing, and the rate-limit hint now advises waiting a minute or two.
Few things worth tightening:
- The new tests pass only because the module mock stubs out
assertChannelIsPublic; in the real default path that helper issues its ownchannels.getChannelscall (absent from the fake client) and would still throwRATE_LIMITEDbefore the name lookup. Add that method tocreateClientand cover the case where the public-channel check itself hits the 429, otherwise the suite asserts a path the CLI doesn't actually support yet. channelNamechanging from always-a-string tostring | nullis a breaking contract change for scripts reading--json/--ndjsonoutput. As titled, semantic-release ships this as a patch; retitle tofix!(thread): ...(or add aBREAKING CHANGE:footer) so it releases as a major.
| thread: { | ||
| ...thread, | ||
| channelName: channel.name, | ||
| channelName, |
There was a problem hiding this comment.
channelName can now be null in the --json output (and in --ndjson at line 181, plus the single-comment output at line 78), so the field's contract changes from always-a-string to string | null for every script that reads tdc thread view. .agents/checks/command-surface.md calls out a changed --json field without a breaking-change PR title, and semantic-release derives the version from that title: as fix(thread): ... this ships as a patch, so consumers can break on a routine upgrade. Retitle to fix!(thread): ... (or add a BREAKING CHANGE: footer) so it releases as a major, as #111 did for the --stdin change.
A null channelName in --json and --ndjson would change the output contract, so it would have to ship as a major release. The fallback is rare, so the field stays a string and uses the same ch:<id> the text header and tdc inbox already show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TL;DR
When Comms rate limits the channel lookup,
tdc thread viewnow shows the thread and its comments, with the channel id where the name would be. Any other error still fails as before. The rate-limit error also now says to wait a minute or two, not "a moment".Why
Showing a thread takes four calls to Comms: the thread, its comments, the workspace's people, and the channel. Only the channel call has a per-user rate limit. In practice it's about 100 calls a minute.
On 23 October an agent read about 1,000 threads in two minutes. The channel lookups hit the limit, and every view after that failed. The thread and its comments had loaded fine. All that was missing was the channel's name.
The error then said "Wait a moment, then retry". An agent reads that as "retry now". Comms counts rejected calls against the limit too, so retrying straight away keeps the user locked out. The limit is per user, so while it lasts, that person's web app can't load channels either.
What changes
When the channel lookup gets a 429:
RATE_LIMITED[ch:CH100]in place of[General]new--json/--ndjsonRATE_LIMITED"channelName": "ch:CH100"newAnd the hint on every rate-limit error:
Those are the only changes. Everything else is how it already worked.
Text and JSON both show
ch:<id>, the same fallbacktdc inboxalready uses for a channel it can't name. I first usednullin JSON, but that changes what scripts get from--json, so it would have to ship as a major release. The fallback is rare, sochannelNamestays a string and nothing reading it breaks.Only a rate limit is skipped over. A 404 or 403 means something is actually wrong, and hiding that would be worse than failing.
The private-channel check that runs before the name lookup still fails on any error, a 429 included. If it can't run, the CLI can't tell whether the thread is private, so carrying on could show a private thread. It also uses a different call that has no per-user limit, so it isn't the one these 429s come from.
The hint says "a minute or two" rather than "a minute". Comms adds up the current minute and the whole previous minute, so after a burst it can take up to two minutes before calls get through again.
No new metrics: the CLI has no metrics pipeline.
Three things to look at
Retry-Afterheader, the SDK could pass it on and the hint could give the exact wait.How it relates to other PRs
It stands alone. It's one of three fixes from the same investigation. comms-cli#93 makes
tdc inboxfetch channel names in one call instead of one call per channel. comms-backend#1155 sendsRetry-Afteron 429s. The SDK doesn't expose response headers yet, so the CLI can't read that header until it does.References
api.tsatdba87ddview.tsatdba87ddrate_limiter.py🤖 Generated with Claude Code
(Written by Rory's agent)