teamsmith 0.1.2 → 0.3.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/README.md +13 -7
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +67 -0
- package/skills/teamsmith/SKILL.md +26 -8
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/agent-adapters.md +7 -7
- package/skills/teamsmith/references/config.md +65 -18
- package/skills/teamsmith/references/migration.md +220 -34
- package/skills/teamsmith/references/protocol.md +250 -25
- package/skills/teamsmith/references/troubleshooting.md +124 -7
- package/skills/teamsmith/references/workflows.md +66 -20
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
- package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
- package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
- package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
- package/skills/teamsmith/scripts/lib/common.sh +1560 -109
- package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
- package/skills/teamsmith/scripts/monitor.mjs +34 -3
- package/skills/teamsmith/scripts/panel/README.md +22 -11
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +226 -224
- package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
- package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
- package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
- package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
- package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
- package/skills/teamsmith/scripts/replies.mjs +896 -0
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +20 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
- package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
- package/skills/teamsmith/templates/config.sh.tmpl +29 -5
- package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
- package/skills/teamsmith/templates/report.md.tmpl +12 -0
- package/skills/teamsmith/templates/task.md.tmpl +4 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
- package/skills/teamsmith/tests/config-cli.sh +320 -300
- package/skills/teamsmith/tests/death-cause.sh +5 -2
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-m37.sh +4 -1
- package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
- package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p210.sh +4 -1
- package/skills/teamsmith/tests/flip-p217.sh +4 -1
- package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
- package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
- package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +283 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
- package/skills/teamsmith/tests/key-replies.sh +1314 -0
- package/skills/teamsmith/tests/ledger-ban.sh +9 -8
- package/skills/teamsmith/tests/ledger-claim.sh +248 -0
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
- package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
- package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
- package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
- package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
- package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
- package/skills/teamsmith/tests/panel-b2.sh +107 -4
- package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
- package/skills/teamsmith/tests/panel-b3.sh +189 -29
- package/skills/teamsmith/tests/panel-choices.sh +81 -63
- package/skills/teamsmith/tests/panel-cpu.sh +3 -2
- package/skills/teamsmith/tests/panel-knobs.sh +7 -1
- package/skills/teamsmith/tests/panel-p21.sh +445 -241
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +122 -31
- package/skills/teamsmith/tests/pm-box-real.sh +1 -1
- package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
- package/skills/teamsmith/tests/routes.sh +364 -109
- package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-budgets.tsv +26 -12
- package/skills/teamsmith/tests/section-guard.sh +6 -1
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +42 -26
- package/skills/teamsmith/tests/section-select.sh +90 -7
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/smoke.sh +3762 -628
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
- package/skills/teamsmith/tests/task-header-model.sh +2 -1
- package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith-init/SKILL.md +43 -43
- package/skills/teamsmith-init/references/bootstrap.md +8 -6
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# P228 repair probes. Sourced only by the isolated routing front door.
|
|
3
|
+
routing_observable_snapshot() {
|
|
4
|
+
{ find "$STATE" -type f -printf '%p %T@ %s\n' 2>/dev/null | sort
|
|
5
|
+
find "$STATE" -type f -print0 2>/dev/null | sort -z | xargs -0 -r sha256sum
|
|
6
|
+
sha256sum "$CONFIG" "$REPO/docs/team/BOARD.md" "$TMP/argv-jsonl" 2>/dev/null || true
|
|
7
|
+
tmux list-windows -t routing-fixture -F '#{window_id} #{pane_id} #{pane_pid}' 2>/dev/null || true
|
|
8
|
+
git -C "$REPO/.worktrees/dev" status --porcelain
|
|
9
|
+
} | sha256sum | cut -d' ' -f1
|
|
10
|
+
}
|
|
11
|
+
# Preserve each negative template arm, not only the final restored record. All files
|
|
12
|
+
# are synthetic fixture data; capture lives outside observable project state.
|
|
13
|
+
routing_binding_capture() { # entry tag mode before|after
|
|
14
|
+
local entry="$1" tag="$2" mode="$3" phase="$4" f dest
|
|
15
|
+
dest="$TMP/binding-cases/$entry-$tag-$mode/$phase"
|
|
16
|
+
mkdir -p "$dest" || return 1
|
|
17
|
+
for f in "$CONFIG" "$REPO/docs/team/BOARD.md" "$TMP/argv-jsonl" \
|
|
18
|
+
"$STATE/dev.env" "$STATE/pm-launch.env" "$STATE/prompt-dev-T1.md" "$STATE/pm-prompt.md"; do
|
|
19
|
+
if [ -f "$f" ]; then cp -p "$f" "$dest/" || return 1; else printf '%s\n' "$f" >> "$dest/absent.txt" || return 1; fi
|
|
20
|
+
done
|
|
21
|
+
routing_observable_snapshot > "$dest/effect.hash"
|
|
22
|
+
}
|
|
23
|
+
# Option-aware record-only oracle, not a Pi/provider compatibility parser. The
|
|
24
|
+
# probe's supported selectors must each occur once; unrelated data flags consume
|
|
25
|
+
# their literal value, and do not count as identity merely by containing it.
|
|
26
|
+
routing_identity_argv_check() { # jsonl provider model sid|- continuity|-
|
|
27
|
+
python3 - "$@" <<'PY'
|
|
28
|
+
import json,sys
|
|
29
|
+
path,provider,model,sid,continuity=sys.argv[1:]
|
|
30
|
+
args=json.loads(open(path).readlines()[-1]); found={k:[] for k in ('provider','model','sid','continuity')}
|
|
31
|
+
i=0
|
|
32
|
+
while i<len(args):
|
|
33
|
+
a=args[i]; i+=1
|
|
34
|
+
if a in ('--label','-e','--skill'):
|
|
35
|
+
assert i<len(args),args
|
|
36
|
+
i+=1; continue
|
|
37
|
+
if a in ('-c','--continue'):
|
|
38
|
+
found['continuity'].append(a); continue
|
|
39
|
+
for key,opts in {'provider':('--provider',),'model':('--model','-m'),'sid':('--session-id','-s')}.items():
|
|
40
|
+
if a in opts:
|
|
41
|
+
assert i<len(args),args
|
|
42
|
+
found[key].append(args[i]); i+=1; break
|
|
43
|
+
if any(a.startswith(o+'=') for o in opts):
|
|
44
|
+
found[key].append(a.split('=',1)[1]); break
|
|
45
|
+
if any(len(o)==2 and a.startswith(o) for o in opts):
|
|
46
|
+
found[key].append(a[2:]); break
|
|
47
|
+
expected={'provider':[provider],'model':[model],'sid':[] if sid=='-' else [sid],
|
|
48
|
+
'continuity':[] if continuity=='-' else [continuity]}
|
|
49
|
+
assert found==expected,(found,expected,args)
|
|
50
|
+
PY
|
|
51
|
+
}
|
|
52
|
+
routing_template_probes() {
|
|
53
|
+
# A preceding resume group deliberately removes routine from future policy.
|
|
54
|
+
# This probe makes a new explicit choice: establish its own mapped premise,
|
|
55
|
+
# then restore the prior policy. Never weaken the unmapped-override guard.
|
|
56
|
+
local before_map; before_map="$(team_config_file_value "$CONFIG" TEAM_TASK_MODELS)"
|
|
57
|
+
run config set-task-model routine vendor/routine
|
|
58
|
+
check template-probe-category-ready eq "$RC" 0
|
|
59
|
+
stop_fixture_seat dev
|
|
60
|
+
# Begin with an actual complete assignment and a stopped recording CLI.
|
|
61
|
+
run dispatch dev T1 docs/team/tasks/T1-fixture.md --model vendor/deep/model:high --fresh
|
|
62
|
+
check template-probe-trusted-setup eq "$RC" 0
|
|
63
|
+
team_assignment_load dev; local sid="${TEAM_ASSIGN[sid]:-missing}" bad tag mode snapshot
|
|
64
|
+
stop_fixture_seat dev
|
|
65
|
+
local good="$TMP/recording-pi --provider {provider} --model {model} --session-id {session_id}"
|
|
66
|
+
local -a faults=(
|
|
67
|
+
'all-hardcoded|--provider other --model wrong:low --session-id other-history'
|
|
68
|
+
'provider-hardcoded|--provider other --model {model} --session-id {session_id}'
|
|
69
|
+
'model-hardcoded|--provider {provider} --model wrong:low --session-id {session_id}'
|
|
70
|
+
'sid-hardcoded|--provider {provider} --model {model} --session-id other-history'
|
|
71
|
+
'equals-hardcoded|--provider=other --model=wrong --session-id=other-history'
|
|
72
|
+
'short-hardcoded|-mwrong -sother-history'
|
|
73
|
+
'quoted-identity|"--model=wrong" --session-id {session_id}'
|
|
74
|
+
'duplicate-model|--provider {provider} --model {model} --model wrong --session-id {session_id}'
|
|
75
|
+
'duplicate-provider|--provider {provider} --provider {provider} --model {model} --session-id {session_id}'
|
|
76
|
+
'script-placeholder|"--provider {provider} --model {model} --session-id {session_id}"'
|
|
77
|
+
'hidden-script-option|--provider {provider} --model {model} --session-id {session_id} "exec pi --model wrong"'
|
|
78
|
+
'joined-placeholders|{provider}{model}{session_id}'
|
|
79
|
+
'positional-all|{provider} {model} {session_id}'
|
|
80
|
+
'positional-provider|{provider} --model {model} --session-id {session_id}'
|
|
81
|
+
'positional-model|--provider {provider} {model} --session-id {session_id}'
|
|
82
|
+
'positional-sid|--provider {provider} --model {model} {session_id}'
|
|
83
|
+
'data-provider|--label {provider} --model {model} --session-id {session_id}'
|
|
84
|
+
'data-model|--provider {provider} -e {model} --session-id {session_id}'
|
|
85
|
+
'data-sid|--provider {provider} --model {model} --skill {session_id}'
|
|
86
|
+
'list-as-model|--provider {provider} --model {extra_args} {model} --session-id {session_id}'
|
|
87
|
+
'duplicate-sid|--provider {provider} --model {model} --session-id {session_id} --session-id {session_id}'
|
|
88
|
+
'continue|--provider {provider} --model {model} --session-id {session_id} --continue'
|
|
89
|
+
'resume|--provider {provider} --model {model} --session-id {session_id} -r other-history'
|
|
90
|
+
'bare-session|--provider {provider} --model {model} other-history.jsonl'
|
|
91
|
+
'missing-model-value|--provider {provider} --model --session-id {session_id}'
|
|
92
|
+
'missing-sid-selector|--provider {provider} --model {model}'
|
|
93
|
+
'misbound-placeholder|--provider {model} --model {provider} --session-id {session_id}'
|
|
94
|
+
'quoted-placeholder|--provider {provider} --model "{model}" --session-id {session_id}'
|
|
95
|
+
'hidden-shell|--provider {provider} --model {model} --session-id {session_id}; touch TEMPLATE_PWNED'
|
|
96
|
+
)
|
|
97
|
+
for bad in "${faults[@]}"; do
|
|
98
|
+
tag="${bad%%|*}"; run config set TEAM_AGENT_CMD "$TMP/recording-pi ${bad#*|}" --yes
|
|
99
|
+
# The writer may reject the template, which itself is a safe no-launch result.
|
|
100
|
+
if [ "$RC" != 0 ]; then check "template-writer-refusal:$tag" eq "$RC" 4; continue; fi
|
|
101
|
+
for mode in preview launch fresh-preview fresh-launch; do
|
|
102
|
+
# Only continuation requires the opaque template to expose full identity;
|
|
103
|
+
# fresh does not upgrade the frozen seam into a non-Pi compatibility promise.
|
|
104
|
+
case "$tag:$mode" in missing-sid-selector:fresh-*) continue ;; esac
|
|
105
|
+
snapshot="$(routing_observable_snapshot)"
|
|
106
|
+
check "binding-capture:worker:$tag:$mode:before" routing_binding_capture worker "$tag" "$mode" before
|
|
107
|
+
case "$mode" in
|
|
108
|
+
preview) run dispatch dev T1 docs/team/tasks/T1-fixture.md --force --print ;;
|
|
109
|
+
launch) run dispatch dev T1 docs/team/tasks/T1-fixture.md --force ;;
|
|
110
|
+
fresh-preview) run dispatch dev T1 docs/team/tasks/T1-fixture.md --force --fresh --print ;;
|
|
111
|
+
fresh-launch) run dispatch dev T1 docs/team/tasks/T1-fixture.md --force --fresh ;;
|
|
112
|
+
esac
|
|
113
|
+
check "template-refused:$tag:$mode" eq "$RC" 1
|
|
114
|
+
check "template-pure:$tag:$mode" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
115
|
+
check "binding-capture:worker:$tag:$mode:after" routing_binding_capture worker "$tag" "$mode" after
|
|
116
|
+
# Do not let a red old implementation leave an uncommitted worker running.
|
|
117
|
+
stop_fixture_seat dev
|
|
118
|
+
done
|
|
119
|
+
done
|
|
120
|
+
for mode in separate equals short attached extras literal-data; do
|
|
121
|
+
case "$mode" in
|
|
122
|
+
separate) good="$TMP/recording-pi --provider {provider} --model {model} --session-id {session_id}" ;;
|
|
123
|
+
equals) good="$TMP/recording-pi --provider={provider} --model={model} --session-id={session_id}" ;;
|
|
124
|
+
short) good="$TMP/recording-pi --provider {provider} -m {model} -s {session_id}" ;;
|
|
125
|
+
attached) good="$TMP/recording-pi --provider={provider} -m{model} -s{session_id}" ;;
|
|
126
|
+
extras) good="$TMP/recording-pi --provider {provider} --model {model} --session-id {session_id} {extra_args}"
|
|
127
|
+
run config set TEAM_EXTRA_PI_ARGS ' --no-tools --label "two words"' --yes
|
|
128
|
+
check template-harmless-extra-config eq "$RC" 0 ;;
|
|
129
|
+
literal-data) good="$TMP/recording-pi -e 'deep/model:high' --skill literal --provider {provider} --model {model} --session-id {session_id} {extra_args} --label vendor" ;;
|
|
130
|
+
esac
|
|
131
|
+
run config set TEAM_AGENT_CMD "$good" --yes
|
|
132
|
+
check "template-legal-config:$mode" eq "$RC" 0
|
|
133
|
+
snapshot="$(routing_observable_snapshot)"
|
|
134
|
+
run dispatch dev T1 docs/team/tasks/T1-fixture.md --print
|
|
135
|
+
check "template-legal-preview:$mode" eq "$RC" 0
|
|
136
|
+
check "template-legal-preview-pure:$mode" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
137
|
+
check "template-legal-preview-sid:$mode" contains "$OUT" "$sid"
|
|
138
|
+
run dispatch dev T1 docs/team/tasks/T1-fixture.md
|
|
139
|
+
check "template-legal-launch:$mode" eq "$RC" 0
|
|
140
|
+
check "template-legal-argv:$mode" routing_identity_argv_check "$TMP/argv-jsonl" vendor deep/model:high "$sid" -
|
|
141
|
+
if [ "$mode" = extras ]; then
|
|
142
|
+
check template-legal-extra-data python3 -c 'import json,sys; a=json.loads(open(sys.argv[1]).readlines()[-1]); assert "--no-tools" in a and a[a.index("--label")+1]=="two words"' "$TMP/argv-jsonl"
|
|
143
|
+
fi
|
|
144
|
+
stop_fixture_seat dev
|
|
145
|
+
snapshot="$(routing_observable_snapshot)"
|
|
146
|
+
run dispatch dev T1 docs/team/tasks/T1-fixture.md --fresh --print
|
|
147
|
+
check "template-bound-fresh-preview:$mode" eq "$RC" 0
|
|
148
|
+
check "template-bound-fresh-preview-pure:$mode" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
149
|
+
run dispatch dev T1 docs/team/tasks/T1-fixture.md --fresh
|
|
150
|
+
check "template-bound-fresh-launch:$mode" eq "$RC" 0
|
|
151
|
+
local old_sid="$sid"; team_assignment_load dev; sid="${TEAM_ASSIGN[sid]:-missing}"
|
|
152
|
+
check "template-bound-fresh-new-sid:$mode" test "$sid" != "$old_sid"
|
|
153
|
+
check "template-bound-fresh-record-model:$mode" eq "${TEAM_ASSIGN[model]:-missing}" vendor/deep/model:high
|
|
154
|
+
check "template-bound-fresh-record-mode:$mode" eq "${TEAM_ASSIGN[mode]:-missing}" fresh
|
|
155
|
+
check "template-bound-fresh-exact-argv:$mode" routing_identity_argv_check "$TMP/argv-jsonl" vendor deep/model:high "$sid" -
|
|
156
|
+
stop_fixture_seat dev
|
|
157
|
+
done
|
|
158
|
+
run config set TEAM_EXTRA_PI_ARGS '' --yes
|
|
159
|
+
run config set TEAM_AGENT_CMD '' --yes
|
|
160
|
+
run config set TEAM_TASK_MODELS "$before_map" --yes
|
|
161
|
+
check template-probe-policy-restored eq "$RC" 0
|
|
162
|
+
}
|
|
163
|
+
routing_pm_template_probes() {
|
|
164
|
+
local tag bad mode snapshot good
|
|
165
|
+
local -a faults=(
|
|
166
|
+
'provider|--provider other --model {model}'
|
|
167
|
+
'model|--provider {provider} --model wrong'
|
|
168
|
+
'equals|--provider=other --model=wrong'
|
|
169
|
+
'short|-mwrong'
|
|
170
|
+
'duplicate|--provider {provider} --model {model} --model {model}'
|
|
171
|
+
'missing|--provider {provider} --model'
|
|
172
|
+
'session|--provider {provider} --model {model} --session-id wrong'
|
|
173
|
+
'session-placeholder|--provider {provider} --model {model} --session-id {session_id}'
|
|
174
|
+
'continue|--provider {provider} --model {model} -c'
|
|
175
|
+
'resume-equals|--provider {provider} --model {model} --resume=wrong'
|
|
176
|
+
'quoted|--provider {provider} "--model=wrong"'
|
|
177
|
+
'bare-session|--provider {provider} --model {model} history.jsonl'
|
|
178
|
+
'misbound|--provider {model} --model {provider}'
|
|
179
|
+
'positional-all|{provider} {model}'
|
|
180
|
+
'positional-provider|{provider} --model {model}'
|
|
181
|
+
'positional-model|--provider {provider} {model}'
|
|
182
|
+
'data-provider|--label {provider} --model {model}'
|
|
183
|
+
'data-model|--provider {provider} -e {model}'
|
|
184
|
+
'list-as-model|--provider {provider} --model {extra_args} {model}'
|
|
185
|
+
'script-placeholder|"--provider {provider} --model {model}"'
|
|
186
|
+
'hidden-script-option|--provider {provider} --model {model} "exec pi --model wrong"'
|
|
187
|
+
)
|
|
188
|
+
# Keep the private server/session alive while each arm deliberately stops PM.
|
|
189
|
+
# Otherwise stopping its last window destroys the premise of the older rollback
|
|
190
|
+
# control later in this same fixture (not a product publication failure).
|
|
191
|
+
routing_fixture_tmux new-window -d -t routing-fixture -n boundary-anchor 'sleep 600'
|
|
192
|
+
check pm-template-private-anchor eq "$?" 0
|
|
193
|
+
stop_fixture_seat pm
|
|
194
|
+
for bad in "${faults[@]}"; do
|
|
195
|
+
tag="${bad%%|*}"; run config set TEAM_PM_CMD "$TMP/recording-pi ${bad#*|} {resume_args} {prompt}" --yes
|
|
196
|
+
check "pm-template-config:$tag" eq "$RC" 0
|
|
197
|
+
for mode in preview launch; do
|
|
198
|
+
snapshot="$(routing_observable_snapshot)"
|
|
199
|
+
check "binding-capture:pm-fresh:$tag:$mode:before" routing_binding_capture pm-fresh "$tag" "$mode" before
|
|
200
|
+
if [ "$mode" = preview ]; then run up --fresh-pm --print; else run up --fresh-pm; fi
|
|
201
|
+
check "pm-template-refused:$tag:$mode" eq "$RC" 1
|
|
202
|
+
check "pm-template-pure:$tag:$mode" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
203
|
+
check "binding-capture:pm-fresh:$tag:$mode:after" routing_binding_capture pm-fresh "$tag" "$mode" after
|
|
204
|
+
stop_fixture_seat pm
|
|
205
|
+
done
|
|
206
|
+
done
|
|
207
|
+
good="$TMP/recording-pi --provider {provider} --model {model} {resume_args} {prompt}"
|
|
208
|
+
run config set TEAM_PM_CMD "$good" --yes
|
|
209
|
+
run up --fresh-pm --print
|
|
210
|
+
check pm-template-legal-preview eq "$RC" 0
|
|
211
|
+
run up --fresh-pm
|
|
212
|
+
check pm-template-legal-launch eq "$RC" 0
|
|
213
|
+
check pm-template-legal-argv routing_identity_argv_check "$TMP/argv-jsonl" vendor pm:high - -
|
|
214
|
+
stop_fixture_seat pm
|
|
215
|
+
cp -p "$STATE/pm-launch.env" "$TMP/pm-fresh-control-record"
|
|
216
|
+
run config set TEAM_PM_RESUME_ARGS ' --continue' --yes
|
|
217
|
+
check pm-custom-resume-selector-config eq "$RC" 0
|
|
218
|
+
# Explicitly prepared trusted fixture metadata; this is not a claim about Pi
|
|
219
|
+
# history quality. The real launcher must still deliver the selected argv.
|
|
220
|
+
(TEAM_PM_MODEL=vendor/pm:high; TEAM_PM_RESUME_ARGS=--continue; TEAM_PM_FRESH_LAUNCH=0; team_pm_metadata_publish fixture-custom-continuation)
|
|
221
|
+
check pm-custom-known-record-prepared eq "$?" 0
|
|
222
|
+
cp -p "$STATE/pm-launch.env" "$TMP/pm-custom-control-record"
|
|
223
|
+
for tag in provider model positional-all positional-provider positional-model data-provider data-model; do
|
|
224
|
+
case "$tag" in
|
|
225
|
+
provider) bad='--model {model} {resume_args} {prompt}' ;;
|
|
226
|
+
model) bad='--provider {provider} {resume_args} {prompt}' ;;
|
|
227
|
+
positional-all) bad='{provider} {model} {resume_args} {prompt}' ;;
|
|
228
|
+
positional-provider) bad='{provider} --model {model} {resume_args} {prompt}' ;;
|
|
229
|
+
positional-model) bad='--provider {provider} {model} {resume_args} {prompt}' ;;
|
|
230
|
+
data-provider) bad='--label {provider} --model {model} {resume_args} {prompt}' ;;
|
|
231
|
+
data-model) bad='--provider {provider} -e {model} {resume_args} {prompt}' ;;
|
|
232
|
+
esac
|
|
233
|
+
run config set TEAM_PM_CMD "$TMP/recording-pi $bad" --yes
|
|
234
|
+
for mode in preview launch; do
|
|
235
|
+
snapshot="$(routing_observable_snapshot)"
|
|
236
|
+
check "binding-capture:pm-continued:$tag:$mode:before" routing_binding_capture pm-continued "$tag" "$mode" before
|
|
237
|
+
if [ "$mode" = preview ]; then run up --print; else run up; fi
|
|
238
|
+
check "pm-custom-missing-refused:$tag:$mode" eq "$RC" 1
|
|
239
|
+
check "pm-custom-missing-pure:$tag:$mode" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
240
|
+
check "binding-capture:pm-continued:$tag:$mode:after" routing_binding_capture pm-continued "$tag" "$mode" after
|
|
241
|
+
stop_fixture_seat pm
|
|
242
|
+
done
|
|
243
|
+
done
|
|
244
|
+
# Frozen seam explicitly keeps the lost-history branch: if {resume_args} is
|
|
245
|
+
# absent, report that it is not used, rather than pretending to continue.
|
|
246
|
+
run config set TEAM_PM_CMD "$TMP/recording-pi --provider {provider} --model {model} {prompt}" --yes
|
|
247
|
+
run up --print
|
|
248
|
+
check pm-custom-missing-resume-lost-preview eq "$RC" 0
|
|
249
|
+
run up
|
|
250
|
+
check pm-custom-missing-resume-lost-launch eq "$RC" 0
|
|
251
|
+
check pm-custom-missing-resume-honest contains "$OUT" '参数不会带上'
|
|
252
|
+
check pm-custom-missing-resume-no-continue-argv python3 -c 'import json,sys; a=json.loads(open(sys.argv[1]).readlines()[-1]); assert "--continue" not in a and "-c" not in a' "$TMP/argv-jsonl"
|
|
253
|
+
stop_fixture_seat pm
|
|
254
|
+
cp -p "$TMP/pm-custom-control-record" "$STATE/pm-launch.env"
|
|
255
|
+
run config set TEAM_PM_CMD "$good" --yes
|
|
256
|
+
run up --print
|
|
257
|
+
check pm-custom-known-continue-preview eq "$RC" 0
|
|
258
|
+
run up
|
|
259
|
+
check pm-custom-known-continue-launch eq "$RC" 0
|
|
260
|
+
check pm-custom-continue-argv routing_identity_argv_check "$TMP/argv-jsonl" vendor pm:high - --continue
|
|
261
|
+
stop_fixture_seat pm
|
|
262
|
+
# Same continuation with literal data and alternate supported selector forms.
|
|
263
|
+
for tag in separate equals short attached; do
|
|
264
|
+
cp -p "$TMP/pm-custom-control-record" "$STATE/pm-launch.env"
|
|
265
|
+
case "$tag" in
|
|
266
|
+
separate) good='--provider {provider} --model {model}' ;;
|
|
267
|
+
equals) good='--provider={provider} --model={model}' ;;
|
|
268
|
+
short) good='--provider {provider} -m {model}' ;;
|
|
269
|
+
attached) good='--provider={provider} -m{model}' ;;
|
|
270
|
+
esac
|
|
271
|
+
# --label is recording-CLI data with unknown production arity: keep it
|
|
272
|
+
# after every owned group instead of assuming a Pi-wide option table.
|
|
273
|
+
run config set TEAM_PM_CMD "$TMP/recording-pi -e 'pm:high' --skill literal $good {extra_args} {resume_args} {prompt} --label vendor" --yes
|
|
274
|
+
check "pm-bound-config:$tag" eq "$RC" 0
|
|
275
|
+
for mode in preview launch; do
|
|
276
|
+
snapshot="$(routing_observable_snapshot)"
|
|
277
|
+
if [ "$mode" = preview ]; then run up --print; else run up; fi
|
|
278
|
+
check "pm-bound-valid:$tag:$mode" eq "$RC" 0
|
|
279
|
+
if [ "$mode" = preview ]; then
|
|
280
|
+
check "pm-bound-preview-pure:$tag" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
281
|
+
else
|
|
282
|
+
check "pm-bound-exact-argv:$tag" routing_identity_argv_check "$TMP/argv-jsonl" vendor pm:high - --continue
|
|
283
|
+
check "pm-bound-continued-record:$tag" contains "$(team_pm_metadata_load && printf '%s' "$TEAM_PM_METADATA_JSON")" '"mode":"continued"'
|
|
284
|
+
stop_fixture_seat pm
|
|
285
|
+
fi
|
|
286
|
+
done
|
|
287
|
+
snapshot="$(routing_observable_snapshot)"
|
|
288
|
+
run up --fresh-pm --print
|
|
289
|
+
check "pm-bound-fresh-preview:$tag" eq "$RC" 0
|
|
290
|
+
check "pm-bound-fresh-preview-pure:$tag" eq "$(routing_observable_snapshot)" "$snapshot"
|
|
291
|
+
run up --fresh-pm
|
|
292
|
+
check "pm-bound-fresh-launch:$tag" eq "$RC" 0
|
|
293
|
+
check "pm-bound-fresh-exact-argv:$tag" routing_identity_argv_check "$TMP/argv-jsonl" vendor pm:high - -
|
|
294
|
+
check "pm-bound-fresh-record:$tag" contains "$(team_pm_metadata_load && printf '%s' "$TEAM_PM_METADATA_JSON")" '"mode":"fresh"'
|
|
295
|
+
stop_fixture_seat pm
|
|
296
|
+
done
|
|
297
|
+
run config set TEAM_PM_RESUME_ARGS '' --yes
|
|
298
|
+
cp -p "$TMP/pm-fresh-control-record" "$STATE/pm-launch.env"
|
|
299
|
+
run config set TEAM_PM_CMD '' --yes
|
|
300
|
+
run up --print
|
|
301
|
+
check pm-builtin-known-continue-preview eq "$RC" 0
|
|
302
|
+
run up
|
|
303
|
+
check pm-builtin-known-continue-launch eq "$RC" 0
|
|
304
|
+
check pm-builtin-continue-argv python3 -c 'import json,sys; a=json.loads(open(sys.argv[1]).readlines()[-1]); assert a[a.index("--model")+1]=="pm:high" and "-c" in a and any(x.startswith("@") for x in a)' "$TMP/argv-jsonl"
|
|
305
|
+
stop_fixture_seat pm
|
|
306
|
+
for bad in '--continue --session-id other' '--session-id' '--session-id=' '-s' '--resume history.jsonl --continue' '"--model=wrong"' '--provider=wrong' '-mwrong'; do
|
|
307
|
+
(TEAM_PM_FRESH_LAUNCH=1; TEAM_PM_RESUME_ARGS="$bad"; team_pm_identity_guard) > "$TMP/pm-resume-guard-${RANDOM}.log" 2>&1
|
|
308
|
+
check "pm-resume-ownership:$bad" eq "$?" 1
|
|
309
|
+
done
|
|
310
|
+
}
|
|
311
|
+
routing_pm_metadata_matrix() {
|
|
312
|
+
check pm-record-calendar-without-date bash --noprofile --norc -c '
|
|
313
|
+
source "$1"
|
|
314
|
+
date(){ return 91; }
|
|
315
|
+
for t in 2026-10-09T00:00:00Z 2024-02-29T23:59:59Z 2000-02-29T00:00:00Z; do team_launch_time_valid "$t" || exit 1; done
|
|
316
|
+
for t in 2026-02-30T00:00:00Z 1900-02-29T00:00:00Z 2026-13-01T00:00:00Z 2026-01-01T24:00:00Z 0000-01-01T00:00:00Z 2026-10-09Tgarbage; do
|
|
317
|
+
if team_launch_time_valid "$t"; then exit 1; fi
|
|
318
|
+
done
|
|
319
|
+
' _ "$SKILL/scripts/lib/common.sh"
|
|
320
|
+
local saved="$TMP/pm-metadata-original" tag before rc
|
|
321
|
+
cp "$STATE/pm-launch.env" "$saved"
|
|
322
|
+
for tag in nonce nul time invalid-date model project window version mode missing duplicate blank oversized; do
|
|
323
|
+
python3 - "$saved" "$STATE/pm-launch.env" "$tag" <<'PY'
|
|
324
|
+
import pathlib,sys
|
|
325
|
+
src,dest,tag=sys.argv[1:]; text=pathlib.Path(src).read_text()
|
|
326
|
+
r=dict(line.split('=',1) for line in text.splitlines())
|
|
327
|
+
faults={'nonce':('nonce','bad nonce'),'time':('time','2026-10-09Tgarbage'),
|
|
328
|
+
'invalid-date':('time','2026-02-30T00:00:00Z'),'model':('model','vendor//bad'),
|
|
329
|
+
'project':('project',r['project']+'/../repo'),'window':('window','wrong'),
|
|
330
|
+
'version':('metadata_version','2'),'mode':('mode','guess')}
|
|
331
|
+
if tag in faults: r[faults[tag][0]]=faults[tag][1]
|
|
332
|
+
if tag=='missing': del r['nonce']
|
|
333
|
+
text=''.join(k+'='+v+'\n' for k,v in r.items())
|
|
334
|
+
if tag=='nul': text=text.replace('nonce=', 'nonce=\0',1)
|
|
335
|
+
if tag=='duplicate': text+='nonce=other\n'
|
|
336
|
+
if tag=='blank': text+='\n'
|
|
337
|
+
if tag=='oversized': text+='padding='+'a'*65536+'\n'
|
|
338
|
+
pathlib.Path(dest).write_text(text)
|
|
339
|
+
PY
|
|
340
|
+
before="$(sha "$STATE/pm-launch.env")"; rc=0; team_pm_metadata_load || rc=$?
|
|
341
|
+
check "pm-metadata-rejected:$tag" eq "$rc" 1
|
|
342
|
+
rc=0; team_pm_identity_guard > "$TMP/pm-metadata-$tag.log" 2>&1 || rc=$?
|
|
343
|
+
check "pm-metadata-continue-refused:$tag" eq "$rc" 1
|
|
344
|
+
run config list --json
|
|
345
|
+
check "pm-metadata-machine-unavailable:$tag" python3 -c 'import json,sys; assert json.loads(sys.argv[1])["models"]["pm_launch"]=={}' "$OUT"
|
|
346
|
+
check "pm-metadata-read-only:$tag" eq "$(sha "$STATE/pm-launch.env")" "$before"
|
|
347
|
+
cp "$saved" "$STATE/pm-launch.env"
|
|
348
|
+
check "pm-metadata-restored:$tag" team_pm_metadata_load
|
|
349
|
+
check "pm-metadata-restored-continuation:$tag" team_pm_identity_guard
|
|
350
|
+
done
|
|
351
|
+
}
|
|
352
|
+
routing_reader_matrix() {
|
|
353
|
+
local saved="$TMP/reader-matrix-original" tag rc cols latest output before
|
|
354
|
+
cp "$STATE/dev.env" "$saved"
|
|
355
|
+
# A launch-size snapshot may be unknown or zero-padded; neither invalidates
|
|
356
|
+
# complete identity or changes which committed session the readers select.
|
|
357
|
+
for tag in '' 0005; do
|
|
358
|
+
python3 - "$saved" "$STATE/dev.env" "$tag" <<'PY'
|
|
359
|
+
import pathlib,sys
|
|
360
|
+
text=pathlib.Path(sys.argv[1]).read_text()
|
|
361
|
+
lines=[('sid_bytes='+sys.argv[3]) if x.startswith('sid_bytes=') else x for x in text.splitlines()]
|
|
362
|
+
pathlib.Path(sys.argv[2]).write_text('\n'.join(lines)+'\n')
|
|
363
|
+
PY
|
|
364
|
+
before="$(sha "$STATE/dev.env")"
|
|
365
|
+
check "reader-snapshot-valid:$tag" team_assignment_load dev
|
|
366
|
+
check "reader-snapshot-monitor:$tag" contains "$(node "$SKILL/scripts/monitor.mjs" --root "$REPO" --only dev --json)" recorded-A.jsonl
|
|
367
|
+
check "reader-snapshot-pure:$tag" eq "$(sha "$STATE/dev.env")" "$before"
|
|
368
|
+
cp "$saved" "$STATE/dev.env"
|
|
369
|
+
done
|
|
370
|
+
check reader-record-without-GNU-normalizers bash --noprofile --norc -c '
|
|
371
|
+
source "$1"; source "${1%/*}/cmd-config.sh"; TEAM_STATE_DIR="$2"
|
|
372
|
+
date(){ return 91; }; readlink(){ return 91; }
|
|
373
|
+
team_assignment_load dev && team_launch_path_valid / && team_launch_path_valid "$3/missing/leaf"
|
|
374
|
+
' _ "$SKILL/scripts/lib/common.sh" "$STATE" "$TMP"
|
|
375
|
+
local -a faults=(nonce sid seat window category empty-branch empty-task taskfile-relative worktree-relative taskfile-dot worktree-dot taskfile-link worktree-link started started-date model-colon model-empty model-segment model-space key duplicate blank version bytes origin via mode missing nul)
|
|
376
|
+
ln -s "$REPO/.worktrees/dev" "$TMP/reader-link-wt"
|
|
377
|
+
ln -s "$REPO/docs/team/tasks/T1-fixture.md" "$TMP/reader-link-brief"
|
|
378
|
+
for tag in "${faults[@]}"; do
|
|
379
|
+
python3 - "$saved" "$STATE/dev.env" "$tag" "$TMP" <<'PY'
|
|
380
|
+
import pathlib,sys
|
|
381
|
+
source,dest,tag,tmp=sys.argv[1:]; text=pathlib.Path(source).read_text()
|
|
382
|
+
r=dict(line.split('=',1) for line in text.splitlines()); bad={
|
|
383
|
+
'nonce':('launch_nonce','malformed nonce'), 'sid':('sid','bad sid'),
|
|
384
|
+
'seat':('seat','verify'), 'window':('window','verify'), 'category':('category','Bad/category'),
|
|
385
|
+
'empty-branch':('branch',''), 'empty-task':('task',''),
|
|
386
|
+
'taskfile-relative':('taskfile','relative.md'), 'worktree-relative':('worktree','relative'),
|
|
387
|
+
'taskfile-dot':('taskfile',r['taskfile'].replace('/tasks/','/tasks/../tasks/')),
|
|
388
|
+
'worktree-dot':('worktree',r['worktree']+'/../dev'),
|
|
389
|
+
'taskfile-link':('taskfile',tmp+'/reader-link-brief'), 'worktree-link':('worktree',tmp+'/reader-link-wt'),
|
|
390
|
+
'started':('started','2026-10-09Tgarbage'), 'started-date':('started','2026-02-30T00:00:00Z'),
|
|
391
|
+
'model-colon':('model','bad:provider/model'), 'model-empty':('model','vendor/:high'),
|
|
392
|
+
'model-segment':('model','vendor/deep//model'), 'model-space':('model','vendor/model bad'),
|
|
393
|
+
'bytes':('sid_bytes','NaN'), 'origin':('selected_via','guess'), 'via':('launch_via','guess'),
|
|
394
|
+
'mode':('mode','guess'), 'version':('assignment_version','2')}
|
|
395
|
+
if tag in bad: r[bad[tag][0]]=bad[tag][1]
|
|
396
|
+
if tag=='missing': del r['launch_nonce']
|
|
397
|
+
text=''.join(k+'='+v+'\n' for k,v in r.items())
|
|
398
|
+
if tag=='key': text+='bad-key=unknown\n'
|
|
399
|
+
if tag=='duplicate': text+='sid='+r['sid']+'\n'
|
|
400
|
+
if tag=='blank': text+='\n'
|
|
401
|
+
if tag=='nul': text=text.replace('fixture-nonce','fixture-\0nonce')
|
|
402
|
+
pathlib.Path(dest).write_text(text)
|
|
403
|
+
PY
|
|
404
|
+
before="$(sha "$STATE/dev.env")"; rc=0; team_assignment_load dev || rc=$?
|
|
405
|
+
check "reader-record-rejected:$tag" eq "$rc" 1
|
|
406
|
+
printf '%s rc=%s diagnostic=%s\n' "$tag" "$rc" "$TEAM_ASSIGN_DIAGNOSTIC" >> "$TMP/reader-matrix.log"
|
|
407
|
+
cols="$(team_agent_session_cols dev)"; latest="$(team_agent_session_latest dev || true)"
|
|
408
|
+
output="$(node "$SKILL/scripts/monitor.mjs" --root "$REPO" --only dev --json)"
|
|
409
|
+
printf '%s\n' "$output" > "$TMP/reader-monitor-$tag.json"
|
|
410
|
+
check "reader-size-unavailable:$tag" bash -c '! [[ "$1" == *recorded-A* || "$1" == *newer-B* ]]' _ "$cols"
|
|
411
|
+
check "reader-death-unavailable:$tag" eq "$latest" ''
|
|
412
|
+
check "reader-monitor-unavailable:$tag" contains "$output" 'committed SID unavailable'
|
|
413
|
+
run config list --json
|
|
414
|
+
check "reader-machine-unassigned:$tag" python3 -c 'import json,sys; d=json.loads(sys.argv[1]); r=next(r for r in d["models"]["assignments"] if r["agent"]=="dev"); assert not r["assigned"] and not r["sid"] and not r["model"] and r["diagnostic"]' "$OUT"
|
|
415
|
+
check "reader-record-unmodified:$tag" eq "$(sha "$STATE/dev.env")" "$before"
|
|
416
|
+
cp "$saved" "$STATE/dev.env"
|
|
417
|
+
check "reader-restored-record:$tag" team_assignment_load dev
|
|
418
|
+
check "reader-restored-monitor:$tag" contains "$(node "$SKILL/scripts/monitor.mjs" --root "$REPO" --only dev --json)" recorded-A.jsonl
|
|
419
|
+
done
|
|
420
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# F3: run real shell argv against files that turn an innocent-looking token into
|
|
3
|
+
# an owned selector. Only the routing front door's private repo/HOME/socket is used.
|
|
4
|
+
routing_expansion_probes() { # worker|pm
|
|
5
|
+
local seat="$1" field tag fragment mode before sid='' previous_map
|
|
6
|
+
previous_map="$(team_config_file_value "$CONFIG" TEAM_TASK_MODELS)"
|
|
7
|
+
run config set-task-model routine vendor/routine
|
|
8
|
+
check "$seat-expansion-category-ready" eq "$RC" 0
|
|
9
|
+
if [ "$seat" = worker ]; then
|
|
10
|
+
run config set TEAM_AGENT_CMD '' --yes
|
|
11
|
+
run dispatch dev T1 docs/team/tasks/T1-fixture.md --model vendor/deep/model:high --fresh
|
|
12
|
+
check expansion-assignment-ready eq "$RC" 0
|
|
13
|
+
team_assignment_load dev; sid="${TEAM_ASSIGN[sid]}"; stop_fixture_seat dev
|
|
14
|
+
else
|
|
15
|
+
# PM probes keep a private anchor alive; never use the shared session.
|
|
16
|
+
routing_fixture_tmux new-window -d -t routing-fixture -n expansion-anchor 'sleep 600'
|
|
17
|
+
stop_fixture_seat pm
|
|
18
|
+
fi
|
|
19
|
+
local root="$REPO" custom=""
|
|
20
|
+
[ "$seat" != worker ] || root="$REPO/.worktrees/dev"
|
|
21
|
+
local -a decoys=('--provider=other' '--model=wrong:low' '--session-id=other-history' '--continue' '--resume=other-history' '-mwrong' 'other-history.jsonl')
|
|
22
|
+
for fragment in "${decoys[@]}"; do printf 'identity decoy\n' > "$root/$fragment"; done
|
|
23
|
+
local -a faults=(
|
|
24
|
+
'provider-glob|--pro*' 'model-glob|--mod*' 'sid-glob|--sess*'
|
|
25
|
+
'continue-glob|--cont*' 'resume-glob|--resu*' 'short-class|-?[r]ong'
|
|
26
|
+
'session-file-glob|*.jsonl' 'provider-class|--[p]rovider*'
|
|
27
|
+
'mixed-quote|"--mod"*' 'brace|{--model=wrong:low,--no-tools}'
|
|
28
|
+
'tilde|~/routing-note' 'doublequote-escape|"two\\\\words"'
|
|
29
|
+
)
|
|
30
|
+
# Match an actual short selector too (the first pattern deliberately matches
|
|
31
|
+
# nothing but still has unprovable pathname semantics).
|
|
32
|
+
faults+=('short-glob|-m*')
|
|
33
|
+
for field in template extra; do
|
|
34
|
+
for fragment in "${faults[@]}"; do
|
|
35
|
+
tag="${fragment%%|*}"; fragment="${fragment#*|}"
|
|
36
|
+
if [ "$seat" = worker ]; then
|
|
37
|
+
run config set TEAM_EXTRA_PI_ARGS '' --yes
|
|
38
|
+
custom="$TMP/recording-pi --provider {provider} --model {model} --session-id {session_id}"
|
|
39
|
+
if [ "$field" = template ]; then
|
|
40
|
+
run config set TEAM_AGENT_CMD "$custom $fragment" --yes
|
|
41
|
+
else
|
|
42
|
+
run config set TEAM_AGENT_CMD '' --yes
|
|
43
|
+
run config set TEAM_EXTRA_PI_ARGS " $fragment" --yes
|
|
44
|
+
fi
|
|
45
|
+
else
|
|
46
|
+
run config set TEAM_PM_EXTRA_PI_ARGS '' --yes
|
|
47
|
+
custom="$TMP/recording-pi --provider {provider} --model {model} {resume_args} {prompt}"
|
|
48
|
+
if [ "$field" = template ]; then
|
|
49
|
+
run config set TEAM_PM_CMD "$custom $fragment" --yes
|
|
50
|
+
else
|
|
51
|
+
run config set TEAM_PM_CMD '' --yes
|
|
52
|
+
run config set TEAM_PM_EXTRA_PI_ARGS " $fragment" --yes
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
check "$seat-expansion-config:$field:$tag" eq "$RC" 0
|
|
56
|
+
for mode in preview launch; do
|
|
57
|
+
before="$(routing_observable_snapshot)"
|
|
58
|
+
if [ "$seat" = worker ]; then
|
|
59
|
+
if [ "$mode" = preview ]; then run dispatch dev T1 docs/team/tasks/T1-fixture.md --print; else run dispatch dev T1 docs/team/tasks/T1-fixture.md; fi
|
|
60
|
+
else
|
|
61
|
+
if [ "$mode" = preview ]; then run up --fresh-pm --print; else run up --fresh-pm; fi
|
|
62
|
+
fi
|
|
63
|
+
check "$seat-expansion-refused:$field:$tag:$mode" eq "$RC" 1
|
|
64
|
+
check "$seat-expansion-pure:$field:$tag:$mode" eq "$(routing_observable_snapshot)" "$before"
|
|
65
|
+
if [ "$seat" = worker ]; then stop_fixture_seat dev; else stop_fixture_seat pm; fi
|
|
66
|
+
done
|
|
67
|
+
done
|
|
68
|
+
done
|
|
69
|
+
# Quoted wildcard/brace/tilde text is literal data, not an expansion. Builtin
|
|
70
|
+
# PM must consume the lexer's tokens, not re-split the original quoted text.
|
|
71
|
+
local literal='--label "two words" "--mod*" "{safe,words}" "~/routing-note"'
|
|
72
|
+
literal+=" 'one\\two'"
|
|
73
|
+
for field in template extra; do
|
|
74
|
+
if [ "$seat" = worker ]; then
|
|
75
|
+
run config set TEAM_EXTRA_PI_ARGS '' --yes
|
|
76
|
+
custom="$TMP/recording-pi --provider {provider} --model {model} --session-id {session_id}"
|
|
77
|
+
if [ "$field" = template ]; then run config set TEAM_AGENT_CMD "$custom $literal" --yes
|
|
78
|
+
else run config set TEAM_AGENT_CMD '' --yes; run config set TEAM_EXTRA_PI_ARGS " $literal" --yes; fi
|
|
79
|
+
else
|
|
80
|
+
run config set TEAM_PM_EXTRA_PI_ARGS '' --yes
|
|
81
|
+
custom="$TMP/recording-pi --provider {provider} --model {model} {resume_args} {prompt}"
|
|
82
|
+
if [ "$field" = template ]; then run config set TEAM_PM_CMD "$custom $literal" --yes
|
|
83
|
+
else run config set TEAM_PM_CMD '' --yes; run config set TEAM_PM_EXTRA_PI_ARGS " $literal" --yes; fi
|
|
84
|
+
fi
|
|
85
|
+
check "$seat-expansion-literal-config:$field" eq "$RC" 0
|
|
86
|
+
before="$(routing_observable_snapshot)"
|
|
87
|
+
if [ "$seat" = worker ]; then run dispatch dev T1 docs/team/tasks/T1-fixture.md --print; else run up --fresh-pm --print; fi
|
|
88
|
+
check "$seat-expansion-literal-preview:$field" eq "$RC" 0
|
|
89
|
+
check "$seat-expansion-literal-preview-pure:$field" eq "$(routing_observable_snapshot)" "$before"
|
|
90
|
+
if [ "$seat" = worker ]; then run dispatch dev T1 docs/team/tasks/T1-fixture.md; else run up --fresh-pm; fi
|
|
91
|
+
check "$seat-expansion-literal-launch:$field" eq "$RC" 0
|
|
92
|
+
check "$seat-expansion-literal-argv:$field" python3 - "$TMP/argv-jsonl" "$seat" "$sid" <<'PY'
|
|
93
|
+
import json,sys
|
|
94
|
+
argv=json.loads(open(sys.argv[1]).readlines()[-1])
|
|
95
|
+
assert argv[argv.index('--label')+1]=='two words',argv
|
|
96
|
+
assert all(x in argv for x in ['--mod*','{safe,words}','~/routing-note',r'one\two']),argv
|
|
97
|
+
assert '--model=wrong:low' not in argv and '--provider=other' not in argv,argv
|
|
98
|
+
assert argv.count('--model')==1 and argv.count('--provider')==1,argv
|
|
99
|
+
assert argv[argv.index('--provider')+1]=='vendor',argv
|
|
100
|
+
if sys.argv[2]=='worker':
|
|
101
|
+
assert argv[argv.index('--model')+1]=='deep/model:high' and argv[argv.index('--session-id')+1]==sys.argv[3],argv
|
|
102
|
+
else:
|
|
103
|
+
assert argv[argv.index('--model')+1]=='pm:high' and '-c' not in argv and '--continue' not in argv,argv
|
|
104
|
+
PY
|
|
105
|
+
if [ "$seat" = worker ]; then stop_fixture_seat dev; else stop_fixture_seat pm; fi
|
|
106
|
+
done
|
|
107
|
+
if [ "$seat" = pm ]; then routing_pm_resume_expansion_probes; fi
|
|
108
|
+
for fragment in "${decoys[@]}"; do rm -- "$root/$fragment"; done
|
|
109
|
+
if [ "$seat" = worker ]; then
|
|
110
|
+
run config set TEAM_AGENT_CMD '' --yes; run config set TEAM_EXTRA_PI_ARGS '' --yes
|
|
111
|
+
else
|
|
112
|
+
run config set TEAM_PM_CMD '' --yes; run config set TEAM_PM_EXTRA_PI_ARGS '' --yes
|
|
113
|
+
fi
|
|
114
|
+
run config set TEAM_TASK_MODELS "$previous_map" --yes
|
|
115
|
+
check "$seat-expansion-policy-restored" eq "$RC" 0
|
|
116
|
+
}
|
|
117
|
+
routing_pm_resume_expansion_probes() {
|
|
118
|
+
local field fragment mode before saved="$TMP/pm-expansion-saved-record"
|
|
119
|
+
cp -p "$STATE/pm-launch.env" "$saved"
|
|
120
|
+
for field in builtin custom; do
|
|
121
|
+
if [ "$field" = builtin ]; then run config set TEAM_PM_CMD '' --yes
|
|
122
|
+
else run config set TEAM_PM_CMD "$TMP/recording-pi --provider {provider} --model {model} {resume_args} {prompt}" --yes; fi
|
|
123
|
+
run config set TEAM_PM_EXTRA_PI_ARGS '' --yes
|
|
124
|
+
for fragment in '--mod*' '--pro*' '--sess*' '--cont*' '--resu*' '{--model=wrong:low,--continue}' '--session-id ~'; do
|
|
125
|
+
run config set TEAM_PM_RESUME_ARGS " $fragment" --yes
|
|
126
|
+
check "pm-resume-expansion-config:$field:$fragment" eq "$RC" 0
|
|
127
|
+
# Controlled same-key metadata makes this a real continuation test, not a
|
|
128
|
+
# fresh-pm call that discards resume_args before it can reach the shell.
|
|
129
|
+
(TEAM_PM_FRESH_LAUNCH=0; TEAM_PM_RESUME_ARGS=" $fragment"; team_pm_metadata_publish fixture-resume-expansion)
|
|
130
|
+
check "pm-resume-expansion-record:$field:$fragment" eq "$?" 0
|
|
131
|
+
for mode in preview launch; do
|
|
132
|
+
before="$(routing_observable_snapshot)"
|
|
133
|
+
if [ "$mode" = preview ]; then run up --print; else run up; fi
|
|
134
|
+
check "pm-resume-expansion-refused:$field:$fragment:$mode" eq "$RC" 1
|
|
135
|
+
check "pm-resume-expansion-pure:$field:$fragment:$mode" eq "$(routing_observable_snapshot)" "$before"
|
|
136
|
+
stop_fixture_seat pm
|
|
137
|
+
done
|
|
138
|
+
done
|
|
139
|
+
fragment=" --session-id 'fixture-literal-session'"
|
|
140
|
+
run config set TEAM_PM_RESUME_ARGS "$fragment" --yes
|
|
141
|
+
check "pm-resume-literal-config:$field" eq "$RC" 0
|
|
142
|
+
(TEAM_PM_FRESH_LAUNCH=0; TEAM_PM_RESUME_ARGS="$fragment"; team_pm_metadata_publish fixture-resume-literal)
|
|
143
|
+
check "pm-resume-literal-record:$field" eq "$?" 0
|
|
144
|
+
before="$(routing_observable_snapshot)"
|
|
145
|
+
run up --print
|
|
146
|
+
check "pm-resume-literal-preview:$field" eq "$RC" 0
|
|
147
|
+
check "pm-resume-literal-preview-pure:$field" eq "$(routing_observable_snapshot)" "$before"
|
|
148
|
+
run up
|
|
149
|
+
check "pm-resume-literal-launch:$field" eq "$RC" 0
|
|
150
|
+
check "pm-resume-literal-argv:$field" python3 -c 'import json,sys; a=json.loads(open(sys.argv[1]).readlines()[-1]); assert a.count("--session-id")==1 and a[a.index("--session-id")+1]=="fixture-literal-session",a; assert a[a.index("--model")+1]=="pm:high",a' "$TMP/argv-jsonl"
|
|
151
|
+
stop_fixture_seat pm
|
|
152
|
+
done
|
|
153
|
+
run config set TEAM_PM_RESUME_ARGS '' --yes
|
|
154
|
+
cp -p "$saved" "$STATE/pm-launch.env"
|
|
155
|
+
}
|