c2b6823eba3fa962d8e906d9ec5da65c2366db44
A daemon shutdown or /restart cancels turnCtx without any guarantee that the goroutine owning a liveReply ever runs again to notice and clean up after itself -- a full process exit gives it no chance at all. Gateway now tracks every liveReply mid-turn in a registry and Stop drains it, marking each as interrupted so nothing is left ending in the "typing" cursor forever. finalize and abandon now run their bodies inside a per-reply sync.Once (the terminal field): a turn finishing naturally and a concurrent Stop draining the same reply were reaching it from two goroutines at once, both sending their own edit for the same message with the outcome decided nondeterministically by which HTTP response Telegram processed last -- including a complete real answer getting silently overwritten by the restart marker. Only one side's body now ever runs; the other blocks on the winner and then does nothing. The drain itself is bounded (liveDrainTimeout, default 5s): a single stalled Telegram API call must not hang gateway, and therefore daemon, shutdown indefinitely. Entries still in flight past the deadline keep running in the background rather than blocking Stop. A liveReply created in the narrow window between Stop claiming the registry and its own registration call is abandoned immediately instead of being registered into (and lost from) a registry nothing will drain again. Regression tests cover the mutual-exclusion race directly (20 iterations of finalize and abandonRestarted racing on the same reply, asserting exactly one outcome ever wins), the bounded drain against a deliberately hung API call, and the post-stop registration gap.
Description
Archie connects events from your systems to agents that can investigate, reason, and act.
Define what an event means, map its data into a workflow, and give that workflow an agent equipped for the job: its own execution environment, tools, and identity.
https://archie.catlow.cloud
133 MiB
0 Stars
1 Watchers
0 Forks
Releases
11
Archie v1.62.0
Latest
Languages
Go
76.7%
Vue
13.1%
TypeScript
7.8%
JavaScript
1.2%
Shell
0.6%
Other
0.4%