Repository navigation
Conversation
The poll loop spent one conversation-list read per cycle. The list endpoint is billed per call against a separate 1,000/day budget, so at the default 30 s interval the budget empties in about 8 hours and inbound dies for the rest of the window. Discovery now runs at startup and then at most every max(600 s, 20 poll cycles); between discoveries every known conversation is polled directly (an idle events page returns no resources). New conversations are picked up on the next discovery pass instead of within one poll cycle - the trade the budget imposes. Refs #228.
The plugin learns which conversations to read by listing them first, then reading each conversation's events. Those two endpoints are metered separately: the list carries the account's 1,000-call daily user budget, whilst the per-conversation events endpoint runs on a much larger allowance (measured headers: x-user-limit-24hour-limit 1000 on the list, 10000 on events). A 429 from the list therefore ended the whole poll cycle and slept for up to fifteen minutes, even though the events endpoint would have answered. Observed on a live account: list 429 with x-user-limit-24hour-remaining: 0, events 200 with 9990 remaining — inbound was dead for the rest of the day with no error beyond the rate-limit warning. Conversation ids are now kept (~/.hermes/xchat/conversations.json, mode 600) and recovered from the cursor state, so a throttled list degrades to polling known conversations directly. Discovery is retried when the throttle is due to lift rather than every cycle, which would spend a refused request each time.
os.chmod(0o600) does not change the mode Windows reports (666), so the restart test failed before it reached the persistence check. The mode check stays on POSIX.
…inned sets pinned Salvage follow-up on #280 + #227. With discovery on its own cadence every known conversation gets an events read each cycle, so a long-lived account with many (persisted) conversations would trade the list budget for the events one (10,000/24h): the cycle now stretches past XCHAT_POLL_INTERVAL once the reads would exceed 9,000/day (one conversation at the 10 s default is unchanged). Persisted conversation ids no longer widen an explicitly pinned XCHAT_CONVERSATION_IDS set. README describes the new inbound cadence.
Contributor
Author
This was referenced Nov 19, 2026
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.
Summary
Inbound X Chat stopped for the rest of the day once the account's conversation-list budget ran out (#228). Two causes:
GET /2/chat/conversationson every cycle. X meters that endpoint against its own 1,000 calls / 24 h allowance, so at the 10 s default the list budget is gone in under 3 hours.429from the list ended the whole cycle, even though the events endpoint (10,000 / 24 h) would still have answered.This combines the earliest correct fix for each cause, with authorship kept:
max(600 s, 20 poll intervals). Between discoveries every known conversation is read directly. That alone cuts list reads from 8,640 a day to ≤ 144.xchat/conversations.jsonand also recovered from cursors. A throttled list degrades to polling the known conversations and retries discovery when the reset is due. The Windows test fix is included. I applied it without the feat(xchat): pace polling to the account's 24-hour call budget #226 stack underneath; the only conflict was the loop body, and fix(xchat): keep polling when the conversation list is throttled #227's_charge_callshook isn't needed without feat(xchat): pace polling to the account's 24-hour call budget #226.XCHAT_POLL_INTERVALwhen those reads would exceed 9,000 a day. One conversation at 10 s is unchanged; ten conversations get ~96 s. Persisted ids also no longer widen an explicitly pinnedXCHAT_CONVERSATION_IDSset. README "Inbound" now describes the cadence.No new env vars or config keys.
Supersedes #280 and #227. Not taken: #226 (adaptive pacing with a token bucket). It adds three new non-secret
XCHAT_*env knobs and still spends one list read per cycle, so it doesn't fix the budget on its own.Refs #228. The streaming transport proposed there is still a separate change, so the issue stays open for it.
Tests
xchat/tests: 67 passed, against a main baseline of 60. The 7 new tests fail over main's source. My 2 tests also fail over the cherry-picks alone.Merged together with #191, #278 and #323: no conflicts, 72 passed.