@giamme/forge 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/SKILL.md +47 -14
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -1
- package/docs/commands.md +302 -9
- package/docs/forge-ui.md +14 -0
- package/docs/memory.md +22 -0
- package/docs/models.md +53 -0
- package/docs/reviews.md +7 -0
- package/forge +11 -0
- package/package.json +1 -1
- package/references/dataset.md +16 -4
- package/references/decompose.md +154 -9
- package/references/harnesses.md +21 -1
- package/references/planning.md +59 -0
- package/references/solo.md +5 -1
- package/references/ui.md +48 -1
- package/scripts/forge-artifact.sh +53 -0
- package/scripts/forge-compare.py +6 -3
- package/scripts/forge-config.py +531 -4
- package/scripts/forge-contract.py +55 -8
- package/scripts/forge-control.py +0 -2
- package/scripts/forge-dispatch.sh +84 -14
- package/scripts/forge-fail-first.py +3 -1
- package/scripts/forge-guard.py +247 -8
- package/scripts/forge-issues.py +12 -0
- package/scripts/forge-lib-adopt.sh +260 -0
- package/scripts/forge-lib-attribute.sh +10 -2
- package/scripts/forge-lib-plans.sh +35 -6
- package/scripts/forge-lib-review.sh +13 -5
- package/scripts/forge-lib-task.sh +138 -5
- package/scripts/forge-memory.sh +41 -4
- package/scripts/forge-metrics.sh +7 -0
- package/scripts/forge-parallel-options.sh +12 -6
- package/scripts/forge-parallel.sh +659 -32
- package/scripts/forge-plan-check.py +591 -8
- package/scripts/forge-planner.py +480 -0
- package/scripts/forge-route.py +16 -2
- package/scripts/forge-runs-rm.py +23 -7
- package/scripts/forge-runtime.py +111 -2
- package/scripts/forge-schedule.py +5 -2
- package/scripts/forge-shadow.py +53 -7
- package/scripts/forge-solo.sh +87 -7
- package/scripts/forge_dataset/cli.py +26 -0
- package/scripts/forge_dataset/efforts.py +215 -0
- package/scripts/forge_dataset/export.py +1 -0
- package/scripts/forge_dataset/harvest.py +55 -0
- package/scripts/forge_dataset/history.py +126 -0
- package/scripts/forge_dataset/worktrees.py +95 -0
- package/scripts/forge_decide/__init__.py +19 -1
- package/scripts/forge_decide/builtin_profiles.json +25 -0
- package/scripts/forge_decide/cli.py +12 -0
- package/scripts/forge_decide/profiles.py +866 -0
- package/scripts/forge_decide/resolve.py +38 -6
- package/scripts/forge_memory_list.py +153 -0
- package/scripts/forge_worktrees.py +88 -0
- package/ui/README.md +31 -0
- package/ui/docs/api.md +168 -12
- package/ui/forge_ui/__init__.py +14 -1
- package/ui/forge_ui/__main__.py +1 -1
- package/ui/forge_ui/control.py +250 -12
- package/ui/forge_ui/executions.py +28 -8
- package/ui/forge_ui/findings.py +7 -0
- package/ui/forge_ui/models.py +60 -1
- package/ui/forge_ui/projects.py +571 -0
- package/ui/forge_ui/reader.py +48 -8
- package/ui/forge_ui/static/app.js +99 -21
- package/ui/forge_ui/static/cloudui.js +6 -2
- package/ui/forge_ui/static/convo.js +1 -1
- package/ui/forge_ui/static/diffview.js +2 -2
- package/ui/forge_ui/static/files.js +1 -1
- package/ui/forge_ui/static/index.html +5 -1
- package/ui/forge_ui/static/leaderboard.js +5 -1
- package/ui/forge_ui/static/modelstats.js +25 -1
- package/ui/forge_ui/static/panel.js +47 -4
- package/ui/forge_ui/static/projectsview.js +372 -0
- package/ui/forge_ui/static/settings.js +924 -29
- package/ui/forge_ui/static/style.css +116 -3
- package/ui/forge_ui/static/uikit.js +94 -1
- package/ui/forge_ui/static/worktreesview.js +250 -0
- package/ui/forge_ui/worktrees.py +570 -0
|
@@ -130,7 +130,7 @@ plans_make_integration() { # plans_make_integration <repo> <branch> <commit> <wt
|
|
|
130
130
|
|
|
131
131
|
# Per-plan option files carried to a derived plan. The cost-bearing choices a user made
|
|
132
132
|
# for this plan apply to the plan made from it; `planner` does not (nothing plans again).
|
|
133
|
-
PLANS_OPTION_FILES="no_ripwire no_memory yolo_dwarf yolo_qa reviewer_session implementer_session pre_review_tests pre_review_parallel qa_threshold timeout verify_retries verify_cmd verify_parallel setup_cmd final_qa shadow_qa shadow_rate explore escalate_after fractal-routing.json fractal-selection.json jev-selection.json"
|
|
133
|
+
PLANS_OPTION_FILES="no_ripwire no_memory yolo_dwarf yolo_qa reviewer_session implementer_session fast pre_review_tests pre_review_parallel qa_threshold timeout verify_retries verify_cmd verify_parallel setup_cmd final_qa shadow_qa shadow_rate explore escalate_after fractal-routing.json fractal-selection.json jev-selection.json profile.json routed.json"
|
|
134
134
|
|
|
135
135
|
# --- accept ---------------------------------------------------------------------
|
|
136
136
|
# A reviewer's FAIL is the QA gate; overriding it is the user's call and never forge's or
|
|
@@ -222,7 +222,7 @@ do_accept() {
|
|
|
222
222
|
done
|
|
223
223
|
[ -e "$int_wt/.git" ] || die "the integration worktree $int_wt is missing" 3
|
|
224
224
|
[ -s "$PLAN/accepted.integration" ] && [ "$(git -C "$int_wt" rev-parse HEAD 2>/dev/null)" = "$(cat "$PLAN/accepted.integration")" ] \
|
|
225
|
-
|| die "integration branch changed outside this run; refusing to merge onto it" 3
|
|
225
|
+
|| die "integration branch changed outside this run; refusing to merge onto it. To bring those commits into the run: forge-parallel.sh adopt $PLAN --head --reason \"...\"" 3
|
|
226
226
|
[ -z "$(git -C "$int_wt" status --porcelain -- . ':(exclude).forge' 2>/dev/null)" ] \
|
|
227
227
|
|| die "the integration worktree $int_wt has uncommitted changes; refusing to merge onto it" 3
|
|
228
228
|
|
|
@@ -234,8 +234,10 @@ do_accept() {
|
|
|
234
234
|
sha="$(cat "$tdir/reviewed.commit")"
|
|
235
235
|
body="$(plans_reviewer_text "$tdir" "$st")"
|
|
236
236
|
n="$(printf '%s\n' "$body" | grep -c '^- ')"
|
|
237
|
-
local gthr gdec
|
|
238
|
-
|
|
237
|
+
local gthr='' gdec=''
|
|
238
|
+
if [ -f "$tdir/qa.gate" ]; then
|
|
239
|
+
IFS="$(printf '\t')" read -r gthr gdec _ < "$tdir/qa.gate" || true
|
|
240
|
+
fi
|
|
239
241
|
rm -f "$kibak"; [ -f "$ki" ] && cp -p "$ki" "$kibak"
|
|
240
242
|
{
|
|
241
243
|
if [ -s "$ki" ]; then cat "$ki"; echo; fi
|
|
@@ -516,6 +518,7 @@ Retry or accept them (or split them off into their own plan) first." 3
|
|
|
516
518
|
printf '%s\n' "$NEWWTR" > "$NEW/wt_root" || ok=0
|
|
517
519
|
git -C "$NEWINT" rev-parse HEAD > "$NEW/accepted.integration" || ok=0
|
|
518
520
|
[ -z "$newbase" ] || printf '%s\n' "$newbase" > "$NEW/integration.base"
|
|
521
|
+
for p in "${SRC[@]}"; do [ ! -s "$p/adoptions.tsv" ] || cat "$p/adoptions.tsv" >> "$NEW/adoptions.tsv" || ok=0; done
|
|
519
522
|
for p in "${SRC[@]}"; do
|
|
520
523
|
for id in $(all_ids "$p/tasks.tsv"); do
|
|
521
524
|
plans_copy_taskdir "$p/tasks/$id" "$NEW/tasks/$id" || ok=0
|
|
@@ -547,7 +550,7 @@ Retry or accept them (or split them off into their own plan) first." 3
|
|
|
547
550
|
done
|
|
548
551
|
all=1; for p in "${SRC[@]}"; do [ -f "$p/pre_review_tests" ] || all=0; done
|
|
549
552
|
[ "$all" = 1 ] && : > "$NEW/pre_review_tests"
|
|
550
|
-
for f in qa_threshold timeout verify_retries verify_parallel pre_review_parallel; do
|
|
553
|
+
for f in qa_threshold timeout verify_retries verify_parallel pre_review_parallel fast; do
|
|
551
554
|
same=1
|
|
552
555
|
for p in "${SRC[@]}"; do
|
|
553
556
|
if [ ! -f "$p/$f" ] || ! cmp -s "$p/$f" "${SRC[0]}/$f"; then same=0; fi
|
|
@@ -559,6 +562,23 @@ Retry or accept them (or split them off into their own plan) first." 3
|
|
|
559
562
|
done
|
|
560
563
|
fi
|
|
561
564
|
done
|
|
565
|
+
# A frozen profile (#48) carries over when every source froze the same one: its name, level and
|
|
566
|
+
# body (the time it was frozen and the flags that replaced a value do not tell profiles apart).
|
|
567
|
+
same=1
|
|
568
|
+
for p in "${SRC[@]}"; do
|
|
569
|
+
[ -f "$p/profile.json" ] && python3 -c '
|
|
570
|
+
import json, sys
|
|
571
|
+
def key(path):
|
|
572
|
+
data = json.load(open(path))
|
|
573
|
+
return [data.get(k) for k in ("name", "level", "body")]
|
|
574
|
+
sys.exit(0 if key(sys.argv[1]) == key(sys.argv[2]) else 1)' "$p/profile.json" "${SRC[0]}/profile.json" 2>/dev/null || same=0
|
|
575
|
+
done
|
|
576
|
+
if [ "$same" = 1 ]; then cp -p "${SRC[0]}/profile.json" "$NEW/profile.json"
|
|
577
|
+
else
|
|
578
|
+
for p in "${SRC[@]}"; do
|
|
579
|
+
if [ -f "$p/profile.json" ]; then note "the plans do not agree on profile.json; the combined plan leaves it unset"; break; fi
|
|
580
|
+
done
|
|
581
|
+
fi
|
|
562
582
|
# The integration worktree needs a setup step to build and test the combined result, and
|
|
563
583
|
# no task is ever dispatched here, so the first source's is as good as any.
|
|
564
584
|
for p in "${SRC[@]}"; do [ -s "$p/setup_cmd" ] && { cp -p "$p/setup_cmd" "$NEW/setup_cmd"; break; }; done
|
|
@@ -588,6 +608,7 @@ Retry or accept them (or split them off into their own plan) first." 3
|
|
|
588
608
|
# worktree gets: whatever setup the repository asks for. Never fatal.
|
|
589
609
|
mkdir -p "$NEW/tasks/_integration"
|
|
590
610
|
run_worktree_setup "$NEW" "$repo_text" "$NEWINT" "$NEW/tasks/_integration" _integration
|
|
611
|
+
forge_worktree_event created "$NEW" "$repo_text" "$NEWINT" "$NEWBR" integration
|
|
591
612
|
|
|
592
613
|
echo "combined $n plans into $NEW (run forge/$NEWRID): $ntasks tasks, all MERGED"
|
|
593
614
|
echo "integration branch: $NEWBR at $(plans_short "$(cat "$NEW/accepted.integration")")"
|
|
@@ -721,7 +742,7 @@ except Exception:
|
|
|
721
742
|
plans_make_integration "$REPO" "$NEWBR" "$acc" "$NEWINT" \
|
|
722
743
|
|| { plans_undo; trap - INT TERM; die "could not create $NEWBR and its worktree" 3; }
|
|
723
744
|
|
|
724
|
-
local oldbr newbr oldwt newwt head_ref old_branches=""
|
|
745
|
+
local oldbr newbr oldwt newwt head_ref old_branches="" moved_wts=""
|
|
725
746
|
for id in $(all_ids "$T"); do
|
|
726
747
|
case "$SEL" in *" $id "*) ;; *) continue ;; esac
|
|
727
748
|
oldbr="forge/$run_id/$id"; newbr="forge/$NEWRID/$id"
|
|
@@ -736,6 +757,7 @@ except Exception:
|
|
|
736
757
|
git -C "$REPO" worktree move "$oldwt" "$newwt" >/dev/null 2>&1 \
|
|
737
758
|
|| { plans_undo; trap - INT TERM; die "could not move worktree $oldwt to $newwt" 3; }
|
|
738
759
|
plans_journal move "$oldwt" "$newwt"
|
|
760
|
+
moved_wts="$moved_wts $id"
|
|
739
761
|
# Same commit, same index, same working tree: only the name HEAD points at changes.
|
|
740
762
|
if [ "$head_ref" = "refs/heads/$oldbr" ]; then
|
|
741
763
|
git -C "$newwt" symbolic-ref HEAD "refs/heads/$newbr" >/dev/null 2>&1 \
|
|
@@ -767,6 +789,7 @@ except Exception:
|
|
|
767
789
|
printf '%s\n' "$NEWRID" > "$NEW/run_id" || ok=0
|
|
768
790
|
printf '%s\n' "$NEWWTR" > "$NEW/wt_root" || ok=0
|
|
769
791
|
printf '%s\n' "$acc" > "$NEW/accepted.integration" || ok=0
|
|
792
|
+
[ ! -s "$PLAN/adoptions.tsv" ] || cp -p "$PLAN/adoptions.tsv" "$NEW/adoptions.tsv" || ok=0
|
|
770
793
|
[ ! -s "$PLAN/integration.base" ] || cp -p "$PLAN/integration.base" "$NEW/integration.base" || ok=0
|
|
771
794
|
[ ! -s "$PLAN/goal.txt" ] || cp -p "$PLAN/goal.txt" "$NEW/goal.txt" || ok=0
|
|
772
795
|
for f in $PLANS_OPTION_FILES; do
|
|
@@ -807,6 +830,12 @@ except Exception:
|
|
|
807
830
|
done
|
|
808
831
|
mkdir -p "$NEW/tasks/_integration"
|
|
809
832
|
run_worktree_setup "$NEW" "$repo_text" "$NEWINT" "$NEW/tasks/_integration" _integration
|
|
833
|
+
forge_worktree_event created "$NEW" "$repo_text" "$NEWINT" "$NEWBR" integration
|
|
834
|
+
# A moved worktree is one forge removed from the old run and one it created in the new run.
|
|
835
|
+
for id in $moved_wts; do
|
|
836
|
+
forge_worktree_event removed "$PLAN" "$repo_text" "$old_wtr/$id" "forge/$run_id/$id" task "$id"
|
|
837
|
+
forge_worktree_event created "$NEW" "$repo_text" "$NEWWTR/$id" "forge/$NEWRID/$id" task "$id"
|
|
838
|
+
done
|
|
810
839
|
|
|
811
840
|
echo "split: moved $PICKED from $PLAN to $NEW (run forge/$NEWRID)"
|
|
812
841
|
echo "integration branch: $NEWBR at $(plans_short "$acc")"
|
|
@@ -359,7 +359,7 @@ PY
|
|
|
359
359
|
# it is called from inside do_integrate.
|
|
360
360
|
final_review() {
|
|
361
361
|
local plan="$1" base="$2" tip="$3" src="$4" out="$5" spec="$6" yolo="${7:-}"
|
|
362
|
-
local review n rc verdict thr gate_line gate_forced source_fp review_fp vdir tflag="" inline=1 diff_n
|
|
362
|
+
local review n rc verdict thr gate_line gate_forced source_fp review_fp vdir tflag="" inline=1 diff_n ft
|
|
363
363
|
local plan_real prev="" prev_rel=none prev_tip="" since=none integration="" prev_note=""
|
|
364
364
|
[ -n "$yolo" ] && yolo=--yolo
|
|
365
365
|
[ -n "$spec" ] || { note "final review: no QA spec given"; return 3; }
|
|
@@ -378,8 +378,10 @@ final_review() {
|
|
|
378
378
|
fi
|
|
379
379
|
|
|
380
380
|
# Offline, and before anything is built or paid for: a spec that cannot resolve fails here.
|
|
381
|
+
# The fast-file role is review; dispatch's own role stays qa (a review is a read-only pass).
|
|
382
|
+
ft="$(forge_fast_tier "$plan" review)"
|
|
381
383
|
FORGE_CAPABILITY_CACHE="${FORGE_CAPABILITY_CACHE:-$plan/capabilities}" \
|
|
382
|
-
/bin/bash "$DISPATCH" doctor --spec "$spec" --role qa $yolo > "$out/doctor.out" 2>&1
|
|
384
|
+
/bin/bash "$DISPATCH" doctor --spec "$spec" --role qa $yolo $ft > "$out/doctor.out" 2>&1
|
|
383
385
|
rc=$?
|
|
384
386
|
if [ "$rc" -ne 0 ]; then
|
|
385
387
|
cat "$out/doctor.out" >&2
|
|
@@ -393,6 +395,7 @@ final_review() {
|
|
|
393
395
|
while [ -e "$review" ]; do n=$((n+1)); review="$out/review-$$-$n"; done
|
|
394
396
|
forge_review_snapshot "$src" "$base" "$tip" "$review" > "$out/snapshot.log" 2>&1 ||
|
|
395
397
|
{ note "final review: cannot build the review snapshot (see $out/snapshot.log)"; return 3; }
|
|
398
|
+
forge_review_deps "$src" "$review" "$out/review.deps"
|
|
396
399
|
source_fp="$(forge_fingerprint "$src")" && review_fp="$(forge_fingerprint "$review" --tracked)" ||
|
|
397
400
|
{ note "final review: cannot fingerprint the checkouts"; return 3; }
|
|
398
401
|
printf '%s\n' "$source_fp" > "$out/source.fingerprint"
|
|
@@ -464,6 +467,8 @@ final_review() {
|
|
|
464
467
|
cat "$out/context.md"
|
|
465
468
|
python3 "$SKILL_DIR/scripts/forge-contract.py" qa --part head --kind final
|
|
466
469
|
echo
|
|
470
|
+
cat "$out/review.deps"; echo
|
|
471
|
+
adopt_rows "$plan"
|
|
467
472
|
cat "$out/notes.md"
|
|
468
473
|
[ -s "$out/previous.md" ] && cat "$out/previous.md"
|
|
469
474
|
python3 "$SKILL_DIR/scripts/forge-contract.py" qa --part tail --kind final --threshold "$thr"
|
|
@@ -497,7 +502,7 @@ final_review() {
|
|
|
497
502
|
fi
|
|
498
503
|
local qa_cmd=(/bin/bash "$DISPATCH" qa "$spec" --repo "$review" --run-dir "$out"
|
|
499
504
|
--review-base "$(cat "$out/review.base")" --ripwire-query-file "$out/context.md"
|
|
500
|
-
--prompt-file "$out/qa.input" ${yolo:+"$yolo"} $tflag --output "${FORGE_OUTPUT:-summary}")
|
|
505
|
+
--prompt-file "$out/qa.input" ${yolo:+"$yolo"} $ft $tflag --output "${FORGE_OUTPUT:-summary}")
|
|
501
506
|
FORGE_CAPABILITY_CACHE="${FORGE_CAPABILITY_CACHE:-$plan/capabilities}" \
|
|
502
507
|
"${qa_cmd[@]}" ${rs_cont[@]+"${rs_cont[@]}"} > "$out/qa.out" 2>&1
|
|
503
508
|
rc=$?
|
|
@@ -548,6 +553,9 @@ final_review() {
|
|
|
548
553
|
verdict=""
|
|
549
554
|
[ -s "$out/qa.last" ] && verdict="$(forge_verdict "$out/qa.last")"
|
|
550
555
|
verdict="${verdict:-UNKNOWN}"
|
|
556
|
+
local tests_note
|
|
557
|
+
tests_note="$(forge_tests_note "$out/qa.last")"
|
|
558
|
+
[ -z "$tests_note" ] || note "final review: the reviewer's tests could not run: $tests_note"
|
|
551
559
|
# Same gate as per-task QA, both ways: a FAIL made only of labelled findings below the
|
|
552
560
|
# threshold is accepted with known issues; a PASS listing a blocking CONFIRMED finding fails.
|
|
553
561
|
gate_line="$(python3 "$SKILL_DIR/scripts/forge-contract.py" gate --verdict "$verdict" \
|
|
@@ -632,11 +640,11 @@ do_review() {
|
|
|
632
640
|
tip="$(git -C "$REPO" rev-parse --verify --quiet "$int_br^{commit}")" ||
|
|
633
641
|
die "integration branch $int_br does not exist; run the plan first" 3
|
|
634
642
|
if [ ! -s "$PLAN/accepted.integration" ] || [ "$tip" != "$(cat "$PLAN/accepted.integration")" ]; then
|
|
635
|
-
die "$int_br is not at the revision this run accepted (it moved outside forge); refusing to review something forge did not merge" 3
|
|
643
|
+
die "$int_br is not at the revision this run accepted (it moved outside forge); refusing to review something forge did not merge. To bring those commits into the run: forge-parallel.sh adopt $PLAN --head --reason \"...\"" 3
|
|
636
644
|
fi
|
|
637
645
|
[ -e "$int_wt/.git" ] || die "the integration worktree $int_wt is missing; nothing to take a trustworthy source fingerprint from" 3
|
|
638
646
|
for id in $(all_ids "$T"); do [ "$(task_status "$PLAN" "$id")" = MERGED ] && merged=$((merged+1)); done
|
|
639
|
-
[ "$merged" -gt 0 ] || die "no task has been merged, so there is no combined result to review" 3
|
|
647
|
+
[ "$merged" -gt 0 ] || [ -s "$PLAN/adoptions.tsv" ] || die "no task has been merged, so there is no combined result to review" 3
|
|
640
648
|
|
|
641
649
|
if [ -s "$PLAN/integration.base" ]; then
|
|
642
650
|
base="$(cat "$PLAN/integration.base")"
|
|
@@ -89,6 +89,125 @@ except Exception:
|
|
|
89
89
|
sys.exit(1)' "$1/fractal-selection.json"
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
# --- fast service tier (--fast, #68) ---------------------------------------------------
|
|
93
|
+
# A plan or solo run keeps the roles that should ask for the fast tier in <dir>/fast,
|
|
94
|
+
# one role per line, in the order dwarf, qa, planner, review. Specs never change: the
|
|
95
|
+
# dispatch and its preflight doctor get `--service-tier fast` only for a listed role.
|
|
96
|
+
# Fractal dispatches through its own runner and ignores the file.
|
|
97
|
+
#
|
|
98
|
+
# forge_fast_parse sets FAST_PARSED (dynamic scope: the caller's local, when it has one)
|
|
99
|
+
# to `none` or the roles. forge_fast_store writes that when --fast was given this time;
|
|
100
|
+
# a re-plan that omits the flag leaves the file alone.
|
|
101
|
+
forge_fast_parse() { # forge_fast_parse <roles> <plan|solo>
|
|
102
|
+
local raw="$1" mode="$2" token rest seen="" w more=0
|
|
103
|
+
# Trim the ends only. A space inside a token is part of it: "dwa rf" is not the
|
|
104
|
+
# role dwarf, and deleting every space would turn that typo into a billed role.
|
|
105
|
+
raw="${raw#"${raw%%[![:space:]]*}"}"
|
|
106
|
+
raw="${raw%"${raw##*[![:space:]]}"}"
|
|
107
|
+
[ -n "$raw" ] || die "--fast needs a comma list of roles (dwarf, qa, planner, review), all or none"
|
|
108
|
+
case "$mode" in
|
|
109
|
+
plan|solo) ;;
|
|
110
|
+
*) die "--fast: internal mode '$mode'" ;;
|
|
111
|
+
esac
|
|
112
|
+
case "$raw" in
|
|
113
|
+
none) FAST_PARSED=none; return 0 ;;
|
|
114
|
+
all)
|
|
115
|
+
# `all` is the four plan roles. A solo run has no planner or review, so it cannot
|
|
116
|
+
# mean the same thing there; the user names dwarf and qa instead.
|
|
117
|
+
if [ "$mode" = solo ]; then
|
|
118
|
+
die "--fast: 'all' includes planner and review, which a solo run does not dispatch (expected dwarf, qa or none)"
|
|
119
|
+
fi
|
|
120
|
+
FAST_PARSED="dwarf
|
|
121
|
+
qa
|
|
122
|
+
planner
|
|
123
|
+
review"
|
|
124
|
+
return 0 ;;
|
|
125
|
+
esac
|
|
126
|
+
rest="$raw"
|
|
127
|
+
while true; do
|
|
128
|
+
token="${rest%%,*}"
|
|
129
|
+
token="${token#"${token%%[![:space:]]*}"}"
|
|
130
|
+
token="${token%"${token##*[![:space:]]}"}"
|
|
131
|
+
# A trailing comma is an empty role (`dwarf,`), so the loop must visit that field too.
|
|
132
|
+
case "$rest" in
|
|
133
|
+
*,*) rest="${rest#*,}"; more=1 ;;
|
|
134
|
+
*) rest=""; more=0 ;;
|
|
135
|
+
esac
|
|
136
|
+
if [ -z "$token" ]; then
|
|
137
|
+
if [ "$mode" = solo ]; then
|
|
138
|
+
die "--fast: '' is not a role of a solo run (expected dwarf, qa or none)"
|
|
139
|
+
fi
|
|
140
|
+
die "--fast: '' is not a role (expected dwarf, qa, planner, review, all or none)"
|
|
141
|
+
fi
|
|
142
|
+
if [ "$token" = all ] || [ "$token" = none ]; then
|
|
143
|
+
die "--fast: '$token' must be the whole value, not combined with other roles"
|
|
144
|
+
fi
|
|
145
|
+
case "$mode" in
|
|
146
|
+
solo) case "$token" in dwarf|qa) ;; *) die "--fast: '$token' is not a role of a solo run (expected dwarf, qa or none)" ;; esac ;;
|
|
147
|
+
*) case "$token" in dwarf|qa|planner|review) ;; *) die "--fast: '$token' is not a role (expected dwarf, qa, planner, review, all or none)" ;; esac ;;
|
|
148
|
+
esac
|
|
149
|
+
case " $seen " in
|
|
150
|
+
*" $token "*) ;;
|
|
151
|
+
*) seen="$seen $token" ;;
|
|
152
|
+
esac
|
|
153
|
+
[ "$more" = 1 ] || break
|
|
154
|
+
done
|
|
155
|
+
# Canonical order, whatever order the user typed. A solo run never stores planner or review.
|
|
156
|
+
FAST_PARSED=""
|
|
157
|
+
for w in dwarf qa planner review; do
|
|
158
|
+
[ "$mode" = solo ] && case "$w" in planner|review) continue ;; esac
|
|
159
|
+
case " $seen " in
|
|
160
|
+
*" $w "*)
|
|
161
|
+
if [ -n "$FAST_PARSED" ]; then FAST_PARSED="$FAST_PARSED
|
|
162
|
+
$w"
|
|
163
|
+
else FAST_PARSED="$w"; fi ;;
|
|
164
|
+
esac
|
|
165
|
+
done
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
forge_fast_store() { # forge_fast_store <dir> — honour FAST_GIVEN / FAST_PARSED from the caller
|
|
169
|
+
[ "${FAST_GIVEN:-0}" = 1 ] || return 0
|
|
170
|
+
if [ "$FAST_PARSED" = none ]; then
|
|
171
|
+
rm -f "$1/fast"
|
|
172
|
+
else
|
|
173
|
+
printf '%s\n' "$FAST_PARSED" > "$1/fast" || die "could not write $1/fast"
|
|
174
|
+
fi
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
# Prints `--service-tier fast` when <role> is listed in <dir>/fast, and nothing otherwise.
|
|
178
|
+
# Fractal's runner does not take the option. That is FORGE_FRACTAL_RUN once the runner is
|
|
179
|
+
# selected, and also a saved selection: retry preflights before the runner is selected, so
|
|
180
|
+
# the variable is still unset. A whole-run review is not a Fractal dispatch and still asks.
|
|
181
|
+
forge_fast_tier() { # forge_fast_tier <dir> <role>
|
|
182
|
+
local line found=0
|
|
183
|
+
[ -n "${FORGE_FRACTAL_RUN:-}" ] && return 0
|
|
184
|
+
[ -f "$1/fast" ] || return 0
|
|
185
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
186
|
+
line="${line%$'\r'}"
|
|
187
|
+
line="${line#"${line%%[![:space:]]*}"}"
|
|
188
|
+
line="${line%"${line##*[![:space:]]}"}"
|
|
189
|
+
if [ "$line" = "$2" ]; then found=1; break; fi
|
|
190
|
+
done < "$1/fast"
|
|
191
|
+
[ "$found" = 1 ] || return 0
|
|
192
|
+
if [ "$2" != review ] && forge_plan_is_fractal "$1"; then return 0; fi
|
|
193
|
+
printf '%s %s\n' --service-tier fast
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
# One note per invocation, and only where this invocation's dispatches go through Fractal
|
|
197
|
+
# (FORGE_FRACTAL_RUN already set) or are about to (a retry of a plan whose selection is on).
|
|
198
|
+
# A whole-run review is not one of those dispatches, so it still asks for the tier.
|
|
199
|
+
# No fast file, or no fractal selection to consult, returns before any python.
|
|
200
|
+
forge_fast_fractal_note() { # forge_fast_fractal_note <dir>
|
|
201
|
+
[ -s "$1/fast" ] || return 0
|
|
202
|
+
[ -n "${FORGE_FAST_FRACTAL_NOTED:-}" ] && return 0
|
|
203
|
+
if [ -z "${FORGE_FRACTAL_RUN:-}" ]; then
|
|
204
|
+
[ -s "$1/fractal-selection.json" ] || return 0
|
|
205
|
+
forge_plan_is_fractal "$1" || return 0
|
|
206
|
+
fi
|
|
207
|
+
export FORGE_FAST_FRACTAL_NOTED=1
|
|
208
|
+
note "fast tier is not applied to Fractal dispatches"
|
|
209
|
+
}
|
|
210
|
+
|
|
92
211
|
# The pin's spec: the first line, trimmed, a single token (it lands in a TSV column).
|
|
93
212
|
# Prints nothing when the file is not a regular file or holds no usable spec.
|
|
94
213
|
pin_spec() { # pin_spec <file>
|
|
@@ -215,8 +334,10 @@ carry_findings() { # carry_findings <tdir>
|
|
|
215
334
|
rm -f "$tdir/retry_findings.session" "$tdir/retry_findings.resolved"
|
|
216
335
|
carry_implementer_session "$tdir"
|
|
217
336
|
printf 'review\n' > "$tdir/retry_findings.source"
|
|
218
|
-
local gthr gdec
|
|
219
|
-
|
|
337
|
+
local gthr='' gdec=''
|
|
338
|
+
if [ -f "$tdir/qa.gate" ]; then
|
|
339
|
+
IFS="$(printf '\t')" read -r gthr gdec _ < "$tdir/qa.gate" || true
|
|
340
|
+
fi
|
|
220
341
|
if [ "${gdec:-}" = fail ]; then
|
|
221
342
|
# forge, not the reviewer, failed this attempt: say so above the copied report.
|
|
222
343
|
{ printf "forge: the reviewer's verdict was PASS, but this report lists CONFIRMED findings at or above the \`%s\` blocking threshold, so forge failed the attempt. Fix those findings.\n\n" "$gthr"
|
|
@@ -483,6 +604,7 @@ stop_for_decision() { # stop_for_decision <plan> <id> <reason>...
|
|
|
483
604
|
echo " lower the threshold: forge-parallel.sh retry $PLAN $id --decide threshold=P1 --reason \"...\" --approved"
|
|
484
605
|
echo " (this task's blocking threshold, then one retry)"
|
|
485
606
|
echo " a named model: forge-parallel.sh retry $PLAN $id --dwarf <spec> --reason \"...\" --approved"
|
|
607
|
+
echo " (one attempt; with --decide retry=N, up to N attempts held on that model)"
|
|
486
608
|
case "$from" in FAIL|UNKNOWN) # with no reviewer verdict, accept has nothing to override
|
|
487
609
|
echo " accept it as it is: forge-parallel.sh accept $PLAN $id --reason \"...\" --approved"
|
|
488
610
|
echo " (merges it; its findings become known issues)" ;;
|
|
@@ -527,7 +649,6 @@ retry_decision_gate() { # retry_decision_gate <plan> <id> <status> <decide> <dwa
|
|
|
527
649
|
$(sed -n '1,3p' "$PLAN/tasks/$id/decision.md" 2>/dev/null)
|
|
528
650
|
read $PLAN/tasks/$id/decision.md, then retry with --decide retry=N or --decide threshold=Pn, or --dwarf <spec>, each with --reason \"...\" --approved; or accept the task"
|
|
529
651
|
fi
|
|
530
|
-
[ -z "$decide" ] || [ -z "$dwarf" ] || die "retry: give --decide or --dwarf, not both: a decision is one choice"
|
|
531
652
|
case "$decide" in
|
|
532
653
|
"") ;;
|
|
533
654
|
retry=*) n="${decide#retry=}"
|
|
@@ -547,7 +668,7 @@ read $PLAN/tasks/$id/decision.md, then retry with --decide retry=N or --decide t
|
|
|
547
668
|
retry_decided() { # retry_decided <plan> <id> <decide> <new-dwarf> <reason>
|
|
548
669
|
local PLAN="$1" id="$2" decide="$3" newdwarf="$4" reason="$5" tdir="$1/tasks/$2" choice f rc=0 attempt
|
|
549
670
|
local undo="$1/tasks/$2/.decision.undo"
|
|
550
|
-
choice="$decide"; [ -
|
|
671
|
+
choice="$decide"; [ -z "$newdwarf" ] || choice="${choice:+$choice }dwarf=$newdwarf"
|
|
551
672
|
reason="$(printf '%s' "$reason" | tr '\n\r\t' ' ' | sed 's/^ *//; s/ *$//')"
|
|
552
673
|
attempt="$(cat "$tdir/attempt" 2>/dev/null || echo 0)"
|
|
553
674
|
rm -rf "${undo:?}"; mkdir "$undo" 2>/dev/null || { note "$id: could not record the decision; nothing was retried"; return 1; }
|
|
@@ -589,7 +710,9 @@ decided_attempts() { # decided_attempts <decide>
|
|
|
589
710
|
# run that uses it may end first (a quota stop) and a later `run` or `retry` must still honour it.
|
|
590
711
|
# Absent means no decision governs and the retry budget rules; 0 means the decided attempts are used.
|
|
591
712
|
decided_left() { # decided_left <task-dir>: the number, or nothing
|
|
592
|
-
local v
|
|
713
|
+
local v
|
|
714
|
+
[ -f "$1/decided.left" ] || return 0
|
|
715
|
+
v="$(tr -dc '0-9' < "$1/decided.left" | head -c 3)"
|
|
593
716
|
[ -n "$v" ] && echo $(( 10#$v ))
|
|
594
717
|
return 0
|
|
595
718
|
}
|
|
@@ -619,6 +742,8 @@ report_decisions() { # report_decisions <plan>
|
|
|
619
742
|
echo " forge-parallel.sh retry $plan <task-id> --decide retry=N | --decide threshold=Pn | --dwarf <spec>"
|
|
620
743
|
[ "$acceptable" = 0 ] || echo " forge-parallel.sh accept $plan <task-id> (merge it with its findings as known issues)"
|
|
621
744
|
echo " or split it: replace its row in $plan/tasks.tsv with smaller tasks, then forge-parallel.sh run $plan"
|
|
745
|
+
echo "several side by side: add --no-dispatch to each retry, which records the decision and starts nothing, then:"
|
|
746
|
+
echo " forge-parallel.sh run $plan"
|
|
622
747
|
echo
|
|
623
748
|
}
|
|
624
749
|
|
|
@@ -1073,6 +1198,14 @@ report_known_issues() { # report_known_issues <plan>
|
|
|
1073
1198
|
n=$((n+1))
|
|
1074
1199
|
printf ' %-14s %s finding(s) %s\n' "$id" "$(grep -c '^- ' "$plan/tasks/$id/known_issues.md" 2>/dev/null || echo 0)" "$plan/tasks/$id/known_issues.md"
|
|
1075
1200
|
done
|
|
1201
|
+
# What an adopted range kept: findings below the threshold, or a verdict --approved overrode.
|
|
1202
|
+
local dir
|
|
1203
|
+
for dir in $(awk -F'\t' '{ print $7 }' "$plan/adoptions.tsv" 2>/dev/null); do
|
|
1204
|
+
[ -s "$plan/$dir/known_issues.md" ] || continue
|
|
1205
|
+
[ "$n" = 0 ] && echo "known issues accepted (findings below the QA threshold, or accepted by a person):"
|
|
1206
|
+
n=$((n+1))
|
|
1207
|
+
printf ' %-14s %s finding(s) %s\n' adopted "$(grep -c '^- ' "$plan/$dir/known_issues.md" 2>/dev/null)" "$plan/$dir/known_issues.md"
|
|
1208
|
+
done
|
|
1076
1209
|
[ "$n" -gt 0 ] && echo
|
|
1077
1210
|
return 0
|
|
1078
1211
|
}
|
package/scripts/forge-memory.sh
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
# forge-memory.sh show <repo>
|
|
26
26
|
# forge-memory.sh prune <repo>
|
|
27
27
|
# forge-memory.sh spend <repo> [--run <run-id>]
|
|
28
|
+
# forge-memory.sh learnings <repo> [--json] every ledger learning and its state, as JSON
|
|
28
29
|
#
|
|
29
30
|
# Exit codes: 0 ok | 2 usage error
|
|
30
31
|
set -uo pipefail
|
|
@@ -119,12 +120,14 @@ section_title() {
|
|
|
119
120
|
# memory.md is regenerated from the whole ledger rather than mutated in place.
|
|
120
121
|
# Rebuilding is idempotent and order-independent, so a crashed or concurrent run
|
|
121
122
|
# cannot leave memory half-updated — it can only leave the ledger short a row.
|
|
122
|
-
|
|
123
|
+
# With <out>, the memory is written there instead of the repo's .forge/memory.md, and the repo is
|
|
124
|
+
# only read: `learnings` uses that to say what a rebuild keeps without changing anything.
|
|
125
|
+
rebuild() { # rebuild <repo> [<out>] -> prints "kept<TAB>pruned_stale<TAB>pruned_cap"
|
|
123
126
|
local repo="$1" led mem tmp cand jev_loaded=0
|
|
124
127
|
if [ "${FORGE_MEMORY_DEEP_PRUNE:-0}" = 1 ] && [ -f "$SKILL_DIR/scripts/forge-jev-options.sh" ]; then
|
|
125
128
|
source "$SKILL_DIR/scripts/forge-jev-options.sh" 2>/dev/null && jev_loaded=1
|
|
126
129
|
fi
|
|
127
|
-
led="$(ledger_for "$repo")"; mem="$(memory_for "$repo")"
|
|
130
|
+
led="$(ledger_for "$repo")"; mem="${2:-$(memory_for "$repo")}"
|
|
128
131
|
[ -f "$led" ] || return 0
|
|
129
132
|
tmp="$mem.tmp.$$"; cand="$mem.cand.$$"
|
|
130
133
|
|
|
@@ -222,7 +225,7 @@ rebuild() { # rebuild <repo> -> prints "kept<TAB>pruned_stale<TAB>pruned_cap"
|
|
|
222
225
|
# The cap can eat a section's last fact, leaving a heading over nothing.
|
|
223
226
|
drop_empty_sections "$header"
|
|
224
227
|
|
|
225
|
-
mkdir -p "$(dir_for "$repo")"
|
|
228
|
+
[ -n "${2:-}" ] || mkdir -p "$(dir_for "$repo")"
|
|
226
229
|
mv "$header" "$mem"
|
|
227
230
|
rm -f "$tmp"
|
|
228
231
|
printf '%s\t%s\t%s\n' "$kept" "$stale" "$capped"
|
|
@@ -495,6 +498,26 @@ do_prune() { # do_prune <repo>
|
|
|
495
498
|
rm -f ${MEMORY_DROPS:+"$MEMORY_DROPS"}
|
|
496
499
|
}
|
|
497
500
|
|
|
501
|
+
# --- learnings ----------------------------------------------------------------
|
|
502
|
+
# Every learning in the ledger and what forge does with it, as JSON (forge-ui's Projects screen,
|
|
503
|
+
# #126). The states come from this file's own rebuild, run into a scratch dir: the same grouping,
|
|
504
|
+
# promotion threshold, staleness check and cap that `record` applies, so the listing cannot drift
|
|
505
|
+
# from what memory.md gets. Read-only for the repo. No Jev: deep pruning happens only on `prune`.
|
|
506
|
+
do_learnings() { # do_learnings <repo>
|
|
507
|
+
local repo="${1:?learnings needs a repo}" scratch rc=0
|
|
508
|
+
[ -d "$repo" ] || die "learnings: '$repo' is not a directory"
|
|
509
|
+
scratch="$(mktemp -d "${TMPDIR:-/tmp}/forge-memory-learnings.XXXXXX")" || die "learnings: no scratch dir" 3
|
|
510
|
+
: > "$scratch/drops"
|
|
511
|
+
if [ -f "$(ledger_for "$repo")" ]; then
|
|
512
|
+
MEMORY_DROPS="$scratch/drops" FORGE_MEMORY_DEEP_PRUNE=0 rebuild "$repo" "$scratch/memory.md" > "$scratch/counts"
|
|
513
|
+
fi
|
|
514
|
+
python3 "$SKILL_DIR/scripts/forge_memory_list.py" --repo "$repo" --ledger "$(ledger_for "$repo")" \
|
|
515
|
+
--memory "$(memory_for "$repo")" --rebuilt "$scratch/memory.md" --drops "$scratch/drops" \
|
|
516
|
+
--max-lines "$MAX_LINES" --max-bytes "$MAX_BYTES" --memory-off "$(memory_off && echo 1 || echo 0)" || rc=$?
|
|
517
|
+
rm -rf "$scratch"
|
|
518
|
+
return "$rc"
|
|
519
|
+
}
|
|
520
|
+
|
|
498
521
|
# --- spend --------------------------------------------------------------------
|
|
499
522
|
# The ledger already carries one row per dispatch, and it is never injected into a
|
|
500
523
|
# prompt, so accounting from it costs nothing at all. Time and dispatch counts
|
|
@@ -561,14 +584,28 @@ do_spend() {
|
|
|
561
584
|
}
|
|
562
585
|
|
|
563
586
|
# --- main ---------------------------------------------------------------------
|
|
564
|
-
|
|
587
|
+
memory_usage() {
|
|
588
|
+
cat <<'USAGE'
|
|
589
|
+
usage: forge memory <command> <repo> [...] (scripts/forge-memory.sh)
|
|
590
|
+
|
|
591
|
+
show <repo> the repository's .forge/memory.md
|
|
592
|
+
learnings <repo> [--json] every ledger learning and what forge does with it (in_memory, waiting,
|
|
593
|
+
stale, capped, muted), from forge's own rebuild; changes nothing
|
|
594
|
+
prune <repo> re-apply staleness and the cap now, then print what a dwarf is told
|
|
595
|
+
spend <repo> [--run ID] what forge has cost this repository, from the ledger
|
|
596
|
+
inject <repo> <role> the block forge prepends to a planner, dwarf or qa prompt
|
|
597
|
+
USAGE
|
|
598
|
+
}
|
|
599
|
+
[ $# -ge 1 ] || die "usage: forge-memory.sh <inject|note|record|show|prune|spend|learnings> [repo] [...]"
|
|
565
600
|
CMD="$1"; shift
|
|
566
601
|
case "$CMD" in
|
|
602
|
+
-h|--help|help) memory_usage; exit 0 ;;
|
|
567
603
|
inject) do_inject "$@" ;;
|
|
568
604
|
note) do_note "$@" ;;
|
|
569
605
|
record) do_record "$@" ;;
|
|
570
606
|
show) mem="$(memory_for "${1:?show needs a repo}")"; [ -s "$mem" ] && cat "$mem" ;;
|
|
571
607
|
spend) do_spend "$@" ;;
|
|
608
|
+
learnings) [ "${2:-}" = --json ] || [ $# -eq 1 ] || die "learnings: usage: learnings <repo> [--json]"; do_learnings "$1" ;;
|
|
572
609
|
prune) do_prune "${1:?prune needs a repo}" >/dev/null
|
|
573
610
|
do_inject "${1}" dwarf ;;
|
|
574
611
|
*) die "unknown subcommand '$CMD'" ;;
|
package/scripts/forge-metrics.sh
CHANGED
|
@@ -23,6 +23,13 @@ forge_dataset_event() { # forge_dataset_event <name> --dir <dir> [--task id] [--
|
|
|
23
23
|
forge_dataset_off && return 0
|
|
24
24
|
python3 "$SKILL_DIR/scripts/forge-dataset.py" event "$@" >/dev/null 2>&1 || true
|
|
25
25
|
}
|
|
26
|
+
# A worktree forge added or removed (#125): forge-ui's Worktrees screen lists every one, removed ones too.
|
|
27
|
+
# <kind> is task, integration, candidate or attribute (scripts/forge_worktrees.py); <branch> is - when detached.
|
|
28
|
+
# Off with the dataset (FORGE_DATASET=off), as forge_dataset_event is.
|
|
29
|
+
forge_worktree_event() { # forge_worktree_event created|removed <run dir> <repo> <path> <branch|-> <kind> [task]
|
|
30
|
+
forge_dataset_event "worktree_$1" --dir "$2" ${7:+--task "$7"} --set repo_path="$3" --set path="$4" \
|
|
31
|
+
--set branch="$5" --set kind="$6"
|
|
32
|
+
}
|
|
26
33
|
forge_dataset_invocation() { # forge_dataset_invocation <command> <rc> <started> [argv...]
|
|
27
34
|
forge_dataset_off && return 0
|
|
28
35
|
local command="$1" rc="$2" started="$3"; shift 3
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
# 1 not ours, or not accepted by this subcommand
|
|
12
12
|
# A malformed value exits through die (2).
|
|
13
13
|
#
|
|
14
|
+
# A profile (plan --profile, frozen as $PLAN/profile.json) supplies --retry-failed and
|
|
15
|
+
# --infra-retries when `run` or `retry` is not given them; a flag wins. On `retry` they are
|
|
16
|
+
# the further attempts after this one (while its review fails) and the waits out of an infrastructure stop.
|
|
17
|
+
#
|
|
14
18
|
# Persisted options become files in the plan dir, like --verify and --setup, so a later
|
|
15
19
|
# `retry` or the scheduler's task processes see them. Cost-bearing options that change
|
|
16
20
|
# what a run is allowed to spend (--retry-failed, --infra-retries) are deliberately NOT
|
|
@@ -19,8 +23,8 @@
|
|
|
19
23
|
# `forge control` can change them live; the scheduler removes those files when it exits.
|
|
20
24
|
#
|
|
21
25
|
# --timeout S run retry $PLAN/timeout dispatch timeout, seconds (0 = none)
|
|
22
|
-
# --retry-failed N run
|
|
23
|
-
# --infra-retries M run
|
|
26
|
+
# --retry-failed N run retry (this run only) automatic reviewer-driven retries
|
|
27
|
+
# --infra-retries M run retry (this run only) waits out quota/auth/network stops
|
|
24
28
|
# --infra-backoff SHAPE run $PLAN/infra_backoff waits between those stops: exp:B[,C],
|
|
25
29
|
# linear:S,T[,C] or list:a,b,... (default exp:60)
|
|
26
30
|
# --infra-fallback run $PLAN/infra_fallback a dwarf's stop that another model can take (capacity,
|
|
@@ -60,6 +64,8 @@
|
|
|
60
64
|
PP_SHIFT=2
|
|
61
65
|
PP_RETRY_FAILED=0
|
|
62
66
|
PP_INFRA_RETRIES=0
|
|
67
|
+
PP_RETRY_FAILED_SET=0 # given on this command line, so a frozen profile's value does not replace it
|
|
68
|
+
PP_INFRA_RETRIES_SET=0
|
|
63
69
|
PP_FINAL_REVIEW=""
|
|
64
70
|
PP_SWEEP=""
|
|
65
71
|
PP_SWEEP_MAX=5
|
|
@@ -97,11 +103,11 @@ forge_pp_flag() {
|
|
|
97
103
|
pp_nonneg --timeout "${2:-}"
|
|
98
104
|
printf '%s' "$2" > "$plan/timeout" ;;
|
|
99
105
|
--retry-failed)
|
|
100
|
-
[ "$cmd" = run ] || return 1
|
|
101
|
-
pp_nonneg --retry-failed "${2:-}"; PP_RETRY_FAILED="$2" ;;
|
|
106
|
+
[ "$cmd" = run ] || [ "$cmd" = retry ] || return 1
|
|
107
|
+
pp_nonneg --retry-failed "${2:-}"; PP_RETRY_FAILED="$2"; PP_RETRY_FAILED_SET=1 ;;
|
|
102
108
|
--infra-retries)
|
|
103
|
-
[ "$cmd" = run ] || return 1
|
|
104
|
-
pp_nonneg --infra-retries "${2:-}"; PP_INFRA_RETRIES="$2" ;;
|
|
109
|
+
[ "$cmd" = run ] || [ "$cmd" = retry ] || return 1
|
|
110
|
+
pp_nonneg --infra-retries "${2:-}"; PP_INFRA_RETRIES="$2"; PP_INFRA_RETRIES_SET=1 ;;
|
|
105
111
|
--infra-fallback)
|
|
106
112
|
[ "$cmd" = run ] || return 1
|
|
107
113
|
PP_SHIFT=1; printf 'on\n' > "$plan/infra_fallback" ;;
|