muse-crew 0.7.15 → 0.7.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muse-crew",
3
- "version": "0.7.15",
3
+ "version": "0.7.16",
4
4
  "description": "Opinionated orchestration for Muse — workflows, identities, and tooling for autonomous software development.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -1890,6 +1890,10 @@ while (i < STEPS.length) {
1890
1890
  var pollSawOurBuild = false;
1891
1891
  var pollSawStranger = false;
1892
1892
  var lastObservedAgentId = null;
1893
+ // Poll-chunk failure record (2026-09-16, task 1febe8eb): chunk
1894
+ // agent calls that threw instead of returning a verdict —
1895
+ // recorded for the post-poll diagnosis, never terminal alone.
1896
+ var chunkFailures = [];
1893
1897
  for (var chunk = 1; chunk <= 3; chunk++) {
1894
1898
  if (chunk > 1) {
1895
1899
  var refreshPoll = await agent(
@@ -1910,22 +1914,36 @@ while (i < STEPS.length) {
1910
1914
  var pollKey = (chunk === 1)
1911
1915
  ? attemptKey("publish-artifact-poll-" + taskId, totalReworkCount)
1912
1916
  : attemptKey("publish-artifact-poll-" + taskId + "-c" + chunk, totalReworkCount);
1913
- buildPoll = await agent(
1914
- "First call tool_search.load_tool_namespace with paths [\"artifact\"]. Then poll artifact_status for slug \"" + PUBLISH_SLUG + "\" \u2014 for OUR build only, the one whose agent_id is \"" + rebuildAgentId + "\" (the receipt captured when the edit was accepted; the agent_id is the artifact system's in-flight build correlation ID, stable across polls while the build runs). Check every 30 seconds, up to 7 checks (3.5 minutes max). On each check, read the raw build object:\n" +
1915
- "On every check, record whether you have positively OBSERVED our build: a running build whose agent_id equals \"" + rebuildAgentId + "\", or a completed-build record whose agent_id equals \"" + rebuildAgentId + "\" (if the tool surfaces one \u2014 match it mechanically, never assume).\n" +
1916
- "- If no build is running (build is null) and you have NOT observed our build: our build's completion is UNPROVEN. Absence of a running build is not evidence our build ran. Do NOT report done.\n" +
1917
- "- If no build is running (build is null) and you previously observed our build running: our build finished. Stop and report done.\n" +
1918
- "- If the running build's agent_id equals \"" + rebuildAgentId + "\": still ours \u2014 keep waiting.\n" +
1919
- "- If the running build's agent_id is present but DIFFERENT: that is a stranger's build. Do NOT attribute its completion to our attempt and do NOT wait on it \u2014 keep checking within budget; if the budget expires without observing our build, report done=false. Record it in saw_stranger regardless of what else you observe.\n" +
1920
- "Return JSON { \"build_done\": <true ONLY when you positively observed our build and it is no longer running, false otherwise>, \"saw_our_build\": <true if you observed our build at any check, false if never>, \"saw_stranger\": true if at ANY check a running build had an agent_id different from ours (\"" + rebuildAgentId + "\"), false otherwise, \"status\": \"<final status or timeout note>\", \"observed_agent_id\": \"<the agent_id seen on the last check, or null when no build was running>\" } and nothing else.",
1921
- { key: pollKey, label: "Waiting for artifact build to complete (chunk " + chunk + " of 3)",
1922
- schema: { type: "object", properties: { build_done: { type: "boolean" }, saw_our_build: { type: "boolean" }, saw_stranger: { type: "boolean" }, status: { type: "string" }, observed_agent_id: { type: ["string", "null"] } }, required: ["build_done"] },
1923
- timeoutMs: 270000 }
1924
- );
1925
- pollSawOurBuild = pollSawOurBuild || (buildPoll && buildPoll.saw_our_build === true);
1926
- pollSawStranger = pollSawStranger || (buildPoll && buildPoll.saw_stranger === true);
1927
- lastObservedAgentId = (buildPoll && buildPoll.observed_agent_id) || null;
1928
- if (buildPoll && buildPoll.build_done) { break; }
1917
+ try {
1918
+ buildPoll = await agent(
1919
+ "First call tool_search.load_tool_namespace with paths [\"artifact\"]. Then poll artifact_status for slug \"" + PUBLISH_SLUG + "\" \u2014 for OUR build only, the one whose agent_id is \"" + rebuildAgentId + "\" (the receipt captured when the edit was accepted; the agent_id is the artifact system's in-flight build correlation ID, stable across polls while the build runs). Check every 30 seconds, up to 7 checks (3.5 minutes max). On each check, read the raw build object:\n" +
1920
+ "On every check, record whether you have positively OBSERVED our build: a running build whose agent_id equals \"" + rebuildAgentId + "\", or a completed-build record whose agent_id equals \"" + rebuildAgentId + "\" (if the tool surfaces one \u2014 match it mechanically, never assume).\n" +
1921
+ "- If no build is running (build is null) and you have NOT observed our build: our build's completion is UNPROVEN. Absence of a running build is not evidence our build ran. Do NOT report done.\n" +
1922
+ "- If no build is running (build is null) and you previously observed our build running: our build finished. Stop and report done.\n" +
1923
+ "- If the running build's agent_id equals \"" + rebuildAgentId + "\": still ours \u2014 keep waiting.\n" +
1924
+ "- If the running build's agent_id is present but DIFFERENT: that is a stranger's build. Do NOT attribute its completion to our attempt and do NOT wait on it \u2014 keep checking within budget; if the budget expires without observing our build, report done=false. Record it in saw_stranger regardless of what else you observe.\n" +
1925
+ "Return JSON { \"build_done\": <true ONLY when you positively observed our build and it is no longer running, false otherwise>, \"saw_our_build\": <true if you observed our build at any check, false if never>, \"saw_stranger\": true if at ANY check a running build had an agent_id different from ours (\"" + rebuildAgentId + "\"), false otherwise, \"status\": \"<final status or timeout note>\", \"observed_agent_id\": \"<the agent_id seen on the last check, or null when no build was running>\" } and nothing else.",
1926
+ { key: pollKey, label: "Waiting for artifact build to complete (chunk " + chunk + " of 3)",
1927
+ schema: { type: "object", properties: { build_done: { type: "boolean" }, saw_our_build: { type: "boolean" }, saw_stranger: { type: "boolean" }, status: { type: "string" }, observed_agent_id: { type: ["string", "null"] } }, required: ["build_done"] },
1928
+ timeoutMs: 270000 }
1929
+ );
1930
+ } catch (chunkErr) {
1931
+ // A hung or failed chunk is inconclusive, never terminal:
1932
+ // record it and continue to the next chunk. (2026-09-16,
1933
+ // clean-room task 1febe8eb: the platform's 270s agent
1934
+ // timeout killed chunk 2, which threw out of this loop —
1935
+ // skipping chunk 3 AND the STEP 1b audit-dir fallback and
1936
+ // parking on the exception path.) Fail-closed still applies
1937
+ // after chunk 3 and the fallback are exhausted.
1938
+ chunkFailures.push("chunk " + chunk + ": " + (chunkErr && chunkErr.message ? chunkErr.message : chunkErr));
1939
+ log("Artifact build poll chunk " + chunk + " of 3 failed (" + (chunkErr && chunkErr.message ? chunkErr.message : chunkErr) + ") \u2014 continuing to the next chunk; build completion still unproven.");
1940
+ }
1941
+ if (buildPoll) {
1942
+ pollSawOurBuild = pollSawOurBuild || (buildPoll.saw_our_build === true);
1943
+ pollSawStranger = pollSawStranger || (buildPoll.saw_stranger === true);
1944
+ lastObservedAgentId = buildPoll.observed_agent_id || null;
1945
+ if (buildPoll.build_done) { break; }
1946
+ }
1929
1947
  }
1930
1948
  if (!buildPoll || !buildPoll.build_done) {
1931
1949
  buildPoll = { build_done: false, status: (buildPoll && buildPoll.status) || "build still running after the 10.5-minute bounded poll" };
@@ -2048,7 +2066,7 @@ while (i < STEPS.length) {
2048
2066
  var unattributableReason = strangerObserved ? "stranger-build-observed-during-poll"
2049
2067
  : (pollEndState === "build-still-running-at-poll-end" ? "build-still-running-at-poll-end"
2050
2068
  : (newAuditDirsAfterPoll.length === 0 ? "no-new-audit-dir-in-window" : "audit-report-unreadable-or-missing"));
2051
- publishFailure = "Artifact build completion unproven (fail-closed, no provenance stamped): unattributable_reason=" + unattributableReason + "; poll_end_state=" + pollEndState + "; " + "saw_our_build=" + pollSawOurBuild + "; new_audit_dirs=" + newAuditDirsAfterPoll.length + ". Attribution is by window, not by build identity. The publish may or may not have landed. Fail-closed.";
2069
+ publishFailure = "Artifact build completion unproven (fail-closed, no provenance stamped): unattributable_reason=" + unattributableReason + "; poll_end_state=" + pollEndState + "; " + "saw_our_build=" + pollSawOurBuild + "; new_audit_dirs=" + newAuditDirsAfterPoll.length + "; poll_chunks_failed=" + chunkFailures.length + ". Attribution is by window, not by build identity. The publish may or may not have landed. Fail-closed.";
2052
2070
  await recordPublishLedger({
2053
2071
  commit: mergeCommitForPublish,
2054
2072
  attempt: rebuildAttemptKey,
@@ -1903,6 +1903,10 @@ while (i < STEPS.length) {
1903
1903
  var pollSawOurBuild = false;
1904
1904
  var pollSawStranger = false;
1905
1905
  var lastObservedAgentId = null;
1906
+ // Poll-chunk failure record (2026-09-16, task 1febe8eb): chunk
1907
+ // agent calls that threw instead of returning a verdict —
1908
+ // recorded for the post-poll diagnosis, never terminal alone.
1909
+ var chunkFailures = [];
1906
1910
  for (var chunk = 1; chunk <= 3; chunk++) {
1907
1911
  if (chunk > 1) {
1908
1912
  var refreshPoll = await agent(
@@ -1923,22 +1927,36 @@ while (i < STEPS.length) {
1923
1927
  var pollKey = (chunk === 1)
1924
1928
  ? attemptKey("publish-artifact-poll-" + taskId, reworkCount)
1925
1929
  : attemptKey("publish-artifact-poll-" + taskId + "-c" + chunk, reworkCount);
1926
- buildPoll = await agent(
1927
- "First call tool_search.load_tool_namespace with paths [\"artifact\"]. Then poll artifact_status for slug \"" + PUBLISH_SLUG + "\" \u2014 for OUR build only, the one whose agent_id is \"" + rebuildAgentId + "\" (the receipt captured when the edit was accepted; the agent_id is the artifact system's in-flight build correlation ID, stable across polls while the build runs). Check every 30 seconds, up to 7 checks (3.5 minutes max). On each check, read the raw build object:\n" +
1928
- "On every check, record whether you have positively OBSERVED our build: a running build whose agent_id equals \"" + rebuildAgentId + "\", or a completed-build record whose agent_id equals \"" + rebuildAgentId + "\" (if the tool surfaces one \u2014 match it mechanically, never assume).\n" +
1929
- "- If no build is running (build is null) and you have NOT observed our build: our build's completion is UNPROVEN. Absence of a running build is not evidence our build ran. Do NOT report done.\n" +
1930
- "- If no build is running (build is null) and you previously observed our build running: our build finished. Stop and report done.\n" +
1931
- "- If the running build's agent_id equals \"" + rebuildAgentId + "\": still ours \u2014 keep waiting.\n" +
1932
- "- If the running build's agent_id is present but DIFFERENT: that is a stranger's build. Do NOT attribute its completion to our attempt and do NOT wait on it \u2014 keep checking within budget; if the budget expires without observing our build, report done=false. Record it in saw_stranger regardless of what else you observe.\n" +
1933
- "Return JSON { \"build_done\": <true ONLY when you positively observed our build and it is no longer running, false otherwise>, \"saw_our_build\": <true if you observed our build at any check, false if never>, \"saw_stranger\": true if at ANY check a running build had an agent_id different from ours (\"" + rebuildAgentId + "\"), false otherwise, \"status\": \"<final status or timeout note>\", \"observed_agent_id\": \"<the agent_id seen on the last check, or null when no build was running>\" } and nothing else.",
1934
- { key: pollKey, label: "Waiting for artifact build to complete (chunk " + chunk + " of 3)",
1935
- schema: { type: "object", properties: { build_done: { type: "boolean" }, saw_our_build: { type: "boolean" }, saw_stranger: { type: "boolean" }, status: { type: "string" }, observed_agent_id: { type: ["string", "null"] } }, required: ["build_done"] },
1936
- timeoutMs: 270000 }
1937
- );
1938
- pollSawOurBuild = pollSawOurBuild || (buildPoll && buildPoll.saw_our_build === true);
1939
- pollSawStranger = pollSawStranger || (buildPoll && buildPoll.saw_stranger === true);
1940
- lastObservedAgentId = (buildPoll && buildPoll.observed_agent_id) || null;
1941
- if (buildPoll && buildPoll.build_done) { break; }
1930
+ try {
1931
+ buildPoll = await agent(
1932
+ "First call tool_search.load_tool_namespace with paths [\"artifact\"]. Then poll artifact_status for slug \"" + PUBLISH_SLUG + "\" \u2014 for OUR build only, the one whose agent_id is \"" + rebuildAgentId + "\" (the receipt captured when the edit was accepted; the agent_id is the artifact system's in-flight build correlation ID, stable across polls while the build runs). Check every 30 seconds, up to 7 checks (3.5 minutes max). On each check, read the raw build object:\n" +
1933
+ "On every check, record whether you have positively OBSERVED our build: a running build whose agent_id equals \"" + rebuildAgentId + "\", or a completed-build record whose agent_id equals \"" + rebuildAgentId + "\" (if the tool surfaces one \u2014 match it mechanically, never assume).\n" +
1934
+ "- If no build is running (build is null) and you have NOT observed our build: our build's completion is UNPROVEN. Absence of a running build is not evidence our build ran. Do NOT report done.\n" +
1935
+ "- If no build is running (build is null) and you previously observed our build running: our build finished. Stop and report done.\n" +
1936
+ "- If the running build's agent_id equals \"" + rebuildAgentId + "\": still ours \u2014 keep waiting.\n" +
1937
+ "- If the running build's agent_id is present but DIFFERENT: that is a stranger's build. Do NOT attribute its completion to our attempt and do NOT wait on it \u2014 keep checking within budget; if the budget expires without observing our build, report done=false. Record it in saw_stranger regardless of what else you observe.\n" +
1938
+ "Return JSON { \"build_done\": <true ONLY when you positively observed our build and it is no longer running, false otherwise>, \"saw_our_build\": <true if you observed our build at any check, false if never>, \"saw_stranger\": true if at ANY check a running build had an agent_id different from ours (\"" + rebuildAgentId + "\"), false otherwise, \"status\": \"<final status or timeout note>\", \"observed_agent_id\": \"<the agent_id seen on the last check, or null when no build was running>\" } and nothing else.",
1939
+ { key: pollKey, label: "Waiting for artifact build to complete (chunk " + chunk + " of 3)",
1940
+ schema: { type: "object", properties: { build_done: { type: "boolean" }, saw_our_build: { type: "boolean" }, saw_stranger: { type: "boolean" }, status: { type: "string" }, observed_agent_id: { type: ["string", "null"] } }, required: ["build_done"] },
1941
+ timeoutMs: 270000 }
1942
+ );
1943
+ } catch (chunkErr) {
1944
+ // A hung or failed chunk is inconclusive, never terminal:
1945
+ // record it and continue to the next chunk. (2026-09-16,
1946
+ // clean-room task 1febe8eb: the platform's 270s agent
1947
+ // timeout killed chunk 2, which threw out of this loop —
1948
+ // skipping chunk 3 AND the STEP 1b audit-dir fallback and
1949
+ // parking on the exception path.) Fail-closed still applies
1950
+ // after chunk 3 and the fallback are exhausted.
1951
+ chunkFailures.push("chunk " + chunk + ": " + (chunkErr && chunkErr.message ? chunkErr.message : chunkErr));
1952
+ log("Artifact build poll chunk " + chunk + " of 3 failed (" + (chunkErr && chunkErr.message ? chunkErr.message : chunkErr) + ") \u2014 continuing to the next chunk; build completion still unproven.");
1953
+ }
1954
+ if (buildPoll) {
1955
+ pollSawOurBuild = pollSawOurBuild || (buildPoll.saw_our_build === true);
1956
+ pollSawStranger = pollSawStranger || (buildPoll.saw_stranger === true);
1957
+ lastObservedAgentId = buildPoll.observed_agent_id || null;
1958
+ if (buildPoll.build_done) { break; }
1959
+ }
1942
1960
  }
1943
1961
  if (!buildPoll || !buildPoll.build_done) {
1944
1962
  buildPoll = { build_done: false, status: (buildPoll && buildPoll.status) || "build still running after the 10.5-minute bounded poll" };
@@ -2059,7 +2077,7 @@ while (i < STEPS.length) {
2059
2077
  var unattributableReason = strangerObserved ? "stranger-build-observed-during-poll"
2060
2078
  : (pollEndState === "build-still-running-at-poll-end" ? "build-still-running-at-poll-end"
2061
2079
  : (newAuditDirsAfterPoll.length === 0 ? "no-new-audit-dir-in-window" : "audit-report-unreadable-or-missing"));
2062
- publishFailure = "Artifact build completion unproven (fail-closed, no provenance stamped): unattributable_reason=" + unattributableReason + "; poll_end_state=" + pollEndState + "; " + "saw_our_build=" + pollSawOurBuild + "; new_audit_dirs=" + newAuditDirsAfterPoll.length + ". Attribution is by window, not by build identity. The publish may or may not have landed. Fail-closed.";
2080
+ publishFailure = "Artifact build completion unproven (fail-closed, no provenance stamped): unattributable_reason=" + unattributableReason + "; poll_end_state=" + pollEndState + "; " + "saw_our_build=" + pollSawOurBuild + "; new_audit_dirs=" + newAuditDirsAfterPoll.length + "; poll_chunks_failed=" + chunkFailures.length + ". Attribution is by window, not by build identity. The publish may or may not have landed. Fail-closed.";
2063
2081
  await recordPublishLedger({
2064
2082
  commit: mergeCommitForPublish,
2065
2083
  attempt: rebuildAttemptKey,
@@ -1855,6 +1855,10 @@ while (i < STEPS.length) {
1855
1855
  var pollSawOurBuild = false;
1856
1856
  var pollSawStranger = false;
1857
1857
  var lastObservedAgentId = null;
1858
+ // Poll-chunk failure record (2026-09-16, task 1febe8eb): chunk
1859
+ // agent calls that threw instead of returning a verdict —
1860
+ // recorded for the post-poll diagnosis, never terminal alone.
1861
+ var chunkFailures = [];
1858
1862
  for (var chunk = 1; chunk <= 3; chunk++) {
1859
1863
  if (chunk > 1) {
1860
1864
  var refreshPoll = await agent(
@@ -1875,22 +1879,36 @@ while (i < STEPS.length) {
1875
1879
  var pollKey = (chunk === 1)
1876
1880
  ? attemptKey("publish-artifact-poll-" + taskId, totalReworkCount)
1877
1881
  : attemptKey("publish-artifact-poll-" + taskId + "-c" + chunk, totalReworkCount);
1878
- buildPoll = await agent(
1879
- "First call tool_search.load_tool_namespace with paths [\"artifact\"]. Then poll artifact_status for slug \"" + PUBLISH_SLUG + "\" \u2014 for OUR build only, the one whose agent_id is \"" + rebuildAgentId + "\" (the receipt captured when the edit was accepted; the agent_id is the artifact system's in-flight build correlation ID, stable across polls while the build runs). Check every 30 seconds, up to 7 checks (3.5 minutes max). On each check, read the raw build object:\n" +
1880
- "On every check, record whether you have positively OBSERVED our build: a running build whose agent_id equals \"" + rebuildAgentId + "\", or a completed-build record whose agent_id equals \"" + rebuildAgentId + "\" (if the tool surfaces one \u2014 match it mechanically, never assume).\n" +
1881
- "- If no build is running (build is null) and you have NOT observed our build: our build's completion is UNPROVEN. Absence of a running build is not evidence our build ran. Do NOT report done.\n" +
1882
- "- If no build is running (build is null) and you previously observed our build running: our build finished. Stop and report done.\n" +
1883
- "- If the running build's agent_id equals \"" + rebuildAgentId + "\": still ours \u2014 keep waiting.\n" +
1884
- "- If the running build's agent_id is present but DIFFERENT: that is a stranger's build. Do NOT attribute its completion to our attempt and do NOT wait on it \u2014 keep checking within budget; if the budget expires without observing our build, report done=false. Record it in saw_stranger regardless of what else you observe.\n" +
1885
- "Return JSON { \"build_done\": <true ONLY when you positively observed our build and it is no longer running, false otherwise>, \"saw_our_build\": <true if you observed our build at any check, false if never>, \"saw_stranger\": true if at ANY check a running build had an agent_id different from ours (\"" + rebuildAgentId + "\"), false otherwise, \"status\": \"<final status or timeout note>\", \"observed_agent_id\": \"<the agent_id seen on the last check, or null when no build was running>\" } and nothing else.",
1886
- { key: pollKey, label: "Waiting for artifact build to complete (chunk " + chunk + " of 3)",
1887
- schema: { type: "object", properties: { build_done: { type: "boolean" }, saw_our_build: { type: "boolean" }, saw_stranger: { type: "boolean" }, status: { type: "string" }, observed_agent_id: { type: ["string", "null"] } }, required: ["build_done"] },
1888
- timeoutMs: 270000 }
1889
- );
1890
- pollSawOurBuild = pollSawOurBuild || (buildPoll && buildPoll.saw_our_build === true);
1891
- pollSawStranger = pollSawStranger || (buildPoll && buildPoll.saw_stranger === true);
1892
- lastObservedAgentId = (buildPoll && buildPoll.observed_agent_id) || null;
1893
- if (buildPoll && buildPoll.build_done) { break; }
1882
+ try {
1883
+ buildPoll = await agent(
1884
+ "First call tool_search.load_tool_namespace with paths [\"artifact\"]. Then poll artifact_status for slug \"" + PUBLISH_SLUG + "\" \u2014 for OUR build only, the one whose agent_id is \"" + rebuildAgentId + "\" (the receipt captured when the edit was accepted; the agent_id is the artifact system's in-flight build correlation ID, stable across polls while the build runs). Check every 30 seconds, up to 7 checks (3.5 minutes max). On each check, read the raw build object:\n" +
1885
+ "On every check, record whether you have positively OBSERVED our build: a running build whose agent_id equals \"" + rebuildAgentId + "\", or a completed-build record whose agent_id equals \"" + rebuildAgentId + "\" (if the tool surfaces one \u2014 match it mechanically, never assume).\n" +
1886
+ "- If no build is running (build is null) and you have NOT observed our build: our build's completion is UNPROVEN. Absence of a running build is not evidence our build ran. Do NOT report done.\n" +
1887
+ "- If no build is running (build is null) and you previously observed our build running: our build finished. Stop and report done.\n" +
1888
+ "- If the running build's agent_id equals \"" + rebuildAgentId + "\": still ours \u2014 keep waiting.\n" +
1889
+ "- If the running build's agent_id is present but DIFFERENT: that is a stranger's build. Do NOT attribute its completion to our attempt and do NOT wait on it \u2014 keep checking within budget; if the budget expires without observing our build, report done=false. Record it in saw_stranger regardless of what else you observe.\n" +
1890
+ "Return JSON { \"build_done\": <true ONLY when you positively observed our build and it is no longer running, false otherwise>, \"saw_our_build\": <true if you observed our build at any check, false if never>, \"saw_stranger\": true if at ANY check a running build had an agent_id different from ours (\"" + rebuildAgentId + "\"), false otherwise, \"status\": \"<final status or timeout note>\", \"observed_agent_id\": \"<the agent_id seen on the last check, or null when no build was running>\" } and nothing else.",
1891
+ { key: pollKey, label: "Waiting for artifact build to complete (chunk " + chunk + " of 3)",
1892
+ schema: { type: "object", properties: { build_done: { type: "boolean" }, saw_our_build: { type: "boolean" }, saw_stranger: { type: "boolean" }, status: { type: "string" }, observed_agent_id: { type: ["string", "null"] } }, required: ["build_done"] },
1893
+ timeoutMs: 270000 }
1894
+ );
1895
+ } catch (chunkErr) {
1896
+ // A hung or failed chunk is inconclusive, never terminal:
1897
+ // record it and continue to the next chunk. (2026-09-16,
1898
+ // clean-room task 1febe8eb: the platform's 270s agent
1899
+ // timeout killed chunk 2, which threw out of this loop —
1900
+ // skipping chunk 3 AND the STEP 1b audit-dir fallback and
1901
+ // parking on the exception path.) Fail-closed still applies
1902
+ // after chunk 3 and the fallback are exhausted.
1903
+ chunkFailures.push("chunk " + chunk + ": " + (chunkErr && chunkErr.message ? chunkErr.message : chunkErr));
1904
+ log("Artifact build poll chunk " + chunk + " of 3 failed (" + (chunkErr && chunkErr.message ? chunkErr.message : chunkErr) + ") \u2014 continuing to the next chunk; build completion still unproven.");
1905
+ }
1906
+ if (buildPoll) {
1907
+ pollSawOurBuild = pollSawOurBuild || (buildPoll.saw_our_build === true);
1908
+ pollSawStranger = pollSawStranger || (buildPoll.saw_stranger === true);
1909
+ lastObservedAgentId = buildPoll.observed_agent_id || null;
1910
+ if (buildPoll.build_done) { break; }
1911
+ }
1894
1912
  }
1895
1913
  if (!buildPoll || !buildPoll.build_done) {
1896
1914
  buildPoll = { build_done: false, status: (buildPoll && buildPoll.status) || "build still running after the 10.5-minute bounded poll" };
@@ -2013,7 +2031,7 @@ while (i < STEPS.length) {
2013
2031
  var unattributableReason = strangerObserved ? "stranger-build-observed-during-poll"
2014
2032
  : (pollEndState === "build-still-running-at-poll-end" ? "build-still-running-at-poll-end"
2015
2033
  : (newAuditDirsAfterPoll.length === 0 ? "no-new-audit-dir-in-window" : "audit-report-unreadable-or-missing"));
2016
- publishFailure = "Artifact build completion unproven (fail-closed, no provenance stamped): unattributable_reason=" + unattributableReason + "; poll_end_state=" + pollEndState + "; " + "saw_our_build=" + pollSawOurBuild + "; new_audit_dirs=" + newAuditDirsAfterPoll.length + ". Attribution is by window, not by build identity. The publish may or may not have landed. Fail-closed.";
2034
+ publishFailure = "Artifact build completion unproven (fail-closed, no provenance stamped): unattributable_reason=" + unattributableReason + "; poll_end_state=" + pollEndState + "; " + "saw_our_build=" + pollSawOurBuild + "; new_audit_dirs=" + newAuditDirsAfterPoll.length + "; poll_chunks_failed=" + chunkFailures.length + ". Attribution is by window, not by build identity. The publish may or may not have landed. Fail-closed.";
2017
2035
  await recordPublishLedger({
2018
2036
  commit: mergeCommitForPublish,
2019
2037
  attempt: rebuildAttemptKey,