You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method is not cancel safe. If the method is used as a branch in tokio::select! and another branch completes first, then some data may have been partially read, and this data is lost.(tokio 1.53 の doc)
Activity
335g commentedon Oct 17, 2026
修正した(
minaeクライアントのみ。プロトコル変更なし)。cargo test --workspace— 564 passed / 0 failed。真因
tokio::io::AsyncBufReadExt::read_lineは cancel unsafe:minae/src/app.rsのメインループはtokio::select! { biased; キー入力 / read_sock_line(conn) / read_sock_line(input_conn) / tick / retry }で、read_sock_lineはread_lineを呼んでいた。キー入力や tick(エージェント走行中は 200ms ごと)が先に完了するたびに、送受信中の行の部分読みがその場で消える。 消えた行が daemon のPushだとsnapshot.conversation.latest_idが進まず、pull_conversationが起きない → code View を触るまで UI は古いまま(この issue の症状そのもの)。長い行ほど(=スナップショットが大きいほど)窓が広く、確率的に落ちる。minad側は正しい: 別の Interactive 購読者へ push する契約は新規テストconversation_post_from_headless_pushes_to_interactive_subscriberで固定した(修正前から通る)。変更
Conn.readerをBufReader→Lines<BufReader<..>>にし、read_sock_lineをnext_line()(cancel safe、tokio 保証)へ。起動時 Open /:wq/ 入力 Document の Open 読みも同じ形に揃えた(Linesは行末の\nを落とすので、利用側はserde_json::from_strのみで問題なし)。sweep_dead_base_rootsがServerInfo以外の行を捨てていたのをon_socket_lineへ流すよう修正。Messages応答を捨てるとconversation_pendingが立ったままになり、以後 pull しなくなる(同じ「永久に古い」系の穴)。回帰テスト
minae/src/app.rs::partial_line_survives_a_cancelled_read— 行の途中で読みをキャンセルさせ、その後の行が完全に読めること。対照としてread_lineだと行頭が消えることも同じテスト内で固定(テストが真因を捉えていることの証明)。minad/src/daemon.rs::conversation_post_from_headless_pushes_to_interactive_subscriber— Headless の投稿が Interactive 購読者へ push で届く契約。前後比較(実 UI、同条件)
123 KB のファイルを code View に置き(push の行が BufReader の 8 KB を超えて複数回の read になる)、入力ポップアップにフォーカスして
minas sayを 30 通 × 3 ラウンド、キー送出と同時に投げる。code View は一切触らない。daemon latest_idとローカル履歴の差)latest_id == transcript_max)修正前は取りこぼした行以降 UI が古いまま(
!と「未回答 n」も残る)。修正後は code View を触らずに追従する(受入条件 1〜3)。残る(この issue の範囲外)
会話入力 (<id>)を出す(minae/src/render.rs:858が焦点を見ていない)。記録:
docs/verification/dogfood-log.md§6 Session 12(Fixes shipped / F1 の行を fixed に更新)。