mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-18 06:04:33 +01:00
Ubicloud pack no longer fails while git rewrites a ref, and the HOLD SCOPE eval stops requiring the mode name (#4447)
Packing a checkout for a Ubicloud run no longer fails when git running beside it is rewriting a ref, and the /plan-ceo-review HOLD SCOPE eval no longer fails a review whose follow-up question doesn't repeat the mode name. Why: both made tests fail at random. The pack race failed Free Tests twice on 2026-11-17, and the HOLD check failed the weekly eval census on main. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
f000b6e0e3
commit
b49ed6a0d9
5 files changed
+33
-3
No files matched your search
@@ -0,0 +1,2 @@
|
||||
- **Packing a checkout for a Ubicloud run no longer fails when git beside it is rewriting a ref.** `ubi-runner.sh pack` asked git's upload-pack for every ref, and upload-pack advertises a ref it cannot read (a loose ref file caught mid-write or mid-delete) with a null id, so the snapshot failed with "not our ref 0000…". Pack now reads the refs once with `git for-each-ref`, which skips an unreadable ref, and fetches those exact objects. Seen twice in Free Tests on 2026-11-17 (runs 44063454800 and 44050883970); an empty loose ref file reproduces it every time.
|
||||
- **The /plan-ceo-review HOLD SCOPE eval no longer fails a review because its follow-up question didn't repeat the mode name.** The check required the decision's "Project/branch/task" line to say "HOLD SCOPE", which the skill never asks for; the decision is already tied to the HOLD answer by session and order. A line naming another mode, or past or hypothetical work, still fails.
|
||||
@@ -1703,7 +1703,11 @@ cmd_pack() {
|
||||
trap "rm -rf $(printf %q "$tmp")" EXIT
|
||||
# No template hooks from a global init.templateDir, and no auto-gc under the tar.
|
||||
git -c gc.auto=0 init -q --bare --template= "$tmp/.git"
|
||||
git -C "$tmp/.git" -c gc.auto=0 fetch -q --no-tags --update-shallow "$src" '+refs/*:refs/*' \
|
||||
# Fetch the object ids one for-each-ref read, not upload-pack's own ref list: a ref that git running beside pack is
|
||||
# deleting is advertised with a null id that no fetch can want, while for-each-ref skips it as broken.
|
||||
git -C "$src" for-each-ref --format='+%(objectname):%(refname)' refs/ \
|
||||
| git -C "$tmp/.git" -c gc.auto=0 fetch -q --no-tags --update-shallow --stdin \
|
||||
--upload-pack='git -c uploadpack.allowAnySHA1InWant=true upload-pack' "$src" \
|
||||
|| die "pack: could not snapshot the refs of $src"
|
||||
if [ -z "$branch" ]; then
|
||||
branch="detached-${head:0:12}"
|
||||
|
||||
@@ -284,3 +284,13 @@ test('a decision whose grounding line names no plan file stays bound by the owne
|
||||
unread.publicTools=unread.publicTools.filter(e=>e.toolUseId!==sourceId);
|
||||
expect(()=>buildCeoHoldPostureReview(unread)).toThrow('complete original source Read/ACK');
|
||||
});
|
||||
|
||||
test('a decision whose grounding line does not restate the mode stays bound by its HOLD answer (census 43815320847 HOLD D4)',()=>{
|
||||
const line='Project/branch/task: main branch, PLAN.md saved project views; the repo contains only PLAN.md and CLAUDE.md.';
|
||||
const f=input();revise(f,q=>{q.question=q.question.replace(/Project\/branch\/task:[^\n]*/,line);});
|
||||
expect(buildCeoHoldPostureReview(f)!.plan).toBe(f.source.content);
|
||||
for(const other of ['SELECTIVE EXPANSION','SCOPE REDUCTION','previous']){
|
||||
const g=input();revise(g,q=>{q.question=q.question.replace(/Project\/branch\/task:[^\n]*/,line.replace('main branch,',`main branch, ${other} review,`));});
|
||||
expect(()=>buildCeoHoldPostureReview(g)).toThrow('decision is not current HOLD work');
|
||||
}
|
||||
});
|
||||
@@ -68,8 +68,9 @@ export function buildCeoHoldPostureReview(input: CeoHoldPostureReviewInput): Pla
|
||||
if (plans.length > 1 || (plans.length === 1 && plans[0] !== name && plans[0] !== source.path)) fail('native source context differs from original plan');
|
||||
}
|
||||
const decisionContext = /Project\/branch\/task:([^\n]*)/i.exec(decision.questions[0]!.question)?.[1] ?? '';
|
||||
if (!/\bHOLD SCOPE\b/.test(decisionContext) ||
|
||||
/\b(?:SCOPE EXPANSION|SELECTIVE EXPANSION|SCOPE REDUCTION|historical|previous|example|hypothetical|withdrawn)\b/i.test(decisionContext))
|
||||
// The decision is bound to the HOLD answer by session and chronology above; the skill never asks its grounding
|
||||
// line to restate the mode, so only a context naming another mode or past or hypothetical work disqualifies it.
|
||||
if (/\b(?:SCOPE EXPANSION|SELECTIVE EXPANSION|SCOPE REDUCTION|historical|previous|example|hypothetical|withdrawn)\b/i.test(decisionContext))
|
||||
fail('decision is not current HOLD work');
|
||||
const sourceLines = source.content.split('\n').length;
|
||||
const loaded = events.some(request => {
|
||||
|
||||
@@ -520,6 +520,19 @@ test('pack ships a linked worktree with a self-contained .git on the checked-out
|
||||
} finally { rmSync(d, { recursive: true, force: true }); }
|
||||
}, 90_000);
|
||||
|
||||
// Value: protects=pack snapshots a checkout while git beside it is mid-way through writing or deleting a ref (two Free Tests reds on 2026-11-17, runs 44063454800 and 44050883970, from the churn test above); fails_when=pack asks upload-pack for every ref, which advertises a ref it cannot read with a null id, and the fetch then fails "not our ref 0000…"; why_new=the churn test hits that window about once in 600 fetches, an empty loose ref file is the same state held still; seam=none
|
||||
test('pack skips a ref git cannot read (an empty loose ref file) and still ships every readable ref', () => {
|
||||
const d = mkdtempSync(join(tmpdir(), 'ubi-pack-broken-ref-'));
|
||||
try {
|
||||
const sh = (cmd: string, cwd: string) => { const r = Bun.spawnSync(['bash', '-c', cmd], { cwd, timeout: 30_000, env: { ...process.env, GIT_AUTHOR_NAME: 't', GIT_AUTHOR_EMAIL: 't@t', GIT_COMMITTER_NAME: 't', GIT_COMMITTER_EMAIL: 't@t' } }); expect(r.exitCode, `${cmd}\n${r.stderr.toString()}`).toBe(0); return r.stdout.toString(); };
|
||||
sh('git init -q -b main src && cd src && echo a > a && git add a && git commit -qm one && git tag -a v1 -m v1 && git branch side && : > .git/refs/heads/broken', d);
|
||||
sh(`mkdir vm && bash ${JSON.stringify(join(DIR, 'ubi-runner.sh'))} pack src | tar -xzf - -C vm`, d);
|
||||
const head = sh('git rev-parse HEAD', join(d, 'src')).trim();
|
||||
expect(sh('git for-each-ref --format="%(refname) %(objectname)" refs/heads && git rev-parse v1^{commit}', join(d, 'vm')).split('\n').filter(Boolean))
|
||||
.toEqual([`refs/heads/main ${head}`, `refs/heads/side ${head}`, head]);
|
||||
} finally { rmSync(d, { recursive: true, force: true }); }
|
||||
}, 60_000);
|
||||
|
||||
// Value: protects=pack never lets macOS tar add AppleDouble ._* entries (files with extended attributes), which the VM's tree check would count as untracked files and fail the run with UBI_VM_TREE_MISMATCH; fails_when=a tar call in pack runs without COPYFILE_DISABLE=1; why_new=only Apple's tar reads the variable, so no Linux run can see the ._* entries themselves; seam=PATH (a tar shim records its environment, then runs the real tar); no_claim=Apple tar's metadata behavior itself (checked by hand on a Mac)
|
||||
test('pack runs every tar with COPYFILE_DISABLE=1, for a checkout and for a plain directory', () => {
|
||||
const d = mkdtempSync(join(tmpdir(), 'ubi-pack-copyfile-'));
|
||||
|
||||
Reference in new issue
Block a user