pi-spine 1.2.0 → 1.4.0
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/README.md +4 -4
- package/bin/spine-cli/verify.mjs +6 -0
- package/bin/spine-deps.mjs +0 -2
- package/bin/spine-plan.mjs +49 -1
- package/bin/spine-rules.mjs +0 -2
- package/bin/spine-settings.mjs +0 -2
- package/bin/spine-worker-runner.mjs +136 -4
- package/bin/spine.mjs +2 -5
- package/package.json +2 -2
- package/skills/create-spine-tasks/SKILL.md +7 -2
- package/skills/create-spine-tasks/references/contract-template.md +95 -3
- package/src/batch/attached-engine-handoff.mjs +0 -1
- package/src/batch/attached-runner.mjs +81 -5
- package/src/batch/contract-stub-delivery.mjs +110 -0
- package/src/batch/contract-task-start.mjs +204 -0
- package/src/batch/contract-verify.mjs +160 -16
- package/src/batch/detached-start.mjs +72 -2
- package/src/batch/diagnosis-launch-failure.mjs +114 -0
- package/src/batch/diagnosis-primary-failure.mjs +89 -0
- package/src/batch/diagnosis-retry-limbo.mjs +1 -1
- package/src/batch/diagnosis-tail-state.mjs +57 -0
- package/src/batch/diagnosis.mjs +22 -114
- package/src/batch/engine-lanes/commit.mjs +145 -0
- package/src/batch/engine-lanes/merge.mjs +1 -2
- package/src/batch/engine-lanes/review.mjs +124 -121
- package/src/batch/engine-lanes.mjs +21 -81
- package/src/batch/engine.mjs +46 -1
- package/src/batch/evidence.mjs +1 -2
- package/src/batch/git-exec.mjs +5 -2
- package/src/batch/heartbeat.mjs +2 -2
- package/src/batch/integrate-assert.mjs +69 -0
- package/src/batch/integrate-worktree.mjs +354 -0
- package/src/batch/integrate.mjs +195 -102
- package/src/batch/journal-rebuild.mjs +158 -3
- package/src/batch/journal.mjs +63 -0
- package/src/batch/lane-commit.mjs +6 -5
- package/src/batch/lane-dirty-check.mjs +513 -0
- package/src/batch/limbo-detect.mjs +34 -0
- package/src/batch/macro-phase.mjs +76 -0
- package/src/batch/metrics.mjs +2 -0
- package/src/batch/pause.mjs +18 -7
- package/src/batch/post-merge-limbo.mjs +3 -28
- package/src/batch/reconcile.mjs +79 -10
- package/src/batch/resume-common.mjs +27 -0
- package/src/batch/resume-multi-lanes.mjs +11 -0
- package/src/batch/resume-multi.mjs +3 -1
- package/src/batch/resume.mjs +8 -4
- package/src/batch/retry.mjs +41 -10
- package/src/batch/review-spawn.mjs +1 -1
- package/src/batch/review.mjs +0 -4
- package/src/batch/rules-manifest-drift.mjs +43 -2
- package/src/batch/sequence-state.mjs +290 -0
- package/src/batch/sequence.mjs +113 -51
- package/src/batch/state.mjs +16 -0
- package/src/batch/worker-host.mjs +14 -5
- package/src/cli/deps.mjs +0 -2
- package/src/cli/sequence.mjs +14 -1
- package/src/cli/settings-set.mjs +33 -3
- package/src/config/contract.mjs +10 -0
- package/src/config/model-id.mjs +103 -0
- package/src/config/spine-init-constants.mjs +1 -0
- package/src/config/spine-preflight-lib.mjs +23 -1
- package/src/dashboard/public/dashboard.css +8 -0
- package/src/dashboard/public/dashboard.js +36 -9
- package/src/dashboard/running-tail-state.mjs +31 -0
- package/src/dashboard/server.mjs +4 -0
- package/src/dashboard/snapshot.mjs +260 -29
- package/src/dashboard/view.mjs +112 -2
- package/src/doctor/agent-models.mjs +53 -0
- package/src/doctor/batch-size-guidance.mjs +30 -2
- package/src/doctor/pi-extension-conflict.mjs +169 -0
- package/src/doctor/run-doctor-checks.mjs +6 -0
- package/src/planner/scope.mjs +5 -1
- package/src/tasks/packet/parse-prompt.mjs +31 -1
- package/src/tasks/packet/validate-contract.mjs +108 -0
- package/src/tasks/packet/validate-prompt.mjs +0 -1
package/src/cli/sequence.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { resolveDefaultSpineBin } from "../batch/post-merge-limbo.mjs";
|
|
|
10
10
|
* @param {string[]} argv
|
|
11
11
|
*/
|
|
12
12
|
export function parseSequenceArgs(argv) {
|
|
13
|
-
/** @type {{ scope: string, fromWave: number, throughWave: number|null, attached: boolean, stopOnFailure: boolean, dryRun: boolean, json: boolean, skipPreflight: boolean }} */
|
|
13
|
+
/** @type {{ scope: string, fromWave: number, throughWave: number|null, attached: boolean, stopOnFailure: boolean, dryRun: boolean, json: boolean, skipPreflight: boolean, resume: boolean, autoApproveGate: boolean, force: boolean }} */
|
|
14
14
|
const parsed = {
|
|
15
15
|
scope: "pending",
|
|
16
16
|
fromWave: 0,
|
|
@@ -20,6 +20,9 @@ export function parseSequenceArgs(argv) {
|
|
|
20
20
|
dryRun: false,
|
|
21
21
|
json: false,
|
|
22
22
|
skipPreflight: false,
|
|
23
|
+
resume: false,
|
|
24
|
+
autoApproveGate: false,
|
|
25
|
+
force: false,
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
/** @type {string[]} */
|
|
@@ -42,6 +45,12 @@ export function parseSequenceArgs(argv) {
|
|
|
42
45
|
parsed.json = true;
|
|
43
46
|
} else if (arg === "--skip-preflight") {
|
|
44
47
|
parsed.skipPreflight = true;
|
|
48
|
+
} else if (arg === "--resume") {
|
|
49
|
+
parsed.resume = true;
|
|
50
|
+
} else if (arg === "--auto-approve-gate") {
|
|
51
|
+
parsed.autoApproveGate = true;
|
|
52
|
+
} else if (arg === "--force") {
|
|
53
|
+
parsed.force = true;
|
|
45
54
|
} else if (!arg.startsWith("--")) {
|
|
46
55
|
positional.push(arg);
|
|
47
56
|
}
|
|
@@ -91,9 +100,13 @@ export async function runSpineSequence({ projectRoot, args = [], spineBin = null
|
|
|
91
100
|
const result = await runSequence({
|
|
92
101
|
projectRoot,
|
|
93
102
|
plan: built.plan,
|
|
103
|
+
scope: parsed.scope,
|
|
94
104
|
fromWave: parsed.fromWave,
|
|
95
105
|
throughWave: parsed.throughWave,
|
|
106
|
+
resume: parsed.resume,
|
|
96
107
|
attached: parsed.attached,
|
|
108
|
+
autoApproveGate: parsed.autoApproveGate,
|
|
109
|
+
force: parsed.force,
|
|
97
110
|
stopOnFailure: parsed.stopOnFailure,
|
|
98
111
|
dryRun: parsed.dryRun,
|
|
99
112
|
skipPreflight: parsed.skipPreflight,
|
package/src/cli/settings-set.mjs
CHANGED
|
@@ -5,10 +5,19 @@
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
|
|
7
7
|
import { writeJsonAtomic } from "../fs/atomic-write.mjs";
|
|
8
|
+
import { normalizeModelId } from "../config/model-id.mjs";
|
|
8
9
|
import { parseSettingPath, validateSettingValue } from "../config/settings-fields.mjs";
|
|
9
10
|
import { validateSpineConfig } from "../config/spine-config-load.mjs";
|
|
10
11
|
import { getValueAtPath } from "./settings-show.mjs";
|
|
11
12
|
|
|
13
|
+
const MODEL_FIELD_PATHS = new Set([
|
|
14
|
+
"agents.worker.model",
|
|
15
|
+
"agents.reviewer.model",
|
|
16
|
+
"agents.reviewer.plan.model",
|
|
17
|
+
"agents.reviewer.code.model",
|
|
18
|
+
"agents.reviewer.final.model",
|
|
19
|
+
]);
|
|
20
|
+
|
|
12
21
|
/**
|
|
13
22
|
* @param {object} config
|
|
14
23
|
* @param {string} dottedPath
|
|
@@ -93,8 +102,29 @@ export function runSettingsSetOperation(config, { path, rawValue, dryRun = false
|
|
|
93
102
|
};
|
|
94
103
|
}
|
|
95
104
|
|
|
105
|
+
let settingValue = validated.normalizedValue;
|
|
106
|
+
if (MODEL_FIELD_PATHS.has(parsed.path) && typeof settingValue === "string" && settingValue !== "") {
|
|
107
|
+
const modelResult = normalizeModelId(settingValue);
|
|
108
|
+
if (!modelResult.ok) {
|
|
109
|
+
const message = modelResult.error;
|
|
110
|
+
if (json) {
|
|
111
|
+
return {
|
|
112
|
+
exitCode: 1,
|
|
113
|
+
output: `${JSON.stringify({ error: message }, null, 2)}\n`,
|
|
114
|
+
error: message,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
exitCode: 1,
|
|
119
|
+
output: `Error: ${message}\n`,
|
|
120
|
+
error: message,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
settingValue = modelResult.value;
|
|
124
|
+
}
|
|
125
|
+
|
|
96
126
|
const previousValue = getValueAtPath(config, parsed.path);
|
|
97
|
-
const nextConfig = applySetting(config, parsed.path,
|
|
127
|
+
const nextConfig = applySetting(config, parsed.path, settingValue);
|
|
98
128
|
const validationError = validateSpineConfig(nextConfig);
|
|
99
129
|
if (validationError) {
|
|
100
130
|
const message = validationError.message;
|
|
@@ -118,7 +148,7 @@ export function runSettingsSetOperation(config, { path, rawValue, dryRun = false
|
|
|
118
148
|
const payload = {
|
|
119
149
|
path: parsed.path,
|
|
120
150
|
previousValue,
|
|
121
|
-
newValue:
|
|
151
|
+
newValue: settingValue,
|
|
122
152
|
dryRun,
|
|
123
153
|
wrote,
|
|
124
154
|
};
|
|
@@ -134,7 +164,7 @@ export function runSettingsSetOperation(config, { path, rawValue, dryRun = false
|
|
|
134
164
|
|
|
135
165
|
return {
|
|
136
166
|
exitCode: 0,
|
|
137
|
-
output: `Updated ${parsed.path}: ${formatValue(previousValue)} → ${formatValue(
|
|
167
|
+
output: `Updated ${parsed.path}: ${formatValue(previousValue)} → ${formatValue(settingValue)}${dryRun ? " (dry run)" : ""}\n`,
|
|
138
168
|
...payload,
|
|
139
169
|
config: nextConfig,
|
|
140
170
|
};
|
package/src/config/contract.mjs
CHANGED
|
@@ -33,6 +33,16 @@ export function validateContractConfig(config) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
if (contract.testRetries != null) {
|
|
37
|
+
if (typeof contract.testRetries !== "number" || !Number.isInteger(contract.testRetries) || contract.testRetries < 0) {
|
|
38
|
+
return {
|
|
39
|
+
code: "CONFIG_CONTRACT_TEST_RETRIES_INVALID",
|
|
40
|
+
message: "contract.testRetries must be a non-negative integer when set",
|
|
41
|
+
suggestedCommand: "spine settings set contract.testRetries 1",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
if (contract.legacyTaskIdPrefixes != null) {
|
|
37
47
|
if (!Array.isArray(contract.legacyTaskIdPrefixes)) {
|
|
38
48
|
return {
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model id validation and normalization (SP-422 / #76).
|
|
3
|
+
* Canonical pi model id format: `provider/model` (e.g. `google/gemini-3.1-pro-preview`).
|
|
4
|
+
* Pi TUI display labels use `model [provider]` (e.g. `gemini-3.1-pro-preview [google]`).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const DISPLAY_LABEL_RE = /^([a-z0-9][a-z0-9._-]*)\s+\[([a-z0-9][a-z0-9._-]*)\]$/i;
|
|
8
|
+
const CANONICAL_RE = /^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$/i;
|
|
9
|
+
const SPECIAL_VALUES = new Set(["inherit", ""]);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} value
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
export function isDisplayLabel(value) {
|
|
16
|
+
if (typeof value !== "string") return false;
|
|
17
|
+
return DISPLAY_LABEL_RE.test(value.trim());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Convert a pi TUI display label (`model [provider]`) to canonical `provider/model`.
|
|
22
|
+
* Returns null when the input does not match the display label pattern.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} value
|
|
25
|
+
* @returns {string|null}
|
|
26
|
+
*/
|
|
27
|
+
export function displayLabelToCanonical(value) {
|
|
28
|
+
if (typeof value !== "string") return null;
|
|
29
|
+
const match = value.trim().match(DISPLAY_LABEL_RE);
|
|
30
|
+
if (!match) return null;
|
|
31
|
+
return `${match[2]}/${match[1]}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} value
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
export function isCanonicalModelId(value) {
|
|
39
|
+
if (typeof value !== "string") return false;
|
|
40
|
+
return CANONICAL_RE.test(value.trim());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Normalize a model id for `spine settings set`.
|
|
45
|
+
* Display labels are converted to canonical form; canonical ids pass through;
|
|
46
|
+
* special values (`inherit`, empty) pass through.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} value
|
|
49
|
+
* @returns {{ ok: true, value: string } | { ok: false, error: string }}
|
|
50
|
+
*/
|
|
51
|
+
export function normalizeModelId(value) {
|
|
52
|
+
if (typeof value !== "string") {
|
|
53
|
+
return { ok: false, error: "Model id must be a string" };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const trimmed = value.trim();
|
|
57
|
+
if (SPECIAL_VALUES.has(trimmed)) {
|
|
58
|
+
return { ok: true, value: trimmed };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (isCanonicalModelId(trimmed)) {
|
|
62
|
+
return { ok: true, value: trimmed };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const canonical = displayLabelToCanonical(trimmed);
|
|
66
|
+
if (canonical) {
|
|
67
|
+
return { ok: true, value: canonical };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
ok: false,
|
|
72
|
+
error: `Invalid model id "${trimmed}". Use canonical provider/model format (e.g. google/gemini-3.1-pro-preview). Run \`pi --list-models\` for available ids.`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Validate that a model id already stored in config is canonical.
|
|
78
|
+
* Used by doctor checks — flags display labels and unrecognized formats.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} value
|
|
81
|
+
* @returns {{ ok: true } | { ok: false, error: string, canonical?: string, suggestedCommand?: string }}
|
|
82
|
+
*/
|
|
83
|
+
export function validateModelIdFormat(value) {
|
|
84
|
+
if (typeof value !== "string") return { ok: true };
|
|
85
|
+
const trimmed = value.trim();
|
|
86
|
+
if (SPECIAL_VALUES.has(trimmed)) return { ok: true };
|
|
87
|
+
|
|
88
|
+
if (isCanonicalModelId(trimmed)) return { ok: true };
|
|
89
|
+
|
|
90
|
+
const canonical = displayLabelToCanonical(trimmed);
|
|
91
|
+
if (canonical) {
|
|
92
|
+
return {
|
|
93
|
+
ok: false,
|
|
94
|
+
error: `display label "${trimmed}" — use canonical id ${canonical}`,
|
|
95
|
+
canonical,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
ok: false,
|
|
101
|
+
error: `invalid model id "${trimmed}" — expected provider/model format`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -40,6 +40,7 @@ export const SPINE_INIT_TESTING_COMMAND = "npm run typecheck && npm test";
|
|
|
40
40
|
export const SPINE_INIT_COVERAGE_COMMAND = "npm run coverage:check";
|
|
41
41
|
|
|
42
42
|
export const SPINE_GITIGNORE_ENTRIES = [
|
|
43
|
+
".pi/",
|
|
43
44
|
".spine/runtime/",
|
|
44
45
|
".spine/batch-state.json",
|
|
45
46
|
".spine/batch-history.json",
|
|
@@ -36,6 +36,24 @@ export const ORCH_MULTI_FILE_MERGE_RISK_PATHS = Object.freeze([
|
|
|
36
36
|
const LIMBO_DIAGNOSES = new Set(["limbo_stale", "completed_manual"]);
|
|
37
37
|
const DEPENDENCIES_SCHEMA_VERSION = 1;
|
|
38
38
|
const TASK_ID_PATTERN = /^[A-Z]{2,}-\d{3,}$/;
|
|
39
|
+
const PI_SESSION_METADATA_PREFIX = ".pi/";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Pi session metadata under `.pi/` is not project source (issue #81).
|
|
43
|
+
*
|
|
44
|
+
* @param {string} relPath
|
|
45
|
+
*/
|
|
46
|
+
export function isPiSessionMetadataPath(relPath) {
|
|
47
|
+
const normalized = String(relPath).replace(/\\/g, "/").replace(/^\.\/+/, "");
|
|
48
|
+
return normalized === ".pi" || normalized.startsWith(PI_SESSION_METADATA_PREFIX);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {string[]} dirtyPaths
|
|
53
|
+
*/
|
|
54
|
+
export function filterPiSessionDirtyPaths(dirtyPaths) {
|
|
55
|
+
return dirtyPaths.filter((relPath) => !isPiSessionMetadataPath(relPath));
|
|
56
|
+
}
|
|
39
57
|
|
|
40
58
|
/**
|
|
41
59
|
* @param {object} ctx
|
|
@@ -177,12 +195,16 @@ export function checkGitClean(ctx) {
|
|
|
177
195
|
});
|
|
178
196
|
}
|
|
179
197
|
|
|
180
|
-
const
|
|
198
|
+
const allDirtyPaths = output
|
|
181
199
|
.split(/\r?\n/)
|
|
182
200
|
.filter(Boolean)
|
|
183
201
|
.map((line) => line.slice(3).trim() || line.trim());
|
|
202
|
+
const dirtyPaths = filterPiSessionDirtyPaths(allDirtyPaths);
|
|
184
203
|
|
|
185
204
|
if (dirtyPaths.length === 0) {
|
|
205
|
+
if (allDirtyPaths.length > 0) {
|
|
206
|
+
return makeCheck("git-clean", true, "working tree clean (.pi/ session metadata ignored)");
|
|
207
|
+
}
|
|
186
208
|
return makeCheck("git-clean", true, "working tree clean");
|
|
187
209
|
}
|
|
188
210
|
|
|
@@ -92,6 +92,14 @@ body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
|
|
|
92
92
|
.lane-status-running { color: var(--running); }
|
|
93
93
|
.lane-status-stale { color: var(--warn); }
|
|
94
94
|
.lane-status-completed { color: var(--muted); }
|
|
95
|
+
tr.task-failed { background: rgba(248, 81, 73, 0.1); }
|
|
96
|
+
tr.task-failed td { color: var(--error); }
|
|
97
|
+
tr.task-failed td.col-running,
|
|
98
|
+
tr.task-failed td.col-queued { color: var(--error); }
|
|
99
|
+
tr.task-succeeded { background: rgba(63, 185, 80, 0.08); }
|
|
100
|
+
tr.task-succeeded td.lane-status-completed { color: var(--running); }
|
|
101
|
+
tr.task-running { background: rgba(210, 153, 34, 0.08); }
|
|
102
|
+
tr.task-running td.lane-status-running { color: var(--paused); }
|
|
95
103
|
.empty-hint { color: var(--muted); font-style: italic; }
|
|
96
104
|
.gate-status { font-weight: 600; text-transform: uppercase; font-size: 0.75rem; }
|
|
97
105
|
.gate-status-pending, .gate-status-missing { color: var(--warn); }
|
|
@@ -194,8 +194,8 @@ function appendLaneTextCell(td, text, className, ariaLabel) {
|
|
|
194
194
|
td.setAttribute("aria-label", ariaLabel);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
/** @param {ReturnType<typeof buildDashboardViewModel>["lanes"]} lanes @param {ReturnType<typeof buildDashboardViewModel>["laneTableSummary"]} laneTableSummary @param {string|null} expandedLaneId */
|
|
198
|
-
function renderLanes(lanes, laneTableSummary, expandedLaneId) {
|
|
197
|
+
/** @param {ReturnType<typeof buildDashboardViewModel>["lanes"]} lanes @param {ReturnType<typeof buildDashboardViewModel>["laneTableSummary"]} laneTableSummary @param {ReturnType<typeof buildDashboardViewModel>["tailActivity"]} tailActivity @param {string|null} expandedLaneId */
|
|
198
|
+
function renderLanes(lanes, laneTableSummary, tailActivity, expandedLaneId) {
|
|
199
199
|
const tbody = $("lane-table-body");
|
|
200
200
|
tbody.replaceChildren();
|
|
201
201
|
const columnCount = 11;
|
|
@@ -226,13 +226,29 @@ function renderLanes(lanes, laneTableSummary, expandedLaneId) {
|
|
|
226
226
|
}
|
|
227
227
|
tr.dataset.laneId = lane.laneId;
|
|
228
228
|
tr.setAttribute("aria-expanded", lane.laneId === expandedLaneId ? "true" : "false");
|
|
229
|
-
const statusLabel =
|
|
230
|
-
lane.laneAlert === "checkpoint-warning"
|
|
231
|
-
? `${lane.status} · checkpoint warning`
|
|
232
|
-
: lane.laneAlert === "stall-killed"
|
|
233
|
-
? `${lane.status} · stall killed`
|
|
234
|
-
: lane.status;
|
|
235
229
|
const throughput = lane.throughput ?? {};
|
|
230
|
+
const failedCount = throughput.failedCount ?? 0;
|
|
231
|
+
const isTaskFailed = failedCount > 0 || lane.activityPhase === "failed";
|
|
232
|
+
const isTaskSucceeded = lane.status === "completed" && !isTaskFailed;
|
|
233
|
+
const isTaskRunning = lane.status === "running" && !isTaskFailed;
|
|
234
|
+
if (isTaskFailed) tr.classList.add("task-failed");
|
|
235
|
+
else if (isTaskSucceeded) tr.classList.add("task-succeeded");
|
|
236
|
+
else if (isTaskRunning) tr.classList.add("task-running");
|
|
237
|
+
let statusLabel;
|
|
238
|
+
if (isTaskFailed) {
|
|
239
|
+
const failedEvent = (lane.detail?.recentEvents ?? []).find((e) => e.type === "task.failed");
|
|
240
|
+
const rawReason = failedEvent?.summary ?? "";
|
|
241
|
+
const exitReason = rawReason.split("→")[0].replace(/,\s*$/, "").trim();
|
|
242
|
+
statusLabel = exitReason ? `❌ FAILED — ${exitReason}` : "❌ FAILED";
|
|
243
|
+
} else if (isTaskSucceeded) {
|
|
244
|
+
statusLabel = "✅ Done";
|
|
245
|
+
} else if (lane.laneAlert === "checkpoint-warning") {
|
|
246
|
+
statusLabel = `${lane.status} · checkpoint warning`;
|
|
247
|
+
} else if (lane.laneAlert === "stall-killed") {
|
|
248
|
+
statusLabel = `${lane.status} · stall killed`;
|
|
249
|
+
} else {
|
|
250
|
+
statusLabel = lane.status;
|
|
251
|
+
}
|
|
236
252
|
const runningText = formatRunningCell(lane.runningTaskId);
|
|
237
253
|
const queuedText = formatQueuedCell(lane.queuedTaskIds ?? []);
|
|
238
254
|
const cellSpecs = [
|
|
@@ -311,6 +327,17 @@ function renderLanes(lanes, laneTableSummary, expandedLaneId) {
|
|
|
311
327
|
});
|
|
312
328
|
tbody.appendChild(tr);
|
|
313
329
|
}
|
|
330
|
+
if (tailActivity?.visible && tailActivity.tailActivityLabel) {
|
|
331
|
+
const tr = document.createElement("tr");
|
|
332
|
+
tr.className = "lane-table-tail-activity";
|
|
333
|
+
const td = document.createElement("td");
|
|
334
|
+
td.colSpan = columnCount;
|
|
335
|
+
td.className = "empty-hint lane-tail-activity";
|
|
336
|
+
td.textContent = tailActivity.tailActivityLabel;
|
|
337
|
+
td.setAttribute("aria-label", `Batch activity: ${tailActivity.tailActivityLabel}`);
|
|
338
|
+
tr.appendChild(td);
|
|
339
|
+
tbody.appendChild(tr);
|
|
340
|
+
}
|
|
314
341
|
}
|
|
315
342
|
|
|
316
343
|
/** @param {ReturnType<typeof buildDashboardViewModel>["lanes"][number]} lane */
|
|
@@ -485,7 +512,7 @@ export function renderSnapshot(snapshot) {
|
|
|
485
512
|
if (!vm.idle) {
|
|
486
513
|
renderBatch(vm.batch);
|
|
487
514
|
renderWaves(vm.waves);
|
|
488
|
-
renderLanes(vm.lanes, vm.laneTableSummary, expandedLaneIdState);
|
|
515
|
+
renderLanes(vm.lanes, vm.laneTableSummary, vm.tailActivity, expandedLaneIdState);
|
|
489
516
|
renderJournalLaneFilter(vm.journalLaneFilterOptions);
|
|
490
517
|
renderJournal(vm.journal);
|
|
491
518
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running tail-state detection for dashboard + batch headlines (GitHub #68).
|
|
3
|
+
* Browser-safe — no Node or batch-layer imports.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} ctx
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export function isRunningWithoutActiveWorkers(ctx = {}) {
|
|
11
|
+
if (ctx.hasRunningTasks === true || ctx.hasPendingTasks === true) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if ((ctx.pendingTaskCount ?? 0) > 0) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const totalTasks = ctx.totalTasks ?? 0;
|
|
18
|
+
if (totalTasks <= 0) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const succeededTasks = ctx.succeededTasks ?? 0;
|
|
22
|
+
const failedTasks = ctx.failedTasks ?? 0;
|
|
23
|
+
if (succeededTasks + failedTasks < totalTasks) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const phase = ctx.phase ?? "";
|
|
27
|
+
if (phase !== "running" && phase !== "merging") {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
package/src/dashboard/server.mjs
CHANGED
|
@@ -25,6 +25,10 @@ const STATIC_ROUTES = {
|
|
|
25
25
|
file: path.join("..", "lane-throughput.mjs"),
|
|
26
26
|
contentType: "text/javascript; charset=utf-8",
|
|
27
27
|
},
|
|
28
|
+
"/running-tail-state.mjs": {
|
|
29
|
+
file: path.join("..", "running-tail-state.mjs"),
|
|
30
|
+
contentType: "text/javascript; charset=utf-8",
|
|
31
|
+
},
|
|
28
32
|
};
|
|
29
33
|
|
|
30
34
|
/**
|