Files
qwen-code/packages
易良andQwen-Coder f087e699af fix(core): register promoted initial commits in unborn repos (#16081)
* fix(core): register promoted initial commits in unborn repos

A promoted command captured its pre-spawn HEAD as null both when the repository was unborn and when the probe failed. The registration path then skipped both cases, so amending the agent's own initial commit was blocked.\n\nCapture the pre-spawn state as either a SHA or an explicitly unborn HEAD. The promoted lineage check now requires a null predecessor only for the unborn case, while repository or probe failures still skip registration. Add a real-git regression for a promoted initial commit.

Co-authored-by: Qwen-Coder <[email protected]>

* fix(core): fail closed when the pre-spawn HEAD probe is terminated

Only a genuine git non-zero answer (status 128, no signal) proceeds to the
repository probe. A killed, timed-out, or failed-to-spawn HEAD lookup now
returns null instead of asserting a verified unborn repository, which the
promoted path could otherwise pair with a single-entry reflog to register a
pre-existing root commit the agent never made.

Co-authored-by: Qwen-Coder <[email protected]>

* style(core): prettier formatting for probe regression test

Co-authored-by: Qwen-Coder <[email protected]>

* docs(core): scope the lineage guard's fail-closed claim to born HEAD

R1-1: the docblock stated "a foreign commit never earns an exemption" as a
fail-closed property, which the unborn arm makes false — `null` is a sentinel
every root commit satisfies, so a root commit somebody else lands during the
promoted window is indistinguishable from this command's own. Say that, and
scope the five-star guarantee to a born HEAD. The behaviour is the trade
tracked on #12523; only the written invariant was wrong.

R1-2: pin that the PATH `git` shim is live before relying on it. Both closing
assertions also hold when the shim is bypassed (the lineage check then rejects
on a non-null predecessor), so the row could green without exercising the
probe-termination path it exists to pin. Verified by mutation: changing the
shim's match from `--verify` to `--bypass` turns this row red.

Co-authored-by: Qwen-Coder <[email protected]>
Patrol-Run: qwen-pr-closeout/jmw1dkg4zbx

* docs(core): scope the promoted-lineage claim to what the predecessor proves

The `requirePredecessor` paragraph said "a foreign commit never earns an
exemption", and the promoted call site said the guard keeps the registered
SHA one this command created. The lineage check only proves the newest
reflog `commit:` entry moved HEAD from `preHead`; a foreign commit landed
directly on `preHead` while this command's own commit never landed has that
same predecessor and still registers, so both statements overclaimed.

Scope them: born-HEAD narrowing is not closing, and the fail-closed
guarantee holds only once this command's own commit landed first.

Co-authored-by: Qwen-Coder <[email protected]>
Patrol-Run: qwen-pr-closeout/jmw2g5c3hdf

---------

Co-authored-by: Qwen-Coder <[email protected]>
2026-11-07 14:44:43 +08:00
..