diff --git a/examples/babysitter/artifacts/babysitter-fixer.flow.ts b/examples/babysitter/artifacts/babysitter-fixer.flow.ts index 47c66b9b2..15c1bad60 100644 --- a/examples/babysitter/artifacts/babysitter-fixer.flow.ts +++ b/examples/babysitter/artifacts/babysitter-fixer.flow.ts @@ -706,6 +706,7 @@ async function checkoutHead(c) { const before = fingerprint(); rmSync(join(dir, ".git"), { recursive: true, force: true }); git("init", "-q"); + git("config", "core.fileMode", "false"); git("fetch", "-q", "--no-tags", "--depth=50", c.origin ?? `https://github.com/${c.owner}/${c.repo}.git`, c.head); git("reset", "-q", "--hard", c.head); git("clean", "-q", reused && fingerprint() !== before ? "-fdx" : "-fd"); @@ -765,7 +766,7 @@ async function proposeChanges(c) { const { copyFileSync, lstatSync, mkdtempSync, readdirSync, rmSync, utimesSync, writeFileSync } = await import("node:fs"); const { tmpdir } = await import("node:os"); const { resolve } = await import("node:path"); - const environment = { ...process.env, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: "/dev/null", GIT_CONFIG_COUNT: "2", GIT_CONFIG_KEY_0: "core.hooksPath", GIT_CONFIG_VALUE_0: "/dev/null", GIT_CONFIG_KEY_1: "core.quotePath", GIT_CONFIG_VALUE_1: "false" }; + const environment = { ...process.env, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: "/dev/null", GIT_CONFIG_COUNT: "3", GIT_CONFIG_KEY_0: "core.hooksPath", GIT_CONFIG_VALUE_0: "/dev/null", GIT_CONFIG_KEY_1: "core.quotePath", GIT_CONFIG_VALUE_1: "false", GIT_CONFIG_KEY_2: "core.fileMode", GIT_CONFIG_VALUE_2: "false" }; const checkoutGit = resolve(c.dir, ".git"); const scratch = mkdtempSync(`${tmpdir()}/babysitter-gitdir-`); try { diff --git a/examples/babysitter/artifacts/babysitter-fixer.manifest.json b/examples/babysitter/artifacts/babysitter-fixer.manifest.json index 4341531de..7f9fc503a 100644 --- a/examples/babysitter/artifacts/babysitter-fixer.manifest.json +++ b/examples/babysitter/artifacts/babysitter-fixer.manifest.json @@ -1,8 +1,8 @@ { "schemaVersion": 1, "artifact": "babysitter-fixer.flow.ts", - "bytes": 63346, - "sha256": "f107bcf907bb7f695fcdd2e21f23030a81a0ce5292dc0455374fddd5ac13f2cc", + "bytes": 63453, + "sha256": "fe9f2512421fdbeac327e360db078c2a33c2d3542590382807b75b65a666e4eb", "policy": "../standalone-policy.json", "policySha256": "e2fd08aaef4ea922146ad1330d7b7d7161f078f9c19e1499aa272636ae6e39a2", "runtime": { diff --git a/examples/babysitter/evidence/p2-task-modes/02-all-babysitter-green.txt b/examples/babysitter/evidence/p2-task-modes/02-all-babysitter-green.txt index 819a143c5..ece3a5d2e 100644 --- a/examples/babysitter/evidence/p2-task-modes/02-all-babysitter-green.txt +++ b/examples/babysitter/evidence/p2-task-modes/02-all-babysitter-green.txt @@ -3,193 +3,195 @@ $ (cd examples/babysitter && npm test) > test > node --experimental-strip-types --test tests/*.test.ts -✔ the committed fixer artifact is exact, reproducible, and asserts the enforced agent scope (99.84758ms) -✔ scripts stringified into f.run never reach a bundler shim: `node -e` has no __require (1.937431ms) -✔ the fixer checks out the bound head, runs one agent there with fix rules, and journals one proposal (6.859033ms) -✔ the fixer never writes to GitHub itself: no push, merge, review, or comment calls (1.64165ms) -✔ thread replies go only to inline feedback this run was woken by, once each, marked and neutralised (3.045546ms) -✔ a head that moves while fixing declines without a proposal (0.867867ms) -✔ a refused proposal ends needs_human (0.841879ms) -✔ by default the fixer dispatches no agent and checks nothing out (gate 8 / #442) (0.588186ms) -✔ the agent outcome is read from a JSON message, a fenced JSON block, or falls back to prose (0.359079ms) -✔ a real proposal covers edits, new files and the agent's own commits, all against the bound head (95.371327ms) -✔ workflow, secret, oversized and too-wide proposals are refused whole (439.104666ms) -✔ an untouched checkout proposes an empty patch (replies and summary may still publish) (54.24572ms) -✔ the proposal script runs as f.run runs it: a stringified `node -e` command in a shell (76.751995ms) -✔ the proposal script lifted from the shipped artifact runs under `node -e` (92.873201ms) -✔ the proposal never runs code the agent planted in the checkout's git config, and its diff format is fixed (67.186578ms) -✔ paths git would have to quote are refused; a newline cannot split a name past the workflow rule (159.073762ms) -✔ a non-ASCII name is proposed unquoted, so Cloud parses the same path (55.365176ms) -✔ the fixer runs the origin session's own CLI with its literal pinned model (1.527988ms) -✔ a PR checkout survives between runs: restored into the run root, stashed back after (1.900922ms) -✔ the fixer restores the cached checkout before checking out, and stashes it even when the agent fails (1.320521ms) -✔ restore and stash lifted from the shipped artifact run under `node -e` (47.477786ms) -✔ a reused checkout keeps its dependencies but none of the agent's git state, and lands exactly on the head (140.537795ms) -✔ a dependency manifest that changed between heads drops the cached dependencies (128.446921ms) -✔ a damaged cached .git is replaced, not reused (66.23266ms) -✔ cache moves never fail the run: an unwritable cache only means the next run starts fresh (0.881252ms) -✔ flows check still sees the fixer's agent requirement (0.277788ms) -✔ checkoutHead lifted from the shipped artifact runs under `node -e` (102.232464ms) -✔ a restored PR checkout brings back its session, and a stash records the new one (1.645547ms) -✔ a wake on a reused box resumes the previous agent session and records the new one (0.802435ms) -✔ a fresh box, or a session from another CLI, starts without resume (0.726514ms) -✔ a session the CLI no longer has falls back to a fresh agent with the origin context (0.958446ms) -✔ only registered direct-probe providers receive generated model pins (2.332326ms) -✔ provider executable basenames retain generated model defaults (1.092426ms) -✔ custom reviewer wrappers require and preserve an explicit model (0.528054ms) -✔ legacy reviewer binds slash-relative wrappers before probing and dispatch (0.138228ms) -✔ modern reviewer binds slash-relative wrappers before probing and dispatch (0.109925ms) -✔ legacy reviewer dispatches the same resolved wrapper to host-owned preflight (1.41161ms) -✔ legacy reviewer leaves provider basenames for host-owned preflight resolution (0.65477ms) -✔ blank legacy reviewer overrides fail before GitHub or repository effects (0.473192ms) -✔ approval-only legacy wakes do not probe an unused reviewer pair (1.336391ms) -✔ malformed input makes zero effects; missing live state declines before agents (0.898876ms) -✔ duplicate delivery cannot bypass missing publication or agent-scope capability (0.752512ms) -✔ live-head review/check wakes evaluate merge but do not simulate an unavailable receipt (1.353121ms) -✔ authorized conflict wakes hand off unresolved semantic work; ordinary/unauthorized comments decline (1.056329ms) -✔ merge transport sends the bound live SHA and fails if provider does not confirm (0.473763ms) -⚠ live-head end-to-end review and merge acceptance remains RED (2.003625ms) # Requires enforced agent scopes and durable fenced publication; the passing merge transport unit test is not end-to-end acceptance -✔ malformed external inputs fail before shell or API (1.423313ms) -✔ live skip and author rules fail closed (0.382653ms) -✔ READY rejects missing pending red conflicts stale heads and missing state (0.382022ms) -✔ a later comment or pending review cannot hide a standing verdict (0.35954ms) -✔ merge requires opt in org and configured independent approver at exact SHA (0.258442ms) -✔ conflict command is explicit authorized and same repository only (0.303306ms) -✔ edits fail closed for semantic changes, fork, protected paths, tests and unresolved conflicts (0.69782ms) -✔ artifacts are nonempty schema validated exact head and reconcile deterministically (0.984755ms) -✔ publication refuses stale post race newer verdict spoof and absent atomic capability (0.279842ms) -✔ once per head keys and sticky CI attribution survive duplicate wake decisions (0.239246ms) -✔ one bounded infra retry only for 137/143 (0.151052ms) -✔ every hosted subscription reaches the same authoritative reread with pinned coordinates (4.859567ms) -✔ hosted delivery fields cannot redirect policy, coordinates or live-head binding (1.442449ms) -✔ wrong repository, PR, host, provider or subscription refuse before the live read (1.780448ms) -✔ case-insensitive Cloud coordinates work and policy is snapshotted at construction (0.857859ms) -✔ normalized comment wake rereads then holds for missing original repair directive (0.920966ms) -✔ invalid operator policy is refused when the hosted source loads (0.925675ms) -✔ Cloud's enriched pull request is a hint, not state: draft, labels, author and review cannot decide (1.022436ms) -✔ a delivered approved review cannot open the merge gate (0.902171ms) -✔ the manifest declares exactly the subscription contract, family by family (2.39859ms) -✔ merge-gate is a live-state predicate: no matching PR is a pass, a held gate throws the reason (1.382867ms) -✔ the manifest budget is the flow header budget, and the entry name is the file the flow lives in (0.53113ms) -⚠ atomicPrPublication (2.008614ms) # Provider per-PR serialization + head-guarded idempotent owned-comment upsert -⚠ durableCrossRunNotification (0.403763ms) # Durable per-head notification receipt and atomic delivery claim -⚠ journaledCiObservation (0.325477ms) # Journal-backed script-memory write/recall across runs (memory.learn currently refuses) -⚠ enforcedAgentWriteScope (0.232323ms) # Enforced readonly agent workspace and credential scopes (gate 8 / #442) -⚠ selectiveAgentExitRetry (0.183943ms) # Typed agent exit-code/retry policy in authored Step; AgentResult has summary/artifacts and success/timeout completionReason -⚠ durableSubscriptionLiveness (0.15583ms) # Durable cross-run wake records for the liveness sweep; a subscription that stops firing is currently indistinguishable from a quiet one -✔ a failing commit status is a failing check; a newer success on the same context clears an older failure (2.680195ms) -✔ reviews are paginated before standing verdicts are derived (0.7348ms) -✔ a report older than any comment window is still found; only comments after the last report are returned (0.650232ms) -✔ a marker in someone else's comment is not a report (0.388664ms) -✔ a head that moves during the read refuses (0.508568ms) -✔ failing check runs at the head are failing checks; running, passing and other-head runs are not (0.367805ms) -✔ settleReport keeps the earliest report for a head and deletes a later duplicate of its own (0.431895ms) -✔ a PR full of long reviews, comments and failing checks still fits the journal and keeps every actor (1.928254ms) -✔ only a report for the current head counts, and report history never grows the payload (1.679339ms) -✔ when shortened text still overflows, the oldest comments go first at the 200-char floor (5.021108ms) -✔ inline review comments from the author, members and allowlisted review bots are feedback; outsiders, other bots and this bot are not (6.045006ms) -✔ a thread Babysitter already answered, an outdated comment, and feedback before its last report are not feedback (0.611249ms) -✔ a commented review body is feedback; an empty one, an outsider's, or a change request (already a verdict) is not (0.362726ms) -✔ review feedback is shortened and, past the floor, dropped oldest first so the read still fits the journal (7.768188ms) -✔ our own agent accounts are never feedback, and their thread replies answer the thread (0.361013ms) -✔ the Garden sharing Babysitter's app login does not look like Babysitter: only marked comments move the window or answer threads (0.48301ms) -✔ file-level review comments are feedback; a line comment GitHub marked outdated (no diff position) is not (0.318364ms) -✔ a pending review comment counts from its review's submission, and feedback at the report's own second is kept (0.304437ms) -✔ the committed standalone artifact is exact, reproducible, and explicitly read-only (94.138169ms) -✔ without originContext the run ends needs_human with zero f.agent calls and no live read (5.129419ms) -✔ with originContext the agent task carries the first prompt verbatim, delimited as the task definition (2.763631ms) -✔ two deliveries with different ids and the same live state log the same decision key (2.201192ms) -✔ anything that is not the bound PR is refused before any effect (2.756848ms) -✔ a missing or malformed server-claimed head fails closed before live state or diagnosis (0.467201ms) -✔ a live head different from the server-claimed head declines before signals, diagnosis or comment (0.413351ms) -✔ live state decides: closed, draft, missing babysit label or nothing actionable decline without an agent (0.763523ms) -✔ a change request or an authorised directive is actionable; an outsider directive is not (1.351179ms) -✔ a head already reported by Babysitter declines before the agent (0.352597ms) -✔ the reader is asked for this bot's reports at the bound head (0.613193ms) -✔ withdrawing the opt-in label during diagnosis stops the report (0.441843ms) -✔ a push racing the comment marks the posted report superseded for the new head (0.630485ms) -✔ a head that moves while the agent runs declines instead of reporting on a stale head (0.356855ms) -✔ report is one owned PR comment naming the inherited session, never the prompt text, with mentions neutralised (0.650102ms) -✔ the agent CLI follows the origin session: Claude and Codex both work (1.515033ms) -✔ by default no agent is dispatched: untrusted PR content needs enforced write scope first (gate 8 / #442) (0.463975ms) -✔ invalid policy is refused when the source loads (0.530699ms) -✔ withdrawing the opt-in label while the comment posts marks the report withdrawn (0.523485ms) -✔ the agent echoing the original prompt does not publish it (0.391971ms) -✔ a concurrent run that already reported this head wins: the later comment removes itself (0.693221ms) -✔ unanswered review feedback alone is actionable and reaches the agent with its location (0.612101ms) -✔ the reader is told the live PR author and the policy's review bots (0.436514ms) -✔ review bots must be a list of [bot] logins (0.220992ms) -✔ Software Garden PRs (same-repo relayflow/* heads) are in scope by default; any other PR needs the opt-in label (0.581294ms) -✔ a Software Garden draft is babysat (Garden drafts failing PRs); a label opt-in draft is not (0.441142ms) -✔ an @babysitter directive from one of our own agents is not a directive (0.253382ms) -✔ file-level review feedback renders its path without a line (0.320718ms) -✔ a task is parsed strictly: exact keys, bounded values, a full trunk sha (2.878565ms) -✔ a malformed task stops the run before any live read or agent (1.559867ms) -✔ a task run is admitted only from a merge-train event for the bound PR, and a merge-train event never runs without a task (1.517378ms) -✔ fix_ci admits a merge-train PR with no review feedback and no opt-in label, and gives the agent the failing checks (2.685405ms) -✔ answer_threads addresses only the requested threads and replies only to them (2.238011ms) -✔ answer_threads declines without an agent when the requested threads are no longer open (0.626017ms) -✔ a task run still declines a closed or merged PR, and one whose head moved (0.827392ms) -✔ resolve_conflict merges trunk before the agent and proposes with trunk as the merge parent (1.028918ms) -✔ resolve_conflict stops without an agent when drizzle metadata conflicts, and still stashes the checkout (0.535869ms) -✔ a merge too large to publish ends needs_human with an explanation instead of a patch (0.680879ms) -✔ proposes from a checkout whose .git the sandbox left unwritable, touching nothing in it (196.505073ms) -✔ proposes from a checkout whose index the agent split (200.969524ms) -✔ a FIFO, directory or symlink named like a shared index in .git is not copied (189.485011ms) -✔ a proposal whose private git dir cannot be set up leaves no scratch behind (174.443197ms) -✔ the merge step leaves the conflicts for the agent and names any in drizzle metadata (206.21481ms) -✔ a resolved merge proposes schema 2: trunk as merge parent, patch from the head to the merged tree (247.615961ms) -✔ a merge that changes trunk outside the PR's own files, or leaves conflict markers, is refused (488.826014ms) -✔ a resolved merge over the patch cap publishes no code and says why (238.363397ms) -✔ an agent change to drizzle metadata is refused for every proposal (173.663142ms) -✔ answer_threads acts on a still-open reply in a requested thread, matched by its root (1.338274ms) -✔ answer_threads ends needs_human, with no proposal, when a requested thread gets no reply (0.607512ms) -✔ check names never reach the trusted task section, and control characters in them are refused (0.520751ms) -✔ the merge step refuses when git does not start the merge, instead of reporting a clean merge (228.459678ms) -✔ an unpublished merge keeps its summary within the summary limit, explanation included (217.148637ms) -✔ an unresolved binary conflict is refused rather than published as the PR side (207.246813ms) -✔ an index the agent moved behind a symlink, or deleted, refuses instead of hiding the conflict (394.992511ms) -✔ a marker-less conflict on a text file (merge=binary) is refused too, not only NUL-bearing files (205.200299ms) -✔ a conflict blob too large to read is refused, not a crashed run (211.443765ms) -✔ a merge patch too large to even read publishes no code instead of failing the run (245.724936ms) -✔ the declared subscription contract is exactly the required resident set (1.145866ms) -✔ every declared subscription registers one handler bound to the one body (0.281755ms) -✔ each trigger filters to its own provider, type and action (0.340966ms) -✔ compatibility entry points still resolve to this one implementation (0.359049ms) -✔ subscription preflight passes the declared contract and has teeth (0.304147ms) -✔ preflight refuses an undeliverable subscription rather than deploying it (0.173714ms) -✔ a delivery is accepted as a hint; only routing is enforced (1.028507ms) -✔ a fork check_run with no PR attribution still wakes and rereads (0.795984ms) -✔ repository routing compares owner and repository case-insensitively (0.192619ms) -✔ a stale hinted head is recorded, never enforced, and never binds (0.166851ms) -✔ an operator pin constrains the run; it never substitutes for live state (0.15539ms) -✔ every wake rereads live state before it decides anything (0.706066ms) -✔ a payload that disagrees with live state loses: closed hint, open PR (0.159878ms) -✔ a payload that disagrees with live state loses: open hint, closed PR (0.128379ms) -✔ a label hint is re-read from live state in both directions (0.139751ms) -✔ a review hint cannot assert an approval live state does not show (0.181307ms) -✔ a check hint cannot assert a conclusion live state does not show (0.105927ms) -✔ duplicate delivery repeats a decision instead of adding one (0.273329ms) -✔ out-of-order delivery decides about the head that exists now (0.141934ms) -✔ the decision key names the subscription and the live head, never the hint (0.100027ms) -✔ each wake emits one deterministic observation line (0.219278ms) -✔ the sweep separates a quiet subscription from a dead one (0.304548ms) -✔ a young subscription is pending, an old silent one is never (0.157253ms) -✔ the sweep refuses impossible windows and clock-faulted records (0.179554ms) -✔ the sweep expects exactly the subscriptions the flow registers (0.048721ms) -ℹ tests 174 +✔ the committed fixer artifact is exact, reproducible, and asserts the enforced agent scope (105.549933ms) +✔ scripts stringified into f.run never reach a bundler shim: `node -e` has no __require (1.427449ms) +✔ the fixer checks out the bound head, runs one agent there with fix rules, and journals one proposal (3.688861ms) +✔ the fixer never writes to GitHub itself: no push, merge, review, or comment calls (0.992809ms) +✔ thread replies go only to inline feedback this run was woken by, once each, marked and neutralised (3.139658ms) +✔ a head that moves while fixing declines without a proposal (1.104608ms) +✔ a refused proposal ends needs_human (1.255108ms) +✔ by default the fixer dispatches no agent and checks nothing out (gate 8 / #442) (0.795411ms) +✔ the agent outcome is read from a JSON message, a fenced JSON block, or falls back to prose (0.407328ms) +✔ a real proposal covers edits, new files and the agent's own commits, all against the bound head (117.618892ms) +✔ workflow, secret, oversized and too-wide proposals are refused whole (419.348031ms) +✔ an untouched checkout proposes an empty patch (replies and summary may still publish) (53.224825ms) +✔ the proposal script runs as f.run runs it: a stringified `node -e` command in a shell (88.06163ms) +✔ the proposal script lifted from the shipped artifact runs under `node -e` (76.217069ms) +✔ the proposal never runs code the agent planted in the checkout's git config, and its diff format is fixed (60.476651ms) +✔ paths git would have to quote are refused; a newline cannot split a name past the workflow rule (147.5281ms) +✔ a non-ASCII name is proposed unquoted, so Cloud parses the same path (54.644419ms) +✔ the fixer runs the origin session's own CLI with its literal pinned model (1.226594ms) +✔ a PR checkout survives between runs: restored into the run root, stashed back after (1.812426ms) +✔ the fixer restores the cached checkout before checking out, and stashes it even when the agent fails (1.219341ms) +✔ restore and stash lifted from the shipped artifact run under `node -e` (59.204632ms) +✔ a checkout whose filesystem dropped executable bits reads as clean (111.223991ms) +✔ a reused checkout keeps its dependencies but none of the agent's git state, and lands exactly on the head (137.049072ms) +✔ a dependency manifest that changed between heads drops the cached dependencies (129.299067ms) +✔ a damaged cached .git is replaced, not reused (65.495259ms) +✔ cache moves never fail the run: an unwritable cache only means the next run starts fresh (0.959126ms) +✔ flows check still sees the fixer's agent requirement (0.346446ms) +✔ checkoutHead lifted from the shipped artifact runs under `node -e` (102.460729ms) +✔ a restored PR checkout brings back its session, and a stash records the new one (1.588529ms) +✔ a wake on a reused box resumes the previous agent session and records the new one (0.972922ms) +✔ a fresh box, or a session from another CLI, starts without resume (0.931134ms) +✔ a session the CLI no longer has falls back to a fresh agent with the origin context (0.645352ms) +✔ only registered direct-probe providers receive generated model pins (1.744038ms) +✔ provider executable basenames retain generated model defaults (0.830146ms) +✔ custom reviewer wrappers require and preserve an explicit model (0.559903ms) +✔ legacy reviewer binds slash-relative wrappers before probing and dispatch (0.143447ms) +✔ modern reviewer binds slash-relative wrappers before probing and dispatch (0.146743ms) +✔ legacy reviewer dispatches the same resolved wrapper to host-owned preflight (1.780136ms) +✔ legacy reviewer leaves provider basenames for host-owned preflight resolution (0.40293ms) +✔ blank legacy reviewer overrides fail before GitHub or repository effects (0.179514ms) +✔ approval-only legacy wakes do not probe an unused reviewer pair (0.570423ms) +✔ malformed input makes zero effects; missing live state declines before agents (0.453996ms) +✔ duplicate delivery cannot bypass missing publication or agent-scope capability (0.341987ms) +✔ live-head review/check wakes evaluate merge but do not simulate an unavailable receipt (0.642005ms) +✔ authorized conflict wakes hand off unresolved semantic work; ordinary/unauthorized comments decline (0.429199ms) +✔ merge transport sends the bound live SHA and fails if provider does not confirm (0.176739ms) +⚠ live-head end-to-end review and merge acceptance remains RED (0.920895ms) # Requires enforced agent scopes and durable fenced publication; the passing merge transport unit test is not end-to-end acceptance +✔ malformed external inputs fail before shell or API (1.305732ms) +✔ live skip and author rules fail closed (0.368246ms) +✔ READY rejects missing pending red conflicts stale heads and missing state (0.401438ms) +✔ a later comment or pending review cannot hide a standing verdict (0.345754ms) +✔ merge requires opt in org and configured independent approver at exact SHA (0.266957ms) +✔ conflict command is explicit authorized and same repository only (0.344792ms) +✔ edits fail closed for semantic changes, fork, protected paths, tests and unresolved conflicts (0.74603ms) +✔ artifacts are nonempty schema validated exact head and reconcile deterministically (0.914454ms) +✔ publication refuses stale post race newer verdict spoof and absent atomic capability (0.251097ms) +✔ once per head keys and sticky CI attribution survive duplicate wake decisions (0.374548ms) +✔ one bounded infra retry only for 137/143 (0.181147ms) +✔ every hosted subscription reaches the same authoritative reread with pinned coordinates (4.366793ms) +✔ hosted delivery fields cannot redirect policy, coordinates or live-head binding (3.76888ms) +✔ wrong repository, PR, host, provider or subscription refuse before the live read (0.822492ms) +✔ case-insensitive Cloud coordinates work and policy is snapshotted at construction (0.411276ms) +✔ normalized comment wake rereads then holds for missing original repair directive (0.447563ms) +✔ invalid operator policy is refused when the hosted source loads (0.578378ms) +✔ Cloud's enriched pull request is a hint, not state: draft, labels, author and review cannot decide (0.551878ms) +✔ a delivered approved review cannot open the merge gate (0.41327ms) +✔ the manifest declares exactly the subscription contract, family by family (2.008871ms) +✔ merge-gate is a live-state predicate: no matching PR is a pass, a held gate throws the reason (0.940512ms) +✔ the manifest budget is the flow header budget, and the entry name is the file the flow lives in (0.418991ms) +⚠ atomicPrPublication (2.076788ms) # Provider per-PR serialization + head-guarded idempotent owned-comment upsert +⚠ durableCrossRunNotification (0.393223ms) # Durable per-head notification receipt and atomic delivery claim +⚠ journaledCiObservation (0.27428ms) # Journal-backed script-memory write/recall across runs (memory.learn currently refuses) +⚠ enforcedAgentWriteScope (0.151763ms) # Enforced readonly agent workspace and credential scopes (gate 8 / #442) +⚠ selectiveAgentExitRetry (0.146353ms) # Typed agent exit-code/retry policy in authored Step; AgentResult has summary/artifacts and success/timeout completionReason +⚠ durableSubscriptionLiveness (0.097001ms) # Durable cross-run wake records for the liveness sweep; a subscription that stops firing is currently indistinguishable from a quiet one +✔ a failing commit status is a failing check; a newer success on the same context clears an older failure (3.840754ms) +✔ reviews are paginated before standing verdicts are derived (1.350826ms) +✔ a report older than any comment window is still found; only comments after the last report are returned (1.219431ms) +✔ a marker in someone else's comment is not a report (0.760216ms) +✔ a head that moves during the read refuses (1.144441ms) +✔ failing check runs at the head are failing checks; running, passing and other-head runs are not (0.975356ms) +✔ settleReport keeps the earliest report for a head and deletes a later duplicate of its own (0.852839ms) +✔ a PR full of long reviews, comments and failing checks still fits the journal and keeps every actor (3.600767ms) +✔ only a report for the current head counts, and report history never grows the payload (4.366282ms) +✔ when shortened text still overflows, the oldest comments go first at the 200-char floor (7.313752ms) +✔ inline review comments from the author, members and allowlisted review bots are feedback; outsiders, other bots and this bot are not (8.773211ms) +✔ a thread Babysitter already answered, an outdated comment, and feedback before its last report are not feedback (0.649309ms) +✔ a commented review body is feedback; an empty one, an outsider's, or a change request (already a verdict) is not (0.766728ms) +✔ review feedback is shortened and, past the floor, dropped oldest first so the read still fits the journal (7.240716ms) +✔ our own agent accounts are never feedback, and their thread replies answer the thread (0.453815ms) +✔ the Garden sharing Babysitter's app login does not look like Babysitter: only marked comments move the window or answer threads (0.609035ms) +✔ file-level review comments are feedback; a line comment GitHub marked outdated (no diff position) is not (0.575853ms) +✔ a pending review comment counts from its review's submission, and feedback at the report's own second is kept (0.570702ms) +✔ the committed standalone artifact is exact, reproducible, and explicitly read-only (90.816801ms) +✔ without originContext the run ends needs_human with zero f.agent calls and no live read (5.039286ms) +✔ with originContext the agent task carries the first prompt verbatim, delimited as the task definition (2.455874ms) +✔ two deliveries with different ids and the same live state log the same decision key (1.684087ms) +✔ anything that is not the bound PR is refused before any effect (2.431478ms) +✔ a missing or malformed server-claimed head fails closed before live state or diagnosis (0.615427ms) +✔ a live head different from the server-claimed head declines before signals, diagnosis or comment (0.55257ms) +✔ live state decides: closed, draft, missing babysit label or nothing actionable decline without an agent (0.997458ms) +✔ a change request or an authorised directive is actionable; an outsider directive is not (2.106524ms) +✔ a head already reported by Babysitter declines before the agent (0.664638ms) +✔ the reader is asked for this bot's reports at the bound head (0.81649ms) +✔ withdrawing the opt-in label during diagnosis stops the report (0.540016ms) +✔ a push racing the comment marks the posted report superseded for the new head (0.631386ms) +✔ a head that moves while the agent runs declines instead of reporting on a stale head (0.356273ms) +✔ report is one owned PR comment naming the inherited session, never the prompt text, with mentions neutralised (0.777358ms) +✔ the agent CLI follows the origin session: Claude and Codex both work (2.595685ms) +✔ by default no agent is dispatched: untrusted PR content needs enforced write scope first (gate 8 / #442) (0.418209ms) +✔ invalid policy is refused when the source loads (0.33837ms) +✔ withdrawing the opt-in label while the comment posts marks the report withdrawn (0.382402ms) +✔ the agent echoing the original prompt does not publish it (0.278268ms) +✔ a concurrent run that already reported this head wins: the later comment removes itself (0.304447ms) +✔ unanswered review feedback alone is actionable and reaches the agent with its location (0.39733ms) +✔ the reader is told the live PR author and the policy's review bots (0.346826ms) +✔ review bots must be a list of [bot] logins (0.160159ms) +✔ Software Garden PRs (same-repo relayflow/* heads) are in scope by default; any other PR needs the opt-in label (0.374918ms) +✔ a Software Garden draft is babysat (Garden drafts failing PRs); a label opt-in draft is not (0.25751ms) +✔ an @babysitter directive from one of our own agents is not a directive (0.189954ms) +✔ file-level review feedback renders its path without a line (0.228887ms) +✔ a task is parsed strictly: exact keys, bounded values, a full trunk sha (2.175883ms) +✔ a malformed task stops the run before any live read or agent (1.569643ms) +✔ a task run is admitted only from a merge-train event for the bound PR, and a merge-train event never runs without a task (1.338133ms) +✔ fix_ci admits a merge-train PR with no review feedback and no opt-in label, and gives the agent the failing checks (2.026425ms) +✔ answer_threads addresses only the requested threads and replies only to them (2.111774ms) +✔ answer_threads declines without an agent when the requested threads are no longer open (0.463473ms) +✔ a task run still declines a closed or merged PR, and one whose head moved (0.678574ms) +✔ resolve_conflict merges trunk before the agent and proposes with trunk as the merge parent (0.83216ms) +✔ resolve_conflict stops without an agent when drizzle metadata conflicts, and still stashes the checkout (0.496013ms) +✔ a merge too large to publish ends needs_human with an explanation instead of a patch (0.669396ms) +✔ a checkout whose filesystem dropped executable bits proposes only the real edits (184.381421ms) +✔ proposes from a checkout whose .git the sandbox left unwritable, touching nothing in it (193.67442ms) +✔ proposes from a checkout whose index the agent split (192.472671ms) +✔ a FIFO, directory or symlink named like a shared index in .git is not copied (185.984898ms) +✔ a proposal whose private git dir cannot be set up leaves no scratch behind (165.101301ms) +✔ the merge step leaves the conflicts for the agent and names any in drizzle metadata (201.321252ms) +✔ a resolved merge proposes schema 2: trunk as merge parent, patch from the head to the merged tree (229.511398ms) +✔ a merge that changes trunk outside the PR's own files, or leaves conflict markers, is refused (468.43648ms) +✔ a resolved merge over the patch cap publishes no code and says why (262.061625ms) +✔ an agent change to drizzle metadata is refused for every proposal (212.604758ms) +✔ answer_threads acts on a still-open reply in a requested thread, matched by its root (0.842599ms) +✔ answer_threads ends needs_human, with no proposal, when a requested thread gets no reply (0.633881ms) +✔ check names never reach the trusted task section, and control characters in them are refused (0.512745ms) +✔ the merge step refuses when git does not start the merge, instead of reporting a clean merge (239.860625ms) +✔ an unpublished merge keeps its summary within the summary limit, explanation included (230.665087ms) +✔ an unresolved binary conflict is refused rather than published as the PR side (199.067896ms) +✔ an index the agent moved behind a symlink, or deleted, refuses instead of hiding the conflict (400.715086ms) +✔ a marker-less conflict on a text file (merge=binary) is refused too, not only NUL-bearing files (249.328349ms) +✔ a conflict blob too large to read is refused, not a crashed run (249.521218ms) +✔ a merge patch too large to even read publishes no code instead of failing the run (311.16356ms) +✔ the declared subscription contract is exactly the required resident set (1.511024ms) +✔ every declared subscription registers one handler bound to the one body (0.234117ms) +✔ each trigger filters to its own provider, type and action (0.159958ms) +✔ compatibility entry points still resolve to this one implementation (0.319635ms) +✔ subscription preflight passes the declared contract and has teeth (0.371842ms) +✔ preflight refuses an undeliverable subscription rather than deploying it (0.13419ms) +✔ a delivery is accepted as a hint; only routing is enforced (0.981227ms) +✔ a fork check_run with no PR attribution still wakes and rereads (0.780564ms) +✔ repository routing compares owner and repository case-insensitively (0.205393ms) +✔ a stale hinted head is recorded, never enforced, and never binds (0.252821ms) +✔ an operator pin constrains the run; it never substitutes for live state (0.260456ms) +✔ every wake rereads live state before it decides anything (0.635253ms) +✔ a payload that disagrees with live state loses: closed hint, open PR (0.156912ms) +✔ a payload that disagrees with live state loses: open hint, closed PR (0.131776ms) +✔ a label hint is re-read from live state in both directions (0.164366ms) +✔ a review hint cannot assert an approval live state does not show (0.160439ms) +✔ a check hint cannot assert a conclusion live state does not show (0.086962ms) +✔ duplicate delivery repeats a decision instead of adding one (0.2525ms) +✔ out-of-order delivery decides about the head that exists now (0.145311ms) +✔ the decision key names the subscription and the live head, never the hint (0.094085ms) +✔ each wake emits one deterministic observation line (0.154618ms) +✔ the sweep separates a quiet subscription from a dead one (0.309937ms) +✔ a young subscription is pending, an old silent one is never (0.183762ms) +✔ the sweep refuses impossible windows and clock-faulted records (0.226031ms) +✔ the sweep expects exactly the subscriptions the flow registers (0.074989ms) +ℹ tests 176 ℹ suites 0 -ℹ pass 167 +ℹ pass 169 ℹ fail 0 ℹ cancelled 0 ℹ skipped 0 ℹ todo 7 -ℹ duration_ms 4097.540797 +ℹ duration_ms 4454.164814 ✖ failing tests: test at tests/flow.test.ts:175:1 -⚠ live-head end-to-end review and merge acceptance remains RED (2.003625ms) # Requires enforced agent scopes and durable fenced publication; the passing merge transport unit test is not end-to-end acceptance +⚠ live-head end-to-end review and merge acceptance remains RED (0.920895ms) # Requires enforced agent scopes and durable fenced publication; the passing merge transport unit test is not end-to-end acceptance AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected @@ -198,7 +200,7 @@ test at tests/flow.test.ts:175:1 - 'success' ] - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/flow.test.ts:177:10) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/flow.test.ts:177:10) at async Test.run (node:internal/test_runner/test:1409:7) at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) { generatedMessage: true, @@ -210,12 +212,12 @@ test at tests/flow.test.ts:175:1 } test at tests/platform.test.ts:14:3 -⚠ atomicPrPublication (2.008614ms) # Provider per-PR serialization + head-guarded idempotent owned-comment upsert +⚠ atomicPrPublication (2.076788ms) # Provider per-PR serialization + head-guarded idempotent owned-comment upsert AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/platform.test.ts:14:49) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/platform.test.ts:14:49) at Test.runInAsyncScope (node:async_hooks:226:14) at Test.run (node:internal/test_runner/test:1402:25) at Test.start (node:internal/test_runner/test:1262:17) @@ -229,12 +231,12 @@ test at tests/platform.test.ts:14:3 } test at tests/platform.test.ts:14:3 -⚠ durableCrossRunNotification (0.403763ms) # Durable per-head notification receipt and atomic delivery claim +⚠ durableCrossRunNotification (0.393223ms) # Durable per-head notification receipt and atomic delivery claim AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/platform.test.ts:14:49) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/platform.test.ts:14:49) at Test.runInAsyncScope (node:async_hooks:226:14) at Test.run (node:internal/test_runner/test:1402:25) at Test.processPendingSubtests (node:internal/test_runner/test:974:18) @@ -250,12 +252,12 @@ test at tests/platform.test.ts:14:3 } test at tests/platform.test.ts:14:3 -⚠ journaledCiObservation (0.325477ms) # Journal-backed script-memory write/recall across runs (memory.learn currently refuses) +⚠ journaledCiObservation (0.27428ms) # Journal-backed script-memory write/recall across runs (memory.learn currently refuses) AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/platform.test.ts:14:49) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/platform.test.ts:14:49) at Test.runInAsyncScope (node:async_hooks:226:14) at Test.run (node:internal/test_runner/test:1402:25) at Test.processPendingSubtests (node:internal/test_runner/test:974:18) @@ -271,12 +273,12 @@ test at tests/platform.test.ts:14:3 } test at tests/platform.test.ts:14:3 -⚠ enforcedAgentWriteScope (0.232323ms) # Enforced readonly agent workspace and credential scopes (gate 8 / #442) +⚠ enforcedAgentWriteScope (0.151763ms) # Enforced readonly agent workspace and credential scopes (gate 8 / #442) AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/platform.test.ts:14:49) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/platform.test.ts:14:49) at Test.runInAsyncScope (node:async_hooks:226:14) at Test.run (node:internal/test_runner/test:1402:25) at Test.processPendingSubtests (node:internal/test_runner/test:974:18) @@ -292,12 +294,12 @@ test at tests/platform.test.ts:14:3 } test at tests/platform.test.ts:14:3 -⚠ selectiveAgentExitRetry (0.183943ms) # Typed agent exit-code/retry policy in authored Step; AgentResult has summary/artifacts and success/timeout completionReason +⚠ selectiveAgentExitRetry (0.146353ms) # Typed agent exit-code/retry policy in authored Step; AgentResult has summary/artifacts and success/timeout completionReason AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/platform.test.ts:14:49) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/platform.test.ts:14:49) at Test.runInAsyncScope (node:async_hooks:226:14) at Test.run (node:internal/test_runner/test:1402:25) at Test.processPendingSubtests (node:internal/test_runner/test:974:18) @@ -313,12 +315,12 @@ test at tests/platform.test.ts:14:3 } test at tests/platform.test.ts:14:3 -⚠ durableSubscriptionLiveness (0.15583ms) # Durable cross-run wake records for the liveness sweep; a subscription that stops firing is currently indistinguishable from a quiet one +⚠ durableSubscriptionLiveness (0.097001ms) # Durable cross-run wake records for the liveness sweep; a subscription that stops firing is currently indistinguishable from a quiet one AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true - at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-private-gitdir/examples/babysitter/tests/platform.test.ts:14:49) + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/platform.test.ts:14:49) at Test.runInAsyncScope (node:async_hooks:226:14) at Test.run (node:internal/test_runner/test:1402:25) at Test.processPendingSubtests (node:internal/test_runner/test:974:18) diff --git a/examples/babysitter/evidence/p2-task-modes/03-artifact-check.txt b/examples/babysitter/evidence/p2-task-modes/03-artifact-check.txt index aded2c14f..a79e8208d 100644 --- a/examples/babysitter/evidence/p2-task-modes/03-artifact-check.txt +++ b/examples/babysitter/evidence/p2-task-modes/03-artifact-check.txt @@ -1,3 +1,3 @@ $ node examples/babysitter/build-standalone.mjs --check Checked sha256:580bab1d31bfe05b2be4cbdfa74f8669efdb1067ba4a4bf126f871b432d7f834 (babysitter-standalone) -Checked sha256:f107bcf907bb7f695fcdd2e21f23030a81a0ce5292dc0455374fddd5ac13f2cc (babysitter-fixer) +Checked sha256:fe9f2512421fdbeac327e360db078c2a33c2d3542590382807b75b65a666e4eb (babysitter-fixer) diff --git a/examples/babysitter/evidence/p2-task-modes/09-filemode-mutation.txt b/examples/babysitter/evidence/p2-task-modes/09-filemode-mutation.txt new file mode 100644 index 000000000..632f29c31 --- /dev/null +++ b/examples/babysitter/evidence/p2-task-modes/09-filemode-mutation.txt @@ -0,0 +1,102 @@ +# Lost-executable-bit fix: mutation evidence. Produced from the repository root, at the commit that contains this file's script, by running verbatim: +# bash examples/babysitter/evidence/p2-task-modes/scripts/filemode-mutation.sh +# Each '+ ' line is the exact command run, printed shell-escaped (printf %q); everything else is its captured output, unedited. +# ---- output ---- ++ sha256sum fix.ts +47b09cd11a13ccf9c88ddb3a52c6cab1c3452faf4173c23f410169a35adc7f3d fix.ts + +### M1: the private git dir compares file modes (no core.fileMode=false) ++ python3 -c p=\'fix.ts\'\;s=open\(p\).read\(\)\;o=\"GIT_CONFIG_COUNT:\ \'3\'\,\ GIT_CONFIG_KEY_0:\ \'core.hooksPath\'\"\;assert\ o\ in\ s\;s=s.replace\(o\,\"GIT_CONFIG_COUNT:\ \'2\'\,\ GIT_CONFIG_KEY_0:\ \'core.hooksPath\'\"\,1\)\;open\(p\,\'w\'\).write\(s\) ++ git diff --stat -- fix.ts + examples/babysitter/fix.ts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) ++ node --experimental-strip-types --test --test-name-pattern=dropped\ executable\ bits tests/task.test.ts +✖ a checkout whose filesystem dropped executable bits proposes only the real edits (187.191085ms) +ℹ tests 1 +ℹ suites 0 +ℹ pass 0 +ℹ fail 1 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 335.777005 + +✖ failing tests: + +test at tests/task.test.ts:224:1 +✖ a checkout whose filesystem dropped executable bits proposes only the real edits (187.191085ms) + AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + + actual - expected + + [ + + 'scripts/a.sh', + + 'scripts/b.sh', + 'src/retry.ts' + ] + + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/task.test.ts:232:10) + at async Test.run (node:internal/test_runner/test:1409:7) + at async startSubtestAfterBootstrap (node:internal/test_runner/harness:387:3) { + generatedMessage: true, + code: 'ERR_ASSERTION', + actual: [ 'scripts/a.sh', 'scripts/b.sh', 'src/retry.ts' ], + expected: [ 'src/retry.ts' ], + operator: 'deepStrictEqual', + diff: 'simple' + } ++ git restore --source=HEAD -- fix.ts ++ sha256sum fix.ts +47b09cd11a13ccf9c88ddb3a52c6cab1c3452faf4173c23f410169a35adc7f3d fix.ts + +### M2: the checkout's config compares file modes (no git config core.fileMode false) ++ python3 -c p=\'fix.ts\'\;s=open\(p\).read\(\)\;o=\"\ \ git\(\'config\'\,\ \'core.fileMode\'\,\ \'false\'\)\;\\n\"\;assert\ o\ in\ s\;open\(p\,\'w\'\).write\(s.replace\(o\,\'\'\,1\)\) ++ git diff --stat -- fix.ts + examples/babysitter/fix.ts | 1 - + 1 file changed, 1 deletion(-) ++ node --experimental-strip-types --test --test-name-pattern=dropped\ executable\ bits tests/fixer.test.ts +✖ a checkout whose filesystem dropped executable bits reads as clean (122.230312ms) +ℹ tests 1 +ℹ suites 0 +ℹ pass 0 +ℹ fail 1 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 267.424655 + +✖ failing tests: + +test at tests/fixer.test.ts:348:1 +✖ a checkout whose filesystem dropped executable bits reads as clean (122.230312ms) + AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: + + actual - expected + + + ' M bin/run.sh\n' + - '' + + at TestContext. (file:///home/khaliqgant/Projects/AgentWorkforce/flows-worktrees/babysitter-filemode/examples/babysitter/tests/fixer.test.ts:358:10) + at async Test.run (node:internal/test_runner/test:1409:7) + at async startSubtestAfterBootstrap (node:internal/test_runner/harness:387:3) { + generatedMessage: true, + code: 'ERR_ASSERTION', + actual: ' M bin/run.sh\n', + expected: '', + operator: 'strictEqual', + diff: 'simple' + } ++ git restore --source=HEAD -- fix.ts ++ sha256sum fix.ts +47b09cd11a13ccf9c88ddb3a52c6cab1c3452faf4173c23f410169a35adc7f3d fix.ts + +### Restored: both tests ++ node --experimental-strip-types --test --test-name-pattern=dropped\ executable\ bits tests/fixer.test.ts tests/task.test.ts +✔ a checkout whose filesystem dropped executable bits reads as clean (121.761698ms) +✔ a checkout whose filesystem dropped executable bits proposes only the real edits (193.143973ms) +ℹ tests 2 +ℹ suites 0 +ℹ pass 2 +ℹ fail 0 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 344.756149 diff --git a/examples/babysitter/evidence/p2-task-modes/scripts/filemode-mutation.sh b/examples/babysitter/evidence/p2-task-modes/scripts/filemode-mutation.sh new file mode 100755 index 000000000..8ed6516f7 --- /dev/null +++ b/examples/babysitter/evidence/p2-task-modes/scripts/filemode-mutation.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Mutation evidence for the lost-executable-bit fix. Run from the repository root, +# at the commit that contains this script: bash examples/babysitter/evidence/p2-task-modes/scripts/filemode-mutation.sh +set -euo pipefail +export TMPDIR="$HOME/.agent-tmp" +cd "$(dirname "$0")/../../.." +git diff --quiet HEAD -- fix.ts || { echo "fix.ts differs from HEAD; commit it first" >&2; exit 1; } +trap 'git restore --source=HEAD -- fix.ts' EXIT +# Commands are printed shell-escaped (printf %q), so a printed line replays as run. +show() { printf '+'; printf ' %q' "$@"; printf '\n'; } +run() { show "$@"; "$@" 2>&1 || true; } +edit() { show "$@"; "$@"; } +run sha256sum fix.ts + +echo; echo "### M1: the private git dir compares file modes (no core.fileMode=false)" +edit python3 -c "p='fix.ts';s=open(p).read();o=\"GIT_CONFIG_COUNT: '3', GIT_CONFIG_KEY_0: 'core.hooksPath'\";assert o in s;s=s.replace(o,\"GIT_CONFIG_COUNT: '2', GIT_CONFIG_KEY_0: 'core.hooksPath'\",1);open(p,'w').write(s)" +run git diff --stat -- fix.ts +run node --experimental-strip-types --test --test-name-pattern='dropped executable bits' tests/task.test.ts +run git restore --source=HEAD -- fix.ts +run sha256sum fix.ts + +echo; echo "### M2: the checkout's config compares file modes (no git config core.fileMode false)" +edit python3 -c "p='fix.ts';s=open(p).read();o=\" git('config', 'core.fileMode', 'false');\n\";assert o in s;open(p,'w').write(s.replace(o,'',1))" +run git diff --stat -- fix.ts +run node --experimental-strip-types --test --test-name-pattern='dropped executable bits' tests/fixer.test.ts +run git restore --source=HEAD -- fix.ts +run sha256sum fix.ts + +echo; echo "### Restored: both tests" +run node --experimental-strip-types --test --test-name-pattern='dropped executable bits' tests/fixer.test.ts tests/task.test.ts diff --git a/examples/babysitter/fix.ts b/examples/babysitter/fix.ts index 635a2b2a3..8b4604d4b 100644 --- a/examples/babysitter/fix.ts +++ b/examples/babysitter/fix.ts @@ -70,6 +70,9 @@ export async function checkoutHead(c: { owner: string; repo: string; head: strin const before = fingerprint(); rmSync(join(dir, '.git'), { recursive: true, force: true }); git('init', '-q'); + // The sandbox's filesystem may not keep executable bits: every executable + // would then read as changed, to the agent and in the proposal. + git('config', 'core.fileMode', 'false'); git('fetch', '-q', '--no-tags', '--depth=50', c.origin ?? `https://github.com/${c.owner}/${c.repo}.git`, c.head); git('reset', '-q', '--hard', c.head); git('clean', '-q', reused && fingerprint() !== before ? '-fdx' : '-fd'); @@ -171,7 +174,7 @@ export async function proposeChanges(c: ProposalInput): Promise { // git dir that only borrows the checkout's objects (read-only, via // alternates) and a copy of its index (which keeps any unmerged stages, // and the shared index files a split index points at). - const environment = { ...process.env, GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_COUNT: '2', GIT_CONFIG_KEY_0: 'core.hooksPath', GIT_CONFIG_VALUE_0: '/dev/null', GIT_CONFIG_KEY_1: 'core.quotePath', GIT_CONFIG_VALUE_1: 'false' }; + const environment = { ...process.env, GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_COUNT: '3', GIT_CONFIG_KEY_0: 'core.hooksPath', GIT_CONFIG_VALUE_0: '/dev/null', GIT_CONFIG_KEY_1: 'core.quotePath', GIT_CONFIG_VALUE_1: 'false', GIT_CONFIG_KEY_2: 'core.fileMode', GIT_CONFIG_VALUE_2: 'false' }; const checkoutGit = resolve(c.dir, '.git'); const scratch = mkdtempSync(`${tmpdir()}/babysitter-gitdir-`); try { diff --git a/examples/babysitter/tests/fixer.test.ts b/examples/babysitter/tests/fixer.test.ts index 9b646b8e6..83994620a 100644 --- a/examples/babysitter/tests/fixer.test.ts +++ b/examples/babysitter/tests/fixer.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; -import { mkdtempSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { chmodSync, mkdtempSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -345,6 +345,19 @@ function upstream(): { dir: string; commit: (files: Record) => s }; } +test('a checkout whose filesystem dropped executable bits reads as clean', async () => { + const up = upstream(); + up.commit({ 'bin/run.sh': '#!/bin/sh\n' }); + chmodSync(join(up.dir, 'bin/run.sh'), 0o755); + const head = up.commit({}); + const runRoot = mkdtempSync(join(tmpdir(), 'babysitter-run-')); + await runCheckout(runRoot, up.dir, head); + const dir = join(runRoot, 'babysitter-checkout'); + chmodSync(join(dir, 'bin/run.sh'), 0o644); + const status = execFileSync('git', ['-C', dir, 'status', '--porcelain'], { env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' }, encoding: 'utf8' }); + assert.equal(status, ''); +}); + test('a reused checkout keeps its dependencies but none of the agent\'s git state, and lands exactly on the head', async () => { const up = upstream(); const first = up.commit({ '.gitignore': 'node_modules/\n', 'package.json': '{"name":"w"}\n', 'package-lock.json': '{"v":1}\n', 'src/a.ts': 'a\n' }); diff --git a/examples/babysitter/tests/task.test.ts b/examples/babysitter/tests/task.test.ts index 23a4bbc7d..22619f2bc 100644 --- a/examples/babysitter/tests/task.test.ts +++ b/examples/babysitter/tests/task.test.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; -import { mkdtempSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'; +import { chmodSync, mkdtempSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import test from 'node:test'; @@ -165,7 +165,7 @@ test('a merge too large to publish ends needs_human with an explanation instead // Real repositories: a PR branch and a trunk that moved under it. const gitEnv = { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_AUTHOR_NAME: 't', GIT_AUTHOR_EMAIL: 't@t', GIT_COMMITTER_NAME: 't', GIT_COMMITTER_EMAIL: 't@t' }; -function forked(): { up: string; head: string; trunk: string; checkout: string; git: (...a: string[]) => string } { +function forked(o: { executable?: string[] } = {}): { up: string; head: string; trunk: string; checkout: string; git: (...a: string[]) => string } { const up = mkdtempSync(join(tmpdir(), 'babysitter-trunk-')); const g = (dir: string) => (...a: string[]) => execFileSync('git', ['-C', dir, ...a], { env: gitEnv, encoding: 'utf8' }).trim(); const u = g(up); @@ -175,6 +175,7 @@ function forked(): { up: string; head: string; trunk: string; checkout: string; u('add', '-A'); u('commit', '-qm', 'base'); u('checkout', '-qb', 'pr'); write({ 'src/retry.ts': 'export const attempts = 3;\n', 'src/pr-only.ts': 'pr\n' }); + for (const path of o.executable ?? []) { write({ [path]: '#!/bin/sh\n' }); chmodSync(join(up, path), 0o755); } u('add', '-A'); u('commit', '-qm', 'pr'); const prHead = u('rev-parse', 'HEAD'); u('checkout', '-q', 'trunk'); @@ -220,6 +221,17 @@ const inOwnTmp = async (run: () => Promise): Promise<{ result: T; left: st } }; +test('a checkout whose filesystem dropped executable bits proposes only the real edits', async () => { + // Live run #2 (Cloud run ba91b3b1): the sandbox checkout lost the mode of + // all 61 executables, and the proposal was refused for 63 changed files. + const r = forked({ executable: ['scripts/a.sh', 'scripts/b.sh'] }); + for (const path of ['scripts/a.sh', 'scripts/b.sh']) chmodSync(join(r.checkout, path), 0o644); + writeFileSync(join(r.checkout, 'src/retry.ts'), 'export const attempts = 4;\n'); + const p = await runPropose(r); + assert.equal(p.kind, 'babysitter-proposal'); + assert.deepEqual(p.files, ['src/retry.ts']); +}); + test('proposes from a checkout whose .git the sandbox left unwritable, touching nothing in it', async () => { // Live run #1 (Cloud run c5c7bb01): after the agent step the checkout's // .git was not writable, and rewriting .git/config failed with EACCES.