Back to all writing

Field notes

Hayate Agent's Hourly Report Kept Posting

A scheduled job in Hayate Agent could post follow-up after follow-up when its model kept proposing another look, and a reply that hit the chat server's rate limit was tried again on every host tick. Core #593 stops a scheduled job from continuing just because its model proposed it, and holds a rejected reply until the wait Matrix asks for has passed, with that request capped at one hour. In a scripted run, one hourly run posted 20 times before the fix and once after.

Hayate Agent's Hourly Report Kept Posting

冬の宵
報告ひとつ
それで足る

Winter evening.
One report,
and that is enough.

An hourly report is supposed to arrive once an hour. In Hayate Agent, a scheduled job runs a prompt, and the answer lands in a chat room. If the model ended its answer by proposing another look, the agent treated that as a reason to keep working, so the same job could start a follow-up turn, post it, propose the next one and post that too. The core #593 description says exactly that: it stops "the hourly overview self-continuation loop", where each continuation was posted to Matrix. The same PR also fixes a separate delivery problem: what the agent does when the chat server rejects a reply with its rate limit.

Both halves sound trivial. They are not, because both behaviors exist on purpose. Letting a task continue after a turn is how longer jobs get finished, and retrying a failed delivery is how no reply gets lost. I think #593 draws the line in the right place: a timed job no longer extends itself because the model proposed to continue, and a rate-limited chat gets the pause the server asked for, up to a one-hour cap. Core PR #593 merged into main at 12:33 this Tuesday (Europe/Berlin, as are all times here).

Hayate Agent cover on a dark indigo background: small slate 疾風 logo, a two-line red Japanese headline Hayate Agentの / 毎時レポートは投稿を続けていた (Hayate Agent's hourly report kept posting), and below it the two-line white English headline Hayate Agent's Hourly Report / Kept Posting

No follow-up turn for a "continue"

Before #593, the host queued a follow-up turn when a turn ended with a "continue" proposal and its other gates were open, among them no queued input, not stopping, no pending dependency, fewer than 20 repetitions counted for the task, and the session was not the nightly improvement job. Scheduled jobs run in sessions named cron:<job name>, and nothing in that list excluded them. #593 adds one condition to that guard and one to the host's own pick-up of retained tasks: in a session whose key starts with cron:, a "continue" proposal no longer queues another turn, and the host no longer picks up a retained task there on its own.

The AI agent that drafts these changelog posts ran a throwaway test against the real Harness and Scheduler classes at #590 (the merge right before #593) and at #593. It used the repository's own test fakes: a scripted model that proposes "look again" after every answer, an hourly job that delivers into an in-memory chat room, and five extra host ticks after the run.

Scenario Before #593 After #593
Model turns, one hourly run 20 1
Messages posted 20 1
Send attempts, 60 s limit 5 2
Rejected sends 4 1

Before #593 the run posted "overview 1" through "overview 20" and then stopped, because 20 repetitions is the budget for a task that shows no new progress. That budget is what ended the loop, not a rule about scheduled jobs. After #593 the run posted "overview 1" once, and the five later ticks added nothing.

Hayate Agent infographic on a dark indigo background, red title One hourly run, twenty posts, subtitle scripted model that always proposes another look. Four bars: Before the fix: posts from one run 20; After the fix: posts from one run 1; Before the fix: sends in a 60 s limit 5; After the fix: sends in a 60 s limit 2. Full bar = 20. Footer: Local test with the repo fakes, not a live system. Core PR 590 vs PR 593, run 17 Nov 2026

Waiting when the server says wait

Matrix answers a sender that is going too fast with HTTP 429 and a retry_after_ms value. Hayate Agent's Matrix plugin already treated 429 as a temporary failure, so the reply stayed in the session's outbox and went out on a later attempt. The host retries waiting outboxes on its tick, which runs every 15 seconds by default. Before #593, nothing read the server's wait, so a reply could be sent again on every tick while the limit was still in force.

#593 reads retry_after_ms from the failure message and holds that session's outbox until the wait plus 250 milliseconds has passed. The reply stays queued, it is not dropped, and it is sent once when the wait is over. The same scripted run simulated a 60-second limit and called the outbox every 15 seconds: before #593 it tried at 0, 15, 30, 45 and 60 seconds, with four rejections; after #593 it tried at 0, was rejected once, skipped the next four ticks and delivered at 75 seconds.

The PR's two commits show the one real design choice. The first commit, at 11:29, capped the server's wait at 60 seconds. The second, 19 minutes later at 11:48, raised the cap to one hour and added a test that a 120-second wait is honored. A 60-second cap would have sent again while the server still said no. Only the merged version, with the one-hour cap, was ever in a release.

What the fix does not cover

The guard is a prefix check on the session key. A recurring job that runs in a normal chat session (for example a /loop turn) is not a cron: session and keeps the old continuation rules.

A scheduled job can still declare a bounded wait: the model says it is waiting for something, with a recheck between one minute and one day later and a deadline at most seven days out. When the wait is due, the host submits a recheck turn in the same cron: session. #593 does not touch that path.

The wait is held in memory per session. A restart forgets it, and another session that sends to the same room is not held by it. The wait is read from the error text, and the Matrix plugin keeps only the first 200 characters of the server's answer, so a retry_after_ms further down would be missed. A server wait longer than one hour is cut to one hour before the 250 milliseconds are added, and the send itself happens on the first host tick after that.

Test evidence

The four tests that #593 adds live in one new file. At #590 that file fails to load, because it imports the retryAfterMs function that only #593 adds. At #593 all four pass. The #593 description reports a full Linux suite run with 2,809 passing tests and no failures; that number is the author's, it was not rerun here. These are controlled local tests with fake sessions and an in-memory chat, not a live system. The PR page has no review record and no discussion comments.

The rest of the day

Between 08:00 and 20:00 on Tuesday, core merged seven pull requests, plugins merged one and webui merged two. A query for merged pull requests in deployment-base returned none for the window.

In core, #589 (08:12) localized one stalled dispatcher status. #591 (08:48) changed which model writes hashtags: the configured hashtag model, else the basic role, else the main model of the current scope, with thinking turned off for hashtags only. #590 (09:08) replaced a technical budget notice with a plain one and lets an authenticated operator resume the held task by saying "continue". #592 (13:10) and #594 (16:09) tightened the dispatcher: #594 applies the configured retry limit to interrupted work claims at startup, so a task that keeps getting interrupted is no longer replayed without end. #596 (19:23) is an automated lock refresh that pins the plugins revision of plugins #116.

Plugins #116 (19:21) adds a WebSocket transport that fails closed when no main adapter is bound; its core counterpart, core #595, was still open when this post was written. In webui, #14 (18:40) keeps the sidebar contained on phones, and #15 (18:59) keeps fetched conversations visible when project discovery fails. The #15 description says itself that it fixes a reproduced failure and does not prove that this was the cause of the reported missing history.

What merged and what shipped

Core published eight releases in the window, v0.1.372 at 08:06 to v0.1.379 at 19:35. v0.1.372 tags the merge of #588, which landed before the window. #593 is first in v0.1.376, published at 12:44, whose tag sits on the #593 merge commit. v0.1.379 tags the #596 lock refresh. Plugins and webui published no release. A release tag identifies the tagged source commit; it says nothing about which installations run it. At 20:16 main was at the #596 merge.

Verdict

Before #593, a scheduled job whose model kept proposing more work posted follow-up after follow-up until the repetition budget stopped it, and a rate-limited reply was sent again on every tick. After #593, a "continue" proposal no longer buys a scheduled job another turn, so the scripted hourly run posted once, and a rejected reply waits for the time Matrix asks for (that request capped at one hour) plus 250 milliseconds, and goes out on the next host tick after that. Bounded waits that the job declares itself can still bring it back. That is the behavior I expect from a timer: it rings, the job does its work, and the model's wish for one more look is no longer a reason to post again.

Sources used