Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cc-jobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

設定は起動判定ごとに読み直します。番号を追加・削除するには `lowest_priority_todo_ids` を編集します。一時的に通常の順位へ戻す場合は `normal_priority_todo_ids` に番号を追加してください。こちらが番号指定より優先します。実行中のジョブから別のToDoの作業を登録した場合は子として扱わず、通常の順番待ちに入れます。実行中の親は従来の完了境界で枠を譲ります。親を終わらせるための子は、親の実行枠を使う従来の起動条件を保ちます。

Rust製の `codex_jobs.exe` が、複数の呼び出し元から届くジョブを共通の順番待ちに入れます。同時に動く親は初期設定で6件です。実行中の親から起動した子は親の枠を使い、各親につき同時2件まで起動します。起動できる子を親より優先し、その中でオーナーの直接依頼(`req-`)、PRを仕上げる担当(`shep-`)、その他の順に起動します。同じ順位では待機開始が古いものを先にします。子の枠が埋まった親があっても、別の親の子は起動できます。
Rust製の `codex_jobs.exe` が、複数の呼び出し元から届くジョブを共通の順番待ちに入れます。同時に動く親は初期設定で6件です。実行中の親から起動した子は親の枠を使い、各親につき同時2件まで起動します。起動できる子を親より優先し、その中でオーナーの直接依頼(`req-`)とオーナーの返事を反映する再開(`resume-`)、PRを仕上げる担当(`shep-`)、その他の順に起動します。同じ順位では待機開始が古いものを先にします。子の枠が埋まった親があっても、別の親の子は起動できます。

同じ順位以上の親が順番待ちしている場合、連続2時間以上動いた親はコマンドやツールの `item.completed` の後、次の `item.started` の前にCodexを停止し、同じ順位の最後へ戻ります。ジョブID・ToDo・作業フォルダ・セッションと元の依頼文を保ち、次の起動には `exec resume` を使います。待機者がいない場合、子・孫が実行中または順番待ちの場合は譲りません。失敗・取り消し・セッション未記録・完了や判断待ちの作業は再開しません。

Expand Down
4 changes: 3 additions & 1 deletion cc-jobs/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,11 @@ fn queue_time(j: &Value) -> &str {
s(j, "queued_at")
}
}
/// Owner requests and owner replies (`resume-`: Discord answers, new owner
/// instructions and restarts reflected into an existing session) come first.
fn queue_priority(job: &Value) -> u8 {
let name = s(job, "name");
if name.starts_with("req-") {
if name.starts_with("req-") || name.starts_with("resume-") {
0
} else if name.starts_with("shep-") {
1
Expand Down
6 changes: 5 additions & 1 deletion cc-jobs/tests/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,12 +1213,16 @@ mod queue_regressions {
("req-new", "req-new", "11:30:00"),
("shep-old", "shep-old", "09:00:00"),
("req-old", "req-old", "10:00:00"),
// An owner's Discord reply resumes work; it ranks with req-.
("resume", "resume-200", "10:30:00"),
] {
let mut j = waiting(&t, id, name);
j["queued_at"] = json!(format!("2026-10-01T{time}+09:00"));
t.ctx.save(&j).unwrap();
}
for id in ["req-old", "req-new", "shep-old", "shep-new", "other"] {
for id in [
"req-old", "resume", "req-new", "shep-old", "shep-new", "other",
] {
assert!(t.ctx.admit(id).unwrap().is_some(), "{id}");
let mut j = t.ctx.load(id).unwrap();
j["status"] = json!("succeeded");
Expand Down
Loading