feat: 目標的評審可以自己查證(只看),同一個理由連兩次就暫停,不每輪提高標準
- 評審證據不夠時可以用 read_file、list_dir(Bot 做事的那台電腦)、web_fetch 查,最多 3 次;要它做別的會被拒絕,不會真的做;次數用完要它只回 JSON。 - 連續兩輪「還沒達成」說的是同一件事(字稍有不同也算,字元配對重疊 70%)就暫停「同樣的問題連續兩次」。 - 評審的提示加上:每一輪同一個標準,不因為 Bot 做得比上一輪多就提高要求,不加目標沒寫的條件。 已驗證:cargo test 584 通過(新的 the_same_reason_twice_pauses、the_judge_looks_for_itself_read_only:用假模型讀檔、被拒絕的 shell 沒有建立檔案)、clippy -D warnings 乾淨。 未驗證:真的模型實際用工具查證的樣子。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e23f19727e
commit
e6c1501090
|
|
@ -1558,10 +1558,10 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
|
|||
- **/goal 目標**(照 Claude Code 的 /goal 做):給 Bot 一個「做到什麼程度才算完成」的條件,它就一輪接一輪做下去,不用每一步都叫它。關鍵是**做事的模型不能自己宣布完成**:每一輪結束後,另一個模型(Bot 的「執行步驟用的模型」,通常是快速模型;設成「關閉」就用 Bot 自己的模型)只看這段對話(Bot 說的話、用了哪些工具、工具回了什麼),判斷條件成立了沒有。
|
||||
- **用法**:「/goal 所有測試都通過,而且 clippy 沒有新的警告」設定並馬上開始做(已經有目標就換掉);「/goal」看目前的目標、做了多久、檢查了幾輪、最近一次檢查的理由;「/goal clear」清除(stop、off、reset、none、cancel、清除、取消、停止也可以)。在 / 清單最上面,標「指令和技能」。電腦、大腦的螢幕、手機打的都算,由大腦處理;訊息管道(Slack、Telegram…)和團隊成員打的不算指令,別人不能替你設目標。條件最多 4000 字;群組聊天還不能設目標。「清除聊天記錄」和「開始新對話」會連目標一起清掉;分享 Bot 的檔案不含目標。
|
||||
- **檢查的結果**:還沒達成 → AnyBot 自己送出一則標「目標」的「還沒達成:(理由)」開始下一輪,理由就是下一步該做什麼;達成 → 聊天裡一行「目標達成:…(N 輪 · 多久)」,目標清掉,這個聊天上撒一下彩帶(慶祝動畫,設定 › 一般可關);做不到 → 「目標做不到,已清除:…」;Bot 在等你回答或動手(登入、付款、做決定)→「目標暫停,等你回覆:…」,不會一直空轉。
|
||||
- **煞車**(比 Claude Code 嚴,因為 AnyBot 一輪可以做很多步、用的是你自己的金鑰):一個目標做 20 輪還沒達成就暫停問你;連續 3 輪都沒有用任何工具(只是在說話)就暫停;這一輪出錯、你按了停止(兩輪之間正在檢查時按也算)、檢查的模型沒回應、AnyBot 重新啟動過,也都是暫停。重新啟動後按中斷卡片上的「繼續」,目標也跟著接下去。暫停時目標還在,**傳一句話(例如「繼續」)就接著做**,用完 20 輪的再給 20 輪;不要了就 /goal clear。
|
||||
- **煞車**(比 Claude Code 嚴,因為 AnyBot 一輪可以做很多步、用的是你自己的金鑰):一個目標做 20 輪還沒達成就暫停問你;連續 3 輪都沒有用任何工具(只是在說話)就暫停;連續兩輪檢查說差的是同一件事(用字稍有不同也算)就暫停「同樣的問題連續兩次」,再做一輪多半還是卡在那裡(參考 grok-build);這一輪出錯、你按了停止(兩輪之間正在檢查時按也算)、檢查的模型沒回應、AnyBot 重新啟動過,也都是暫停。重新啟動後按中斷卡片上的「繼續」,目標也跟著接下去。暫停時目標還在,**傳一句話(例如「繼續」)就接著做**,用完 20 輪的再給 20 輪;不要了就 /goal clear。
|
||||
- **看得到的地方**:輸入框上方一行「目標進行中 · 12 分 · 3 輪」(檢查時是「正在檢查有沒有達成…」,暫停時是「目標暫停 · 原因」),滑過去看條件和最近一次的理由,右邊「清除目標」;窄視窗時字會縮成「…」,不會擠掉按鈕。AnyBot 自己的那幾行(達成、暫停、狀態)在聊天中間用小字顯示,不是 Bot 的話,**不會送給模型**,也不算檢查的證據。手機一樣,大腦的螢幕看到的是大腦同步過來的。
|
||||
- **通知**:目標進行中的每一輪不再各通知一次「完成了」;達成、做不到、暫停時才通知(你不在電腦前時,手機也會收到),例如「Master 達成目標了」「Master 在等你回覆」。
|
||||
- **模型讀到的**:你的「/goal …」後面多一行,說明這是目標、每輪會有另一個模型檢查,所以要用實際的結果證明(指令輸出、測試結果、檔案內容、畫面),需要你做什麼就直接問;「還沒達成」那則後面也提醒它接著做。檢查用的模型讀的是從設定目標那則訊息起的對話(太長就讀最新的約 24000 字;每個工具結果留開頭和結尾,測試的總結通常在最後),並知道已經第幾輪、做了多久,所以條件裡寫「最多 10 輪」也算數。
|
||||
- **模型讀到的**:你的「/goal …」後面多一行,說明這是目標、每輪會有另一個模型檢查,所以要用實際的結果證明(指令輸出、測試結果、檔案內容、畫面),需要你做什麼就直接問;「還沒達成」那則後面也提醒它接著做。檢查用的模型讀的是從設定目標那則訊息起的對話(太長就讀最新的約 24000 字;每個工具結果留開頭和結尾,測試的總結通常在最後),並知道已經第幾輪、做了多久,所以條件裡寫「最多 10 輪」也算數。對話裡的證據不夠時,檢查的模型可以自己查證,最多 3 次、只能看:在 Bot 做事的那台電腦上讀檔(read_file)、看資料夾(list_dir),或讀公開網頁(web_fetch);要求用其他工具(執行指令、寫檔…)會被拒絕,不會真的做。它被要求每一輪用同一個標準:只看目標本身寫的條件,不因為 Bot 做得比上一輪多就提高要求,也不加目標沒寫的條件。
|
||||
- **權限不變**:要你核准的步驟照樣停下來等;要放著讓它自己做完,Bot 要開「直接操作」或「自動審核」(Claude Code 也要配 auto mode)。
|
||||
- **終端機**:`anybot --ask "/goal …"` 會一直做到達成、做不到或暫停才結束(像 `claude -p "/goal …"`),最長 ANYBOT_ASK_SECS 秒(預設 900)。
|
||||
- **`anybot --ask` 給腳本用**:`--json` 每則訊息一行 JSON(type message/approval/learned/done;done 有 ok、code、steps、secs、timed_out、answer,金鑰遮過);`--bot 名字` 問哪個 Bot;`--data-dir 資料夾`(跟 ANYBOT_DATA_DIR 一樣,在讀任何東西之前就設好);`--approve once` 要核准的自動允許一次(問題卡和「需要處理」照樣略過),不給就自動拒絕。結束碼:0 這一輪順利、1 失敗或時間到、130 Ctrl-C(會先停下 Bot)、2 指令寫錯或資料夾裡還沒有 Bot。核准改走跟按鈕一樣的路:以前 App 操作(刪例行任務這類)的核准在這裡會一直等到時間到。
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
## 子功能
|
||||
|
||||
- 設定:「/goal 條件」(最多 4,000 字)。「/goal」看目前的目標,「/goal clear」(或 stop、取消)清除。
|
||||
- 評審:每輪結束後,另一家供應商的模型(不是本機 Ollama,也不是 Bot 自己那家;都沒有才用自己的)讀這段對話判斷:達成、還沒(理由會帶進下一輪)、做不到、在等使用者回覆。
|
||||
- 評審:每輪結束後,另一家供應商的模型(不是本機 Ollama,也不是 Bot 自己那家;都沒有才用自己的)讀這段對話判斷:達成、還沒(理由會帶進下一輪)、做不到、在等使用者回覆。證據不夠時它可以自己查證,最多 3 次,只能看不能改:在 Bot 做事的那台電腦上 `read_file`、`list_dir`,或 `web_fetch` 讀公開網頁;要它做別的會被拒絕。每一輪用同一個標準,不因為 Bot 做得比上一輪多就提高要求。
|
||||
- 只看證據:評審看到的 Bot 自己的話,標成「bot 的說法(不是證據)」;另外附系統從工具紀錄算出的統計(共幾步、幾步失敗、成功送出幾次、送到哪裡),兩者對不上以系統為準。
|
||||
- 下一輪:沒達成時,系統自己送出一則「[目標]還沒達成:理由」開始下一輪。
|
||||
- 煞車:做滿 20 輪先停下來問;連續 3 輪沒有用任何工具(只是在跟評審說話)就停;Bot 在等使用者回答時停;評審沒有回應時停。使用者傳任何一句話就接著做(滿 20 輪的話再給 20 輪)。
|
||||
- 煞車:做滿 20 輪先停下來問;連續 3 輪沒有用任何工具(只是在跟評審說話)就停;連續兩輪評審說差的是同一件事(字稍微不同也算)就停,看起來卡住了;Bot 在等使用者回答時停;評審沒有回應時停。使用者傳任何一句話就接著做(滿 20 輪的話再給 20 輪)。
|
||||
- 達成或做不到:聊天裡留一行結果(花了幾輪),目標清掉。達成、做不到或停下來時,使用者不在電腦前(而且通知開著)會跳通知,手機也收得到。
|
||||
|
||||
## 使用者怎麼到
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
## 怎麼操作
|
||||
|
||||
- Bot:沒有專用工具,照常做事就好。不要用說的宣稱完成,評審只認工具留下的結果;送出類的工作,系統會自己數送出幾次、記下送到哪裡。需要使用者回答就直接問,目標會停下來等。
|
||||
- 驗證:設一個做得到的目標(例如「在工作資料夾建立 hello.txt,內容是 hi」),要看到它自己做完、評審判達成、目標列消失;設一個做不到的,要看到「目標做不到,已清除」;Bot 說做完但工具紀錄沒有,評審不能判達成。自動測試:`cargo test goal::`、`cargo test evidence::`。
|
||||
- 驗證:設一個做得到的目標(例如「在工作資料夾建立 hello.txt,內容是 hi」),要看到它自己做完、評審判達成、目標列消失;設一個做不到的,要看到「目標做不到,已清除」;Bot 說做完但工具紀錄沒有,評審不能判達成;評審查證時不會改到任何檔案。自動測試:`cargo test goal::`、`cargo test evidence::`、`cargo test the_judge_looks_for_itself`。
|
||||
|
||||
## 陷阱
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
- 做法:摘要用分段的提示(目標、做了什麼、檔案、未完成、使用者原話全留);摘要太短就重做一次;摘要後提醒還在跑的背景指令和計畫進度。`/compact` 現在就整理,`/context` 看用了多少。
|
||||
- 做完:測試涵蓋太短重做、背景指令提醒。
|
||||
|
||||
### R5. 目標評審能自己看 ⬜
|
||||
### R5. 目標評審能自己看 ✅(截圖先不給:評審用的常常是別家的模型,看圖的能力不一定有;讀檔和網頁已經夠查證)
|
||||
- 做法:評審可以用只看的工具(讀檔、web_fetch、截圖)查證;同一個「還沒達成」理由連兩次就暫停問;提示加「不要每輪提高標準」。
|
||||
- 做完:評審用工具讀檔確認的測試;同理由兩次暫停的測試。
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,33 @@
|
|||
use super::*;
|
||||
use crate::goal::{self, Command, Goal, Judged, Next};
|
||||
|
||||
/// The judge's answer, after up to JUDGE_LOOKS rounds of looking for itself with the read-only
|
||||
/// tools (anything else it asks for is refused, not run).
|
||||
pub(super) fn judge_with_looks(req: &ChatRequest, target: Option<&crate::tools::Target>, bot_id: u64, cancel: &AtomicBool) -> Result<String, String> {
|
||||
let mut req = req.clone();
|
||||
for round in 0..=goal::JUDGE_LOOKS {
|
||||
if round == goal::JUDGE_LOOKS {
|
||||
// Out of looks: it says now, without tools.
|
||||
req.tools.clear();
|
||||
req.history.push(Message::user("查證的次數用完了。現在只回 JSON。"));
|
||||
}
|
||||
let out = providers::run_step(&req, cancel, &|_| {})?;
|
||||
if out.tool_calls.is_empty() {
|
||||
return Ok(out.text);
|
||||
}
|
||||
req.history.push(Message { tool_calls: out.tool_calls.clone(), blocks: out.blocks.clone(), ..Message::assistant(&out.text, &req.model) });
|
||||
for c in &out.tool_calls {
|
||||
let (text, _) = match (c.name.as_str(), target) {
|
||||
("web_fetch", _) => crate::web::run("web_fetch", &c.args, cancel),
|
||||
(n, Some(t)) if goal::JUDGE_TOOLS.contains(&n) => crate::tools::run_on(n, &c.args, t, cancel, &crate::tools::RunIds { conversation: bot_id.to_string(), request: format!("judge-{}", c.id) }),
|
||||
_ => (format!("檢查目標時不能用「{}」:只能用 {}。", c.name, goal::JUDGE_TOOLS.join("、")), false),
|
||||
};
|
||||
req.history.push(Message::tool_result(&c.id, &c.name, &crate::tools::head_tail(&text)));
|
||||
}
|
||||
}
|
||||
Err("檢查目標時一直在查證,沒有給答案".into())
|
||||
}
|
||||
|
||||
impl App {
|
||||
/// 「/goal …」: show, clear, or set the goal and start on it.
|
||||
pub(super) fn goal_command(&mut self, ctx: &egui::Context, bot_id: u64, cmd: Command, text: &str, attachments: Vec<crate::attach::Attachment>, picks: Option<Vec<String>>) {
|
||||
|
|
@ -185,6 +212,17 @@ impl App {
|
|||
session: format!("anybot-goal-{bot_id}"),
|
||||
effort: String::new(),
|
||||
};
|
||||
// It may look for itself (R5): read files and folders where the bot works, read public
|
||||
// pages — nothing that changes anything.
|
||||
let targets = self.targets_for(b);
|
||||
let roles = self.roles_for(b, &targets);
|
||||
let (chosen, _) = Self::chosen_computer(b, &targets, &roles);
|
||||
let target = targets.iter().find(|t| t.name == chosen).cloned();
|
||||
let tools: Vec<serde_json::Value> = match &target {
|
||||
Some(t) => crate::tools::specs_for(std::slice::from_ref(&t.name), &t.name).into_iter().chain(crate::web::specs_for(&[], "")).filter(|s| goal::JUDGE_TOOLS.contains(&s["name"].as_str().unwrap_or(""))).collect(),
|
||||
None => vec![],
|
||||
};
|
||||
let own = ChatRequest { tools, ..own };
|
||||
// A model of another family when the person has one: a bot's own model grades its own
|
||||
// work too kindly (pstack's judges are from a different family). Its own, if that fails.
|
||||
let mut tries: Vec<ChatRequest> = self.judge_elsewhere(b.provider).map(|(kind, base_url, api_key, model)| ChatRequest { kind, base_url, api_key, model, ..own.clone() }).into_iter().collect();
|
||||
|
|
@ -195,9 +233,9 @@ impl App {
|
|||
let cancel = AtomicBool::new(false);
|
||||
let mut judged = Judged::Failed("沒有可以檢查的模型".into());
|
||||
for req in &tries {
|
||||
match providers::run_step(req, &cancel, &|_| {}) {
|
||||
Ok(o) => {
|
||||
judged = goal::read_verdict(&o.text);
|
||||
match judge_with_looks(req, target.as_ref(), bot_id, &cancel) {
|
||||
Ok(text) => {
|
||||
judged = goal::read_verdict(&text);
|
||||
break;
|
||||
}
|
||||
Err(e) => {
|
||||
|
|
@ -333,6 +371,31 @@ pub(super) fn note_index(msgs: &[Message], streaming: bool) -> usize {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// R5: the judge looks for itself (a file where the bot works) before it answers; a step
|
||||
/// that would change something is refused, not run.
|
||||
#[test]
|
||||
fn the_judge_looks_for_itself_read_only() {
|
||||
use crate::testkit::{Fake, Reply};
|
||||
let w = std::env::temp_dir().join(format!("anybot-judge-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&w);
|
||||
std::fs::create_dir_all(&w).unwrap();
|
||||
std::fs::write(w.join("report.txt"), "全部 340 個測試通過").unwrap();
|
||||
let fake = Fake::openai(vec![
|
||||
Reply::call("j1", "read_file", serde_json::json!({"path": "report.txt"})),
|
||||
Reply::call("j2", "shell", serde_json::json!({"command": "touch made.txt"})),
|
||||
Reply::text(r#"{"verdict":"met","reason":"report.txt 寫全部通過"}"#),
|
||||
]);
|
||||
let t = crate::tools::Target { name: "這台".into(), place: crate::tools::Place::Local { workdir: w.clone() } };
|
||||
let req = ChatRequest { kind: crate::providers::ProviderKind::Custom, base_url: fake.base(), api_key: String::new(), model: "m".into(), system: goal::JUDGE_SYSTEM.into(), history: vec![Message::user("目標:所有測試都通過")], tools: vec![], session: String::new(), effort: String::new() };
|
||||
let text = judge_with_looks(&req, Some(&t), 1, &AtomicBool::new(false)).unwrap();
|
||||
assert!(text.contains("\"met\""), "{text}");
|
||||
let bodies = fake.bodies.lock().unwrap().clone();
|
||||
assert!(bodies[1].to_string().contains("全部 340 個測試通過"), "the file it read went back to it");
|
||||
assert!(bodies[2].to_string().contains("檢查目標時不能用「shell」"), "refused");
|
||||
assert!(!w.join("made.txt").exists(), "nothing was changed");
|
||||
let _ = std::fs::remove_dir_all(&w);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_note_never_splits_a_step_from_its_result() {
|
||||
let user = Message::user("做事");
|
||||
|
|
|
|||
55
src/goal.rs
55
src/goal.rs
|
|
@ -136,8 +136,32 @@ pub const JUDGE_SYSTEM: &str = "你是驗收員。使用者給一個 bot 設了
|
|||
- 確定永遠做不到才判 impossible(要的東西不存在、被明確拒絕而且沒有別的路);只是還沒做完、遇到能修的錯誤,都是 not_met。
|
||||
- reason 一句話,用使用者的語言:met 寫是哪個證據;not_met 寫還差什麼、下一步做什麼;waiting 寫在等使用者什麼;impossible 寫為什麼。
|
||||
|
||||
- 每一輪用同一個標準:只看目標本身寫的條件。不要因為 bot 做得比上一輪多就提高要求,也不要加入目標沒寫的條件。
|
||||
- 對話裡的證據不夠時,可以用工具自己查證(read_file、list_dir 看 bot 做事的那台電腦,web_fetch 讀公開網頁),最多 3 次;工具只能看、不能改。查完一定要回 JSON。
|
||||
|
||||
只回一個 JSON,不要別的字:{\"verdict\":\"met|not_met|waiting|impossible\",\"reason\":\"…\"}";
|
||||
|
||||
/// What the judge may use to look for itself (read only), at most JUDGE_LOOKS rounds.
|
||||
pub const JUDGE_TOOLS: [&str; 3] = ["read_file", "list_dir", "web_fetch"];
|
||||
pub const JUDGE_LOOKS: usize = 3;
|
||||
|
||||
/// Two of the judge's reasons say the same thing (its words differ a little each time): their
|
||||
/// character pairs overlap this much.
|
||||
const SAME_REASON: f64 = 0.7;
|
||||
|
||||
/// Whether two reasons say the same (most of their character pairs in common).
|
||||
pub fn same_reason(a: &str, b: &str) -> bool {
|
||||
let pairs = |s: &str| {
|
||||
let c: Vec<char> = s.chars().filter(|c| !c.is_whitespace() && !c.is_ascii_punctuation() && !",。、;:「」()!?".contains(*c)).collect();
|
||||
c.windows(2).map(|w| (w[0], w[1])).collect::<std::collections::HashSet<_>>()
|
||||
};
|
||||
let (x, y) = (pairs(a), pairs(b));
|
||||
if x.is_empty() || y.is_empty() {
|
||||
return false;
|
||||
}
|
||||
x.intersection(&y).count() as f64 / x.union(&y).count() as f64 >= SAME_REASON
|
||||
}
|
||||
|
||||
/// The judge's answer, read loosely (a model may wrap the JSON in words or a code fence). An
|
||||
/// answer that can't be read counts as not yet met: the turn cap still stops it.
|
||||
pub fn read_verdict(text: &str) -> Judged {
|
||||
|
|
@ -223,7 +247,14 @@ pub fn after_verdict(g: &mut Goal, judged: Judged, now: i64) -> Next {
|
|||
}
|
||||
};
|
||||
g.turns += 1;
|
||||
// The same gap twice in a row: another turn would most likely find it again (grok-build pauses
|
||||
// a goal when its gaps repeat).
|
||||
let again = verdict == Verdict::NotYet && !g.reason.is_empty() && same_reason(&g.reason, &reason);
|
||||
g.reason = reason.clone();
|
||||
if again {
|
||||
g.paused = "同樣的問題連續兩次".into();
|
||||
return Next::Pause { note: format!("目標暫停:連續兩輪檢查都說差同一件事,看起來卡住了:{reason}\n傳一句話(提示一下做法,或說「繼續」)就接著做;不要了就用 /goal clear。"), title: "的目標暫停了" };
|
||||
}
|
||||
let took = format!("{} 輪 · {}", g.turns, elapsed(now - g.since));
|
||||
match verdict {
|
||||
Verdict::Met => Next::Over { note: format!("目標達成:{}\n{reason}({took})", g.condition), title: "達成目標了" },
|
||||
|
|
@ -339,6 +370,22 @@ fn head_tail(s: &str, head: usize, tail: usize) -> String {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// R5: the same gap said twice in a row (in words that differ a little) pauses the goal.
|
||||
#[test]
|
||||
fn the_same_reason_twice_pauses() {
|
||||
assert!(same_reason("還差 2 個測試失敗:goal::tests 的時間格式", "還差2個測試失敗(goal::tests 的時間格式)"));
|
||||
assert!(!same_reason("還差 2 個測試失敗", "clippy 還有新的警告"));
|
||||
assert!(!same_reason("", "x"));
|
||||
let mut g = Goal::new("所有測試都通過", 0);
|
||||
assert!(matches!(after_verdict(&mut g, Judged::Said(Verdict::NotYet, "還差 2 個測試失敗:時間格式".into()), 1), Next::Again { .. }));
|
||||
assert!(matches!(after_verdict(&mut g, Judged::Said(Verdict::NotYet, "clippy 還有新的警告".into()), 2), Next::Again { .. }), "a different gap: on");
|
||||
match after_verdict(&mut g, Judged::Said(Verdict::NotYet, "clippy 還有新的警告。".into()), 3) {
|
||||
Next::Pause { note, .. } => assert!(note.contains("連續兩輪") && !g.active(), "{note}"),
|
||||
other => panic!("{other:?}"),
|
||||
}
|
||||
assert!(JUDGE_SYSTEM.contains("不要因為 bot 做得比上一輪多就提高要求"));
|
||||
}
|
||||
|
||||
/// The judge reads the bot's words as words, and the system's own count of what was sent.
|
||||
#[test]
|
||||
fn the_judge_gets_the_systems_count_not_only_the_bots_word() {
|
||||
|
|
@ -390,7 +437,13 @@ mod tests {
|
|||
#[test]
|
||||
fn not_yet_goes_again_until_the_brakes() {
|
||||
let mut g = Goal::new("測試通過", 0);
|
||||
let not_yet = || Judged::Said(Verdict::NotYet, "還有 1 個失敗".into());
|
||||
// Each check names a different gap (the same one twice pauses: the_same_reason_twice_pauses).
|
||||
let gaps = ["還有 1 個失敗", "clippy 有新的警告", "README 少了安裝說明", "版本號沒有更新", "CHANGELOG 沒寫", "格式檢查沒過", "建置腳本找不到", "文件連結壞了"];
|
||||
let n = std::cell::Cell::new(0);
|
||||
let not_yet = || {
|
||||
n.set(n.get() + 1);
|
||||
Judged::Said(Verdict::NotYet, gaps[(n.get() - 1) % gaps.len()].into())
|
||||
};
|
||||
g.after_turn(true);
|
||||
assert_eq!(after_verdict(&mut g, not_yet(), 60_000), Next::Again { text: "[目標]還沒達成:還有 1 個失敗".into() });
|
||||
assert_eq!((g.turns, g.reason.as_str(), g.active()), (1, "還有 1 個失敗", true));
|
||||
|
|
|
|||
Loading…
Reference in New Issue