Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

1.5 KB
Raw Blame

OpenCode poll settles the owning assistant, not messages[-1]

Background

Two live OpenCode sessions hung with Avibe still polling: a completed assistant already carried UnknownError: unknown certificate verification error, then a user inject ("继续" / a watch callback) and an empty leftover generation sat after it. The poll loop only inspected messages[-1], so the error never became a terminal result.

Goal

Settle from the assistant that owns the current turn, using both the message snapshot and native session status. A trailing user while OpenCode is busy/retry is a live steer or auto-retry. The same snapshot while idle is a hang (watch callback / typed "继续" after a completed error) and can settle. An unreadable status is treated as live so an accepted steer is not closed.

Solution

_settlement_assistant_message walks the snapshot backward. Native liveness comes from the same status sample that produced the snapshot when the steering wrapper already read it; otherwise from /session/status. A successful omission (None) is idle. An unread or failed status is live. After posting auto-retry continue, the inject stays pending for a short confirmation window even if status already reports idle. Restored polls do not take the empty-success finish path until the error retry budget is exhausted. The status probe is bounded by the remaining turn budget. Auto-retry continue now arms the same awaiting-after boundary steer already uses, so settlement will not close the previous error until a post-boundary assistant exists.