人類助理合併+疑似卡住標記:tasks(可觀測)+ claims(可信任)併入 main(效能修復之上);進行中任務 15 分鐘無動靜在卡片標「疑似卡住」(狀態不變,純標記,規格 §可觀測 P0 驗收)
已驗證: cargo test 812 passed(僅剩 layout_audit 既有紅,下一筆修)、tasks:: 20 passed 含新 stall 表格測試
This commit is contained in:
parent
e3b9163cb5
commit
7c91bd9ffc
|
|
@ -20,3 +20,4 @@
|
|||
|
||||
# Release packages (deploy/ci, deploy/mac/bundle.sh)
|
||||
/dist/
|
||||
.claude/worktrees/
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ AnyBot 是一個桌面聊天 App,介面和運作方式照 Grok Bot 重做。
|
|||
- **清單**:所有 Bot 的任務放一起,最後有動靜的在上面,最多 60 件。每張卡:頭像和 Bot 名字、誰開的、開頭那句話(一行)、狀態、在哪台電腦(步驟指定的電腦,沒有就是 Bot 的預設電腦)、步驟數和失敗數、最後動靜、現在在做什麼或最後一步、卡住或失敗的原因、產物和 ✓/✓✓/! 記號、證據等級。點卡片:打開那個 Bot 的聊天,捲到開頭那則訊息亮一下(手機上太早、手機沒存的訊息就停在最新,跳一句提示)。
|
||||
- **一件事怎麼算**:你的一句話開一件;Bot 工作中你插的話算同一件;目標的「[目標]」下一輪、追進度好了叫醒它(「[追進度 #N]」)、監看印出東西(「[監看 #N]」)、檔案沒顯示叫醒它重交(「[交付]」)都接回開這件事的那一件。任務的編號是「Bot 編號-開頭那則訊息的時間」,不會變。
|
||||
- **狀態**(各自分開,不用一個「完成」帶過):
|
||||
- 進行中、等你(允許卡、問題卡、目標停下來問你)、追進度中(它登記的追進度還在跑)、驗收中(目標還開著,另一個模型在檢查或準備下一輪)。
|
||||
- 進行中、等你(允許卡、問題卡、目標停下來問你)、追進度中(它登記的追進度還在跑)、驗收中(目標還開著,另一個模型在檢查或準備下一輪)。進行中的任務 15 分鐘沒有任何動靜(訊息、步驟、交付全算),卡上多一行「疑似卡住:N 分鐘沒有動靜」——狀態不變,只是標出來;長命令本來就會幾分鐘沒消息,宁可漏報不误報。
|
||||
- 已產出(有檔案,還沒有你的裝置回報顯示)、已交付(你的某台裝置顯示了)、你已確認(你點開了,或對那則回答按了 👍)。團隊成員的裝置不算你的。
|
||||
- 已回覆(系統看到步驟做完,沒有檔案要交)、已驗收(目標的檢查說達成)。
|
||||
- 失敗(模型或步驟出錯、AnyBot 關掉時中斷、訊息送到後 15 秒還沒開始回覆、目標做不到;原因寫在卡上)、已停止(你按了停止)、結束但未驗證(輪結束了,但沒有系統看得到的結果,或只有別的 Bot 的轉述)。
|
||||
|
|
|
|||
|
|
@ -49,3 +49,4 @@
|
|||
- (驗證)假模型對 `[[call …]]` 只叫那一步,`ask_bot` 的同事回的是「FAKE-MODEL 回答:…」,一樣算 C。
|
||||
- (驗證)首頁的「任務」數字只算進行中、等你和 24 小時內失敗的;已回覆、已交付不算,所以前兩步看不到數字是對的。數字在 `#quick [data-q="tasks"] b` 裡(按鈕的字中間是換行,`wait-text '任務 1'` 對不到)。
|
||||
- (驗證)從卡片進聊天,返回回到任務頁(不是首頁):步驟照這個順序寫。
|
||||
- (驗證)「疑似卡住」要走满 15 分鐘無動靜,頭部環境無法快轉時間,verify 走不到這行;由單元測試 `a_running_task_that_goes_quiet_is_marked_suspected_stalled` 覆蓋。
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ impl App {
|
|||
}
|
||||
ui.min_rect().expand2(vec2(16.0, 14.0))
|
||||
});
|
||||
let r = ui.interact(card, egui::Id::new(("task-card", &task.id)), egui::Sense::click());
|
||||
let r = ui.interact(card, egui::Id::unique(format!("task-card-{}", task.id)), egui::Sense::click());
|
||||
if r.hovered() {
|
||||
ui.painter().rect_stroke(card, R_L, Stroke::new(1.0, p.text3), egui::StrokeKind::Inside);
|
||||
}
|
||||
|
|
|
|||
30
src/tasks.rs
30
src/tasks.rs
|
|
@ -29,6 +29,10 @@ const TEXT_CHARS: usize = 60;
|
|||
/// A person's message nobody started on yet is still on its way this long (ms); after that it
|
||||
/// had no reply.
|
||||
const START_GRACE_MS: i64 = 15_000;
|
||||
/// 規格驗收(人類助理 §可觀測 P0):一個進行中的任務超過這麼久沒有任何動靜(訊息、步驟、
|
||||
/// 交付全算),卡片標「疑似卡住」。狀態不變,只有標記——宁可漏報,不误報:长命令(下载、
|
||||
/// 编译)本来就几分钟没消息。
|
||||
pub const STALL_MS: i64 = 15 * 60_000;
|
||||
/// The read-only tool a bot answers 「現在在跑什麼」 with.
|
||||
pub const TOOL: &str = "list_tasks";
|
||||
/// The reaction that says the person has it (the 「你已確認」 signal, with a file opened).
|
||||
|
|
@ -682,6 +686,13 @@ fn work_out(r: &Read, newest_turn: Option<usize>, live: &Live, records: &[Event]
|
|||
if done_c > 0 {
|
||||
proof.push(format!("別的 Bot 回答了 {done_c} 次(轉述,系統沒有驗證)"));
|
||||
}
|
||||
// 進行中的任務太久沒動靜:標「疑似卡住」(狀態不變,只標記;規格 §可觀測)。
|
||||
if status == Status::Running && now - heartbeat > STALL_MS {
|
||||
if !why.is_empty() {
|
||||
why.push(',');
|
||||
}
|
||||
why.push_str(&format!("疑似卡住:{} 分鐘沒有動靜", (now - heartbeat) / 60_000));
|
||||
}
|
||||
if f.goal == Some(GoalEnd::Met) {
|
||||
proof.push("目標由另一個模型檢查,判定達成".into());
|
||||
}
|
||||
|
|
@ -1084,6 +1095,25 @@ mod tests {
|
|||
assert_eq!((t.status, t.why.as_str()), (Status::Failed, "Bot 沒有開始回覆"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_running_task_that_goes_quiet_is_marked_suspected_stalled() {
|
||||
let mut b = bot(vec![user("整理報表", 1_000), said("", 1_100, &[("shell", r#"{"command":"ls"}"#, ToolStatus::Running)])]);
|
||||
let mut live = Live::default();
|
||||
live.running.insert(1, "執行指令 ls".into());
|
||||
// 還活著:不標。
|
||||
let t = &from_chat(&b, &live, 1_100 + STALL_MS)[0];
|
||||
assert_eq!((t.status, t.doing.as_str(), t.why.as_str()), (Status::Running, "執行指令 ls", ""));
|
||||
// 太久沒動靜:標「疑似卡住」,狀態仍是進行中。
|
||||
let t = &from_chat(&b, &live, 1_100 + STALL_MS + 1)[0];
|
||||
assert_eq!(t.status, Status::Running);
|
||||
assert!(t.why.starts_with("疑似卡住:") && t.why.contains("沒有動靜"), "{}", t.why);
|
||||
// 結束的任務不標(失敗就是失敗,不疊卡住)。
|
||||
settled(&mut b, TurnOutcome::Error, 1_200);
|
||||
let t = &from_chat(&b, &Live::default(), 1_200 + STALL_MS + 1)[0];
|
||||
assert_eq!(t.status, Status::Failed);
|
||||
assert!(!t.why.contains("疑似卡住"), "{}", t.why);
|
||||
}
|
||||
|
||||
fn file(seen: &[(&str, SeenKind, &str)]) -> Attachment {
|
||||
let mut a = Attachment { name: "a.png".into(), id: "att1".into(), image: true, ..Default::default() };
|
||||
for (d, k, why) in seen {
|
||||
|
|
|
|||
Loading…
Reference in New Issue