Skip to content
Merged
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 .claude/agents/os-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ model: opus
- 认领带 `Resume-from: BRANCH@SHA` ⇒ 从 `origin/BRANCH` 建同名分支续写,先合 `origin/main`。
- ⛔ 永不编辑共享检出;修复横跨姊妹仓时一仓一 worktree。
- 动笔前记下基点 `BASE=$(git rev-parse HEAD)`,它是标准条款节里家族规则的锚。
- 建好分支后先推空分支(任何编辑前 `dev-worktree.sh --probe`):落地标记兼写路由探针。
- 先推空分支(任何编辑前 `dev-worktree.sh --branch=BRANCH --probe`):落地标记兼写路由探针。
- 卡线程分支由平台指定、harness 推送,⛔ 不推空分支;探针规则只对自建分支。
- 探针遇 403 ⇒ 停下报 `blocked`,⛔ 不进重试循环;只有网络错误才退避重试。
- Scratchpad 按 issue 隔离:在 scratchpad 目录下建 `issue-<n>/` 子目录,临时文件全写进去。
Expand Down
4 changes: 2 additions & 2 deletions scripts/pm/check-handover.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ export function inflightText(verdict, { repo, paths, read, reconcile = null }) {
? `check-handover --inflight: OVERLAP — ${verdict.overlaps.length} in-flight claim(s) on ${repo} meet the surface about to be dispatched.`
: verdict.exit === EXIT_SURFACE_UNREAD
? `check-handover --inflight: NO OVERLAP READ, ${verdict.unread.length} SURFACE(S) UNREAD — no readable in-flight surface on ${repo} meets this one; the cards below name no path, so read their claims by hand.`
: `check-handover --inflight: clear — no in-flight claim on ${repo} declares a surface that meets this one${verdict.notCompared?.length > 0 ? `; ${verdict.notCompared.length} claimed bare name(s) NOT COMPARED, listed below` : ''}. A claimed path fragment deeper inside a dispatched directory, and a claimed glob fragment, are never judged.`;
: `check-handover --inflight: clear — no in-flight claim on ${repo} declares a surface that meets this one${verdict.notCompared?.length > 0 ? `; ${verdict.notCompared.length} claimed bare name(s) NOT COMPARED, listed below` : ''}. A claimed path fragment deeper inside a dispatched directory, spelled DIR, DIR/** or DIR/**/GLOB alike, and a claimed glob fragment, are never judged.`;
const lines = [head, ` Dispatch surface: ${paths.map((p) => `\`${p}\``).join(', ')}.`];
verdict.overlaps.forEach((h, i) => {
const how = { path: '', name: ' (a bare file name on the claim, read anywhere)', suffix: ' (a path fragment on the claim, read as a suffix)' };
Expand Down Expand Up @@ -1609,7 +1609,7 @@ export function selfTest() {
t('inflight: N4 — a clear run NAMES the claimed bare names it could not judge against a directory or `DIR/**`; a `No changes outside …` clause is surface, not a fence', n4.exit === EXIT_OK && n4.notCompared.map((x) => x.claimed).join() === 'package.json' && inflightText(n4, { repo: 'o/r', paths: ['scripts/pm/**'], read: 'x' }).includes('1 claimed bare name(s) NOT COMPARED') && surfaceTokens('No changes outside `packages/lint/**`.').paths.join() === 'packages/lint/**');

t('inflight: ⭐ S5 — ONE directory, two spellings, one answer: a fragment that starts inside `DIR` meets `DIR` and `DIR/**` alike; a deeper fragment meets neither, and the clear line says so', meetKind('.claude/skills/pm-dispatch/references', 'references/contract-review.md') === 'suffix' && meetKind('.claude/skills/pm-dispatch/references/**', 'references/contract-review.md') === 'suffix' && meetKind('.claude/skills/pm-dispatch/references/**', 'lanes/director.md') === null && meetKind('.claude/skills/pm-dispatch/references', 'lanes/director.md') === null && inflightText(inflightVerdict({ paths: ['x/y.md'], held: [] }), { repo: 'o/r', paths: ['x/y.md'], read: 'x' }).includes('deeper inside a dispatched directory'));
t('inflight: ⭐ N12 — a glob under the directory a fragment starts inside answers as the bare `DIR/**` does: `references/**/*.md` meets `references/contract-review.md`, a remainder that does not match (`**/*.ts`) and a fragment that would sit deeper (`pm-dispatch/**/*.md`) do not', meetKind('.claude/skills/pm-dispatch/references/**/*.md', 'references/contract-review.md') === 'suffix' && meetKind('.claude/skills/pm-dispatch/references/**/*.md', 'references/lanes/director.md') === 'suffix' && meetKind('.claude/skills/pm-dispatch/references/**/*.ts', 'references/contract-review.md') === null && meetKind('.claude/skills/pm-dispatch/**/*.md', 'references/contract-review.md') === null && meetKind('.claude/skills/pm-dispatch/xreferences/**/*.md', 'references/contract-review.md') === null);
t('inflight: ⭐ N12 — a glob under the directory a fragment starts inside answers as the bare `DIR/**` does: `references/**/*.md` meets `references/contract-review.md`, a remainder that does not match (`**/*.ts`) and a fragment that would sit deeper (`pm-dispatch/**/*.md`) do not, and the clear line names that deeper case', meetKind('.claude/skills/pm-dispatch/references/**/*.md', 'references/contract-review.md') === 'suffix' && meetKind('.claude/skills/pm-dispatch/references/**/*.md', 'references/lanes/director.md') === 'suffix' && meetKind('.claude/skills/pm-dispatch/references/**/*.ts', 'references/contract-review.md') === null && meetKind('.claude/skills/pm-dispatch/**/*.md', 'references/contract-review.md') === null && meetKind('.claude/skills/pm-dispatch/xreferences/**/*.md', 'references/contract-review.md') === null && inflightText(inflightVerdict({ paths: ['x/y.md'], held: [] }), { repo: 'o/r', paths: ['x/y.md'], read: 'x' }).includes('deeper inside a dispatched directory, spelled DIR, DIR/** or DIR/**/GLOB alike'));
t('inflight: N8 — a single-segment dispatch directory (`scripts/`) lists a claimed bare name NOT COMPARED, like `scripts/pm/` and `scripts/**`', ['scripts/', 'scripts/pm/', 'scripts/**'].map((d) => inflightVerdict({ paths: [d], held: [{ issue: IF_CARD(), ...inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `card-pick.mjs`.')]) }] }).notCompared.length).join() === '1,1,1');

// The claim-surface card, PR A: the qualified key, each claim's width, and the reconciliation against its pull.
Expand Down
2 changes: 1 addition & 1 deletion scripts/pm/check-owed-reviews.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const EXIT_USAGE = 2;
export const DEFAULT_REPO = 'objectstack-ai/objectstack';
/** The waiting label the dispatching seat hangs at ACCEPT (`references/contract-review.md` 〈等 L2 标记〉). */
export const WAITING_LABEL = 'needs:contract-review';
/** One full round, trigger (b): `round-open.mjs`'s `ROUND_MINUTES`, the number on `seat-lifecycle.md`'s round line — one source, never a second copy. The name is kept: importers read it. */
/** One full round, trigger (b): `round-open.mjs`'s `ROUND_MINUTES`, the number on `seat-lifecycle.md`'s round line — one source, never a second copy. The name is kept because this file reads it (the trigger (b) docblock above, `owedReviewRow`); nothing imports it. */
export const TRIAGE_ROUND_MINUTES = ROUND_MINUTES;
/** The seat posts' label (`seat-post-protocol.md`); `parseSeat` reads each one. */
export const SEAT_LABEL = 'pm:seat';
Expand Down
2 changes: 1 addition & 1 deletion scripts/pm/check-skill-line-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const CEILINGS = new Map([
['.claude/skills/pm-dispatch/references/lanes/queue.md', 2003],
['.claude/skills/pm-dispatch/references/lanes/cloud.md', 1232],
['.claude/skills/pm-dispatch/references/lanes/objectstack.md', 2540], // raised 2270 → 2540 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053
['.claude/agents/os-dev.md', 33500], // lowered 33504 → 33500 by the #35237 slice-10 entry-pointers PR (the file's landed size, headroom 0); before that: lowered 38986 → 33504 by the entry-file slimming PR (four one-path blocks moved verbatim to references/dev-traps.md and references/dev-ablation.md, one pointer line left for each); before that: lowered 39008 → 38848 by the re-basing PR's own edit; raised 38848 → 38986 (+138) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): a card thread's first step reads the tier it is served and compares it with the order
['.claude/agents/os-dev.md', 33492], // lowered 33500 → 33492 by the #35237 slice-13 PR (rule 1's probe line spells its --branch; the file's landed size, headroom 0); before that: lowered 33504 → 33500 by the #35237 slice-10 entry-pointers PR (the file's landed size, headroom 0); before that: lowered 38986 → 33504 by the entry-file slimming PR (four one-path blocks moved verbatim to references/dev-traps.md and references/dev-ablation.md, one pointer line left for each); before that: lowered 39008 → 38848 by the re-basing PR's own edit; raised 38848 → 38986 (+138) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): a card thread's first step reads the tier it is served and compares it with the order
['.claude/skills/checklist-test/SKILL.md', 14209], // lowered 19558 → 14209 by the entry-file slimming PR (the bodies of §5 and §6 moved verbatim to the two reference files below, one pointer line left in each section)
['.claude/skills/checklist-test/references/closure.md', 4553], // new row, landed size, headroom 0
['.claude/skills/checklist-test/references/standing-regression.md', 1261], // new row, landed size, headroom 0
Expand Down
48 changes: 39 additions & 9 deletions scripts/pm/dev-worktree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,26 @@ refuse() {
# The two misreadings are not equal: a failure wrongly read as 403 stops one
# run early, and one wrongly read as network costs a bounded handful of pushes
# — neither is a loop, and anything this cannot place is `other`: stop.
# Every other 4xx status is `other` in each spelling git prints it — the bare
# line and `RPC failed; HTTP 401` alike, although the second carries the words
# of a transport failure: a client error does not change on a retry.
# Three 4xx statuses, and every 5xx, are the path failing rather than the push
# being judged, so they read `network`: 408 (the connection timed out before
# the request arrived whole), 421 (the request reached a connection that cannot
# answer for this host; a new connection can) and 429 (the path is throttled
# for now, and its remedy is the wait the backoff schedule already is). They
# are keyed exactly as the next arm is, ahead of it. Every other 4xx status is
# `other` in each spelling git prints it — the bare line and `RPC failed; HTTP
# 401` alike, although the second carries the words of a transport failure: a
# client error the server judged on the request does not change on a retry.
# ---------------------------------------------------------------------------
classify_push_failure() {
local out="$1"
if printf '%s\n' "$out" | grep -Eq '(error:|HTTP(/[0-9.]+)?|status|code|response)[ :]+403([^0-9]|$)|Permission to .+ denied'; then
printf '403\n'
return 0
fi
if printf '%s\n' "$out" | grep -Eq '(error:|HTTP(/[0-9.]+)?|status|code|response)[ :]+(408|421|429|5[0-9][0-9])([^0-9]|$)'; then
printf 'network\n'
return 0
fi
if printf '%s\n' "$out" | grep -Eq '(error:|HTTP(/[0-9.]+)?|status|code|response)[ :]+4[0-9][0-9]([^0-9]|$)'; then
printf 'other\n'
return 0
Expand Down Expand Up @@ -263,11 +273,17 @@ probe_push() {

# The second run that completes a tree built without --probe: this run's own
# flags, verbatim, plus `--probe --no-install` — the tree is already installed,
# or was left to you, so the second run repeats no install.
# or was left to you, so the second run repeats no install. A flag made only of
# characters no shell reads specially is printed as typed; any other is quoted
# with `printf %q`, which alone would print `--backoff=2,4` as `--backoff=2\,4`.
rerun_with_probe() {
local a line='bash scripts/pm/dev-worktree.sh'
for a in "${ORIG_ARGS[@]}"; do
[ "$a" = '--no-install' ] || line="$line $(printf '%q' "$a")"
[ "$a" = '--no-install' ] && continue
case "$a" in
'' | *[!A-Za-z0-9_./=:,@%+-]*) line="$line $(printf '%q' "$a")" ;;
*) line="$line $a" ;;
esac
done
printf '%s --probe --no-install' "$line"
}
Expand Down Expand Up @@ -450,11 +466,11 @@ mode_build() {
# name=minimum, one per line. A battery below its minimum means cases stopped
# running; the roster's own length is pinned too, so a deleted row cannot take
# its floor with it.
ST_BATTERIES='the probe failure classifier=14
ST_BATTERIES='the probe failure classifier=19
a fresh worktree=13
refusals before anything is created=13
resume from a claimed sha=11
the probe=20
the probe=21
re-run, scratchpad and install=14
what the script never spells=4'
ST_BATTERY_FLOOR=7
Expand Down Expand Up @@ -626,6 +642,16 @@ SHIM
"$(classify_push_failure 'error: RPC failed; HTTP 401 curl 22 The requested URL returned error: 401')|$(classify_push_failure 'error: RPC failed; HTTP/2 404')" 'other|other'
st_case 'OpenSSL'\''s "Connection was reset" and an HTTP/2 stream or framing error are network errors, retried like a reset by peer' \
"$(classify_push_failure 'fatal: unable to access: OpenSSL SSL_read: Connection was reset, errno 10054')|$(classify_push_failure "fatal: unable to access 'https://github.com/o/r/': HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)")|$(classify_push_failure "fatal: unable to access 'https://github.com/o/r/': Error in the HTTP2 framing layer")" 'network|network|network'
st_case '408 is the path failing, not the push judged: a request timeout is a network error in either spelling, retried on the schedule' \
"$(classify_push_failure 'error: RPC failed; HTTP 408 curl 22 The requested URL returned error: 408')|$(classify_push_failure "fatal: unable to access 'https://github.com/o/r/': The requested URL returned error: 408")" 'network|network'
st_case '429 is the path throttled for now: a network error, whose remedy is the wait the schedule already is' \
"$(classify_push_failure 'error: RPC failed; HTTP 429 curl 22 The requested URL returned error: 429')|$(classify_push_failure 'error: RPC failed; HTTP/2 429')" 'network|network'
st_case '421 is a connection that cannot answer for this host: a network error, which a new connection on the retry can clear' \
"$(classify_push_failure 'error: RPC failed; HTTP/2 421')|$(classify_push_failure "fatal: unable to access 'https://github.com/o/r/': The requested URL returned error: 421")" 'network|network'
st_case 'a proxy that answers the CONNECT with a 5xx is a network error: the 5xx statuses are keyed as the 4xx arm keys its own' \
"$(classify_push_failure "fatal: unable to access 'https://github.com/o/r/': Received HTTP code 502 from proxy after CONNECT")" network
st_case 'a number no status word keys, or one digit too long, is not a status: a 502-byte count, `code 4290`, an OpenSSL code' \
"$(classify_push_failure 'Writing objects: 100% (3/3), 502 bytes | 502.00 KiB/s, done.')|$(classify_push_failure 'remote: fatal: pack rejected (code 4290)')|$(classify_push_failure 'error:0A000126:SSL routines::unexpected eof while reading')" 'other|other|other'

# ── a fresh worktree ──────────────────────────────────────────────────────
st_battery 'a fresh worktree'
Expand Down Expand Up @@ -741,14 +767,18 @@ SHIM
# ── the probe ─────────────────────────────────────────────────────────────
st_battery 'the probe'
reset_shim
out="$(run "$dir/objectstack" --branch=claude/issue-30-noflag --no-install)"
out="$(run "$dir/objectstack" --branch=claude/issue-30-noflag --no-install --backoff=2,4)"
rc=$?
st_case '⛔ NO FLAG, the very spelling rule 1 prints (claude/issue-<n>-<slug>): the tree is built and NOTHING is pushed — zero pushes, origin has no such branch' \
"$rc|$(pushes)|$(field "$out" PROBE)|$(on_origin claude/issue-30-noflag)|$([ -d "$dir/objectstack-issue-30" ] && echo dir)" '0|0|skipped|absent|dir'
st_case '…the base is pinned all the same, and the line printed says what a self-built branch still owes' \
"$(field "$out" BASE)|$(grep -c 'run this command again with --probe' "$err")" "$main_sha|1"
st_case '…and that line spells the whole second run: this run'\''s flags, plus --probe --no-install, never a bare --probe' \
"$(grep -c -- 'run this command again with --probe: bash scripts/pm/dev-worktree.sh --branch=claude/issue-30-noflag --probe --no-install\.' "$err")" 1
"$(grep -c -- 'run this command again with --probe: bash scripts/pm/dev-worktree.sh --branch=claude/issue-30-noflag --backoff=2,4 --probe --no-install\.' "$err")" 1
out="$(ORIG_ARGS=(--branch=claude/issue-31-quoted '--scratchpad=/tmp/a b' --backoff=2,4 --no-install) && rerun_with_probe)"
st_case '…a flag is printed as typed when no character of it needs quoting (`--backoff=2,4`, never `2\,4`), quoted when one does, and the line pastes back to the very words typed' \
"$(printf '%s\n' "$out" | grep -c -- ' --backoff=2,4 ')|$(eval "set -- ${out#bash scripts/pm/dev-worktree.sh }" && printf '%s|' "$@")" \
'1|--branch=claude/issue-31-quoted|--scratchpad=/tmp/a b|--backoff=2,4|--probe|--no-install|'
reset_shim
out="$(run "$dir/objectstack" --branch=claude/issue-30-noflag --probe --no-install)"
st_case '…and the same command WITH --probe completes it: one push, the empty branch on origin, nothing re-created' \
Expand Down
12 changes: 10 additions & 2 deletions scripts/pm/git-history.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2231,10 +2231,18 @@ function selfTest() {
/ambiguous/.test(hexPrefixProblem(full, '0148abc', () => [c2, c38]) ?? '')
&& /not a commit/.test(hexPrefixProblem(full, '0148abc', () => [c2]) ?? '')
&& hexPrefixProblem(full, 'deadbeefdeadbeef') === null);
// Through the CLI: spawned from a directory that exists, asking about one that does not, so git's listing fails.
const unlistable = spawnSync(process.execPath, [self, 'ancestor', '--commit=deadbeefdeadbeef', `--cwd=${join(full, 'no-such-dir')}`], {
cwd: full,
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'pipe'],
});
t('⛔ a listing git could not give is NOT an empty one: a failed `rev-parse --disambiguate` (injected, and real — '
+ 'a cwd that does not exist) is a problem the CLI refuses as usage, never "absent"',
+ 'a cwd that does not exist) is a problem the CLI refuses as usage, exit 1 with empty stdout, never "absent"',
/could not be checked/.test(hexPrefixProblem(full, '0148abc', () => null) ?? '')
&& /could not be checked/.test(hexPrefixProblem(join(full, 'no-such-dir'), 'deadbeefdeadbeef') ?? ''));
&& /could not be checked/.test(hexPrefixProblem(join(full, 'no-such-dir'), 'deadbeefdeadbeef') ?? '')
&& unlistable.status === 1 && unlistable.stdout === '' && /could not be checked/.test(unlistable.stderr),
JSON.stringify({ status: unlistable.status, stdout: unlistable.stdout, stderr: unlistable.stderr }));
const usageText = spawnSync(process.execPath, [self, 'ancestor'], { encoding: 'utf8' });
t('the usage line says a proven no is proven against the ref AS LAST FETCHED, so "PROVEN" is not read as "fresh"',
usageText.status === 1 && /a no is proven against <ref> as last fetched/.test(usageText.stderr), JSON.stringify(usageText.stderr));
Expand Down
Loading