pantheon-opencode 1.5.0-beta.6 β 1.5.0-beta.8
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/CHANGELOG.md +77 -0
- package/README.md +31 -10
- package/package.json +4 -3
- package/plugin.json +1 -1
- package/pyproject.toml +10 -2
- package/scripts/mcp_persistence_server.py +24 -5
- package/scripts/versioning.mjs +108 -7
- package/src/agents/mnemosyne.md +1 -1
- package/src/mcp/mcp_persistence_server.py +24 -5
- package/src/pantheon/background-job-board.ts +29 -1
- package/src/pantheon/cost-command.ts +249 -3
- package/src/pantheon/delegation-finalize.ts +32 -0
- package/src/pantheon/delegation.ts +235 -18
- package/src/pantheon/file-persistence-salvage.ts +64 -0
- package/src/pantheon/file-persistence.ts +194 -45
- package/src/pantheon/v2-events.ts +14 -6
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,83 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
18
18
|
|
|
19
19
|
## β
Closed Issues
|
|
20
20
|
|
|
21
|
+
## [v1.5.0-beta.8] - 2026-09-13
|
|
22
|
+
|
|
23
|
+
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
24
|
+
move this section to a versioned entry and reset the template below. -->
|
|
25
|
+
|
|
26
|
+
## π Fixed
|
|
27
|
+
|
|
28
|
+
- **Board persistence is corruption- and concurrency-safe:** state writes now go
|
|
29
|
+
through a UNIQUE temp file (per-process, per-write counter + random suffix), are
|
|
30
|
+
`fsync`ed, then renamed over the destination with bounded ENOENT retries, and
|
|
31
|
+
read-modify-write cycles on the same state path are serialized. This closes the
|
|
32
|
+
window where two writers could interleave and corrupt `state.json` or race the
|
|
33
|
+
rename.
|
|
34
|
+
- **Corrupt board state is quarantined and salvaged:** a malformed `state.json` is
|
|
35
|
+
moved aside to `<state>.corrupt-<ts>`, a clear error is logged, and every complete
|
|
36
|
+
record that can be parsed is salvaged and returned instead of throwing β so
|
|
37
|
+
delete/prune/recover callers cannot get stuck in a retry loop.
|
|
38
|
+
- **P1-1 β no orphan `.signal.json` on reconcile:** reconcile now deletes any
|
|
39
|
+
still-pending wake signal instead of re-writing it. Reconcile is an
|
|
40
|
+
acknowledgment, not a new terminal transition, so the finalizeβreconcile cycle
|
|
41
|
+
no longer leaves a stale `<alias>.signal.json` with `state:"reconciled"` behind.
|
|
42
|
+
- **Unresolved `{sessionID}` template guard:** the TUI/runtime can hand the plugin
|
|
43
|
+
the unsubstituted literal `{sessionID}` (or `%7BsessionID%7D`) when no session is
|
|
44
|
+
focused; the plugin now refuses placeholder session ids at the delegation,
|
|
45
|
+
bootstrap-probe, and activity-sample boundaries instead of forwarding them to the
|
|
46
|
+
session API (which rejected every call).
|
|
47
|
+
- **Delegation lookup scoped to the calling session:** `pantheon_delegation_read`
|
|
48
|
+
resolves exact task IDs first (must belong to the caller's session), then alias
|
|
49
|
+
matches within that session (exactly one required). Cross-session and ambiguous
|
|
50
|
+
aliases now return explicit errors instead of the generic "Unknown delegation".
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [v1.5.0-beta.7] - 2026-09-13
|
|
54
|
+
|
|
55
|
+
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
56
|
+
move this section to a versioned entry and reset the template below. -->
|
|
57
|
+
|
|
58
|
+
## π What's New
|
|
59
|
+
|
|
60
|
+
- **Cost CLI fallback + `PANTHEON_NODE`:** `pantheon_cost` falls back to a
|
|
61
|
+
read-only `node scripts/cost.mjs` subprocess when `node:sqlite` is
|
|
62
|
+
unavailable in the host runtime (for example under Bun). The fallback
|
|
63
|
+
resolves a real Node.js binary β `PANTHEON_NODE` first, then `node` on
|
|
64
|
+
`PATH` β probes it for `node:sqlite` support (Node.js >= 22.5), and runs it
|
|
65
|
+
with an argument array, never a shell. Previously the tool returned
|
|
66
|
+
`status: UNSUPPORTED` with no fallback.
|
|
67
|
+
- **Delegation engine contract (ADR-0011):** legacy `pantheon_delegate` remains
|
|
68
|
+
the default engine through v1.5.x; native delegation is opt-in and
|
|
69
|
+
experimental via `PANTHEON_DELEGATE_MODE=native` until v1.6. See
|
|
70
|
+
[ADR-0011](https://github.com/ils15/pantheon-opencode/pull/126) (Proposed).
|
|
71
|
+
|
|
72
|
+
## π Fixed
|
|
73
|
+
|
|
74
|
+
- **Legacy read-only bypass on retry (P0):** a retried delegation now
|
|
75
|
+
re-applies read-only enforcement (the same rule as the initial child) and
|
|
76
|
+
registers the retry session, closing the bypass where a retried child could
|
|
77
|
+
write despite `read_only: true` or being a read-only agent.
|
|
78
|
+
- **Kill-switch scope (P0):** `PANTHEON_DELEGATION=off` now also disables the
|
|
79
|
+
legacy engine, not only the native manager β the legacy delegate/read/list
|
|
80
|
+
tools throw as documented.
|
|
81
|
+
- **Delegation signal leak (P1):** the legacy finalize path now deletes the
|
|
82
|
+
auto-wake signal file, so terminal delegations no longer leave stale
|
|
83
|
+
`.signal.json` artifacts behind.
|
|
84
|
+
- **Crash recovery is durable (P1):** `recoverRunningJobs` persists the
|
|
85
|
+
`error` state, marks the job `terminalUnreconciled`, and emits the terminal
|
|
86
|
+
signal plus notification for every reaped job instead of updating memory
|
|
87
|
+
only.
|
|
88
|
+
- **Atomic concurrency (P1):** `registerLaunch` validates
|
|
89
|
+
`maxConcurrentPerAgent` before any mutation, so concurrent dispatches cannot
|
|
90
|
+
both claim the last slot. A refused launch tears down the orphan child
|
|
91
|
+
session (read-only unregister plus `session.delete`) and the retry path
|
|
92
|
+
re-validates the same limit.
|
|
93
|
+
- **Legacy board hygiene (P1):** the legacy finalize path now runs
|
|
94
|
+
`pruneCompleted` and `enforceEntryCap`, matching the native manager and
|
|
95
|
+
preventing unbounded board growth.
|
|
96
|
+
- **Resilient V2 events:** a native child refused by the per-agent limit is
|
|
97
|
+
logged and skipped instead of aborting the rest of the event handler.
|
|
21
98
|
## [v1.5.0-beta.6] - 2026-09-12
|
|
22
99
|
|
|
23
100
|
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
package/README.md
CHANGED
|
@@ -76,22 +76,43 @@ availability and configuration of OpenCode and any optional services you choose
|
|
|
76
76
|
to use. Check the [releases](https://github.com/ils15/pantheon-opencode/releases)
|
|
77
77
|
and [changelog](CHANGELOG.md) for the latest published changes.
|
|
78
78
|
|
|
79
|
-
##
|
|
79
|
+
## Delegation engines (legacy default, native opt-in)
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
Pantheon exposes two delegation engines behind one tool surface:
|
|
82
|
+
|
|
83
|
+
- **Legacy (default)** β `pantheon_delegate`, the original engine registered by
|
|
84
|
+
the V1 plugin. No configuration is required.
|
|
85
|
+
- **Native (opt-in, experimental)** β OpenCode's native `task()` child-session
|
|
86
|
+
engine, selected with `PANTHEON_DELEGATE_MODE=native`. Native is strict: it
|
|
87
|
+
does not use foreground fallback, model failover, or retry; it performs a
|
|
88
|
+
lazy capability probe on the first dispatch and includes the resulting
|
|
89
|
+
status in the delegation receipt.
|
|
90
|
+
|
|
91
|
+
Legacy stays the default for v1.5.x; native is not promoted to default until
|
|
92
|
+
v1.6. See [ADR-0011](.pantheon/memory-bank/adr/0011-delegation-engine-contract.md)
|
|
93
|
+
(Proposed) for the engine contract, rationale, and migration prerequisites.
|
|
94
|
+
|
|
95
|
+
**Kill-switch:** set `PANTHEON_DELEGATION=off` (case-insensitive) to disable
|
|
96
|
+
delegation entirely. The switch covers **both** engines β the legacy
|
|
97
|
+
`pantheon_delegate`/read/list tools throw, and the native manager throws too.
|
|
85
98
|
|
|
86
99
|
## Cost tool backend
|
|
87
100
|
|
|
88
|
-
`pantheon_cost`
|
|
89
|
-
`opencode.db`.
|
|
90
|
-
|
|
91
|
-
a
|
|
92
|
-
`
|
|
101
|
+
`pantheon_cost` prefers a read-only `node:sqlite` backend against the selected
|
|
102
|
+
`opencode.db`. When `node:sqlite` is unavailable in the host runtime (for
|
|
103
|
+
example under Bun), the tool falls back to spawning `node scripts/cost.mjs` as
|
|
104
|
+
a read-only subprocess. The fallback resolves a real Node.js binary β
|
|
105
|
+
`PANTHEON_NODE` first, then `node` on `PATH` β verifies it supports
|
|
106
|
+
`node:sqlite` (Node.js >= 22.5), and runs the script with an argument array,
|
|
107
|
+
never a shell. If neither source resolves, the tool returns `status:
|
|
108
|
+
UNSUPPORTED`. Database failures return a contract status such as `UNAVAILABLE`
|
|
109
|
+
or `CORRUPT_DATA` and include diagnostic detail, including captured stderr when
|
|
93
110
|
available.
|
|
94
111
|
|
|
112
|
+
| Variable | Default | Purpose |
|
|
113
|
+
|----------|---------|---------|
|
|
114
|
+
| `PANTHEON_NODE` | `node` from `PATH` | Path to a Node.js >= 22.5 binary used by the CLI fallback; an explicit path must exist and be executable, otherwise the tool fails fast instead of ignoring the override |
|
|
115
|
+
|
|
95
116
|
|
|
96
117
|
## Code-mode execution (explicit opt-in)
|
|
97
118
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-opencode",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.8",
|
|
4
4
|
"description": "Multi-agent orchestration for OpenCode β 14 specialized agents, TDD, Themis review gates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"test:security": "npm run secret-scan",
|
|
42
42
|
"test:node": "node --test tests/*.mjs tests/pantheon/*.mjs",
|
|
43
43
|
"test:ts": "for f in tests/pantheon/*.test.ts; do if [ \"$f\" = tests/pantheon/plugin-v2-contract.test.ts ]; then NODE_OPTIONS=--conditions=import tsx \"$f\"; else tsx \"$f\"; fi || exit 1; done",
|
|
44
|
-
"test": "
|
|
45
|
-
"test
|
|
44
|
+
"test:all": "npm run test:ci && npm run test:node && npm run test:ts",
|
|
45
|
+
"test": "npm run test:all",
|
|
46
|
+
"test:ci": "python3 -m pytest -q --tb=short 2>&1"
|
|
46
47
|
},
|
|
47
48
|
"bin": {
|
|
48
49
|
"pantheon-opencode": "bin/pantheon-init.mjs"
|
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.5.0-beta.
|
|
4
|
+
"version": "1.5.0-beta.8",
|
|
5
5
|
"displayName": "Pantheon",
|
|
6
6
|
"description": "Conductor-Delegate orchestration platform with 14 specialized agents, 21 skills, and OpenCode support.",
|
|
7
7
|
"agents": "./src/agents",
|
package/pyproject.toml
CHANGED
|
@@ -4,13 +4,21 @@ build-backend = "setuptools.backends._legacy:_Backend"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pantheon"
|
|
7
|
-
version = "1.5.0-beta.
|
|
7
|
+
version = "1.5.0-beta.8"
|
|
8
8
|
description = "Multi-agent orchestration framework"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = []
|
|
11
11
|
|
|
12
12
|
[tool.pytest.ini_options]
|
|
13
|
-
|
|
13
|
+
# `tests/` holds the main suite; the two entries below are orphaned test
|
|
14
|
+
# modules that live next to the code they cover and are collected here so
|
|
15
|
+
# pytest (and therefore `npm test`) exercises them instead of letting them
|
|
16
|
+
# rot as dead code.
|
|
17
|
+
testpaths = [
|
|
18
|
+
"tests",
|
|
19
|
+
"scripts/vector_memory/test_memory.py",
|
|
20
|
+
"benchmarks/beta2/test_beta2.py",
|
|
21
|
+
]
|
|
14
22
|
asyncio_mode = "auto"
|
|
15
23
|
addopts = "-v --tb=short"
|
|
16
24
|
|
|
@@ -777,13 +777,32 @@ def _validate_heartbeat(heartbeat: object) -> None:
|
|
|
777
777
|
raise ValueError("heartbeat.turn_count must be a non-negative integer")
|
|
778
778
|
|
|
779
779
|
|
|
780
|
+
def _validate_version_metadata(version: object) -> None:
|
|
781
|
+
"""Validate optional checkpoint ``version`` metadata leniently.
|
|
782
|
+
|
|
783
|
+
``version`` is opaque application metadata (rehydrate does not consume it),
|
|
784
|
+
not a persistence requirement. It may be a positive integer, a JSON float
|
|
785
|
+
such as ``1.0``, or a version label like ``"1.5.0-beta.2"``. Absent/null
|
|
786
|
+
versions and any non-empty string remain valid, preserving existing integer
|
|
787
|
+
checkpoints while allowing forward-compatible labels. Only bools, empty
|
|
788
|
+
strings, non-finite/zero/negative numbers, and structured values are
|
|
789
|
+
rejected.
|
|
790
|
+
"""
|
|
791
|
+
if version is None:
|
|
792
|
+
return
|
|
793
|
+
if isinstance(version, bool):
|
|
794
|
+
raise ValueError("version must be a positive integer or version label")
|
|
795
|
+
if isinstance(version, (int, float)):
|
|
796
|
+
if not 1 <= version < float("inf"):
|
|
797
|
+
raise ValueError("version must be a positive integer or version label")
|
|
798
|
+
return
|
|
799
|
+
if not isinstance(version, str) or not version.strip():
|
|
800
|
+
raise ValueError("version must be a positive integer or version label")
|
|
801
|
+
|
|
802
|
+
|
|
780
803
|
def _validate_checkpoint_shape(checkpoint: dict) -> None:
|
|
781
804
|
"""Validate bounded structured checkpoint fields without sanitizing them."""
|
|
782
|
-
|
|
783
|
-
if version is not None and (
|
|
784
|
-
isinstance(version, bool) or not isinstance(version, int) or version < 1
|
|
785
|
-
):
|
|
786
|
-
raise ValueError("version must be a positive integer")
|
|
805
|
+
_validate_version_metadata(checkpoint.get("version"))
|
|
787
806
|
validators = (
|
|
788
807
|
("goal", _validate_goal),
|
|
789
808
|
("phase", _validate_phase),
|
package/scripts/versioning.mjs
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { execFileSync } from 'node:child_process'
|
|
24
|
-
import { readFileSync } from 'node:fs'
|
|
25
|
-
import { dirname, join } from 'node:path'
|
|
24
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
25
|
+
import { basename, dirname, join } from 'node:path'
|
|
26
26
|
import { fileURLToPath } from 'node:url'
|
|
27
27
|
import {
|
|
28
28
|
commitPreparedUpdates,
|
|
@@ -37,6 +37,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
|
37
37
|
const ROOT = join(__dirname, '..')
|
|
38
38
|
|
|
39
39
|
const CHANGELOG_PATH = join(ROOT, 'CHANGELOG.md')
|
|
40
|
+
const ZENODO_PATH = join(ROOT, '.zenodo.json')
|
|
41
|
+
const CITATION_PATH = join(ROOT, 'CITATION.cff')
|
|
40
42
|
|
|
41
43
|
// ---------------------------------------------------------------------------
|
|
42
44
|
// Git helpers
|
|
@@ -111,6 +113,90 @@ function prepareManifests(newVersion) {
|
|
|
111
113
|
return { inventory, updates: prepareInventoryVersion(inventory, newVersion) }
|
|
112
114
|
}
|
|
113
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Serialize `.zenodo.json` the way Biome 2.x formats it: objects stay expanded
|
|
118
|
+
* (matching `JSON.stringify(value, null, 2)`), while arrays containing only
|
|
119
|
+
* primitives are collapsed onto one line when they fit within the line width.
|
|
120
|
+
* A plain `JSON.stringify` emits the `keywords` array multiline, which Biome
|
|
121
|
+
* collapses β reintroducing a lint failure on the next release bump.
|
|
122
|
+
*
|
|
123
|
+
* @param {unknown} value parsed JSON document
|
|
124
|
+
* @param {number} [lineWidth] formatter line width (matches biome.json)
|
|
125
|
+
* @returns {string} Biome-compatible JSON with a trailing newline
|
|
126
|
+
*/
|
|
127
|
+
function formatZenodoJson(value, lineWidth = 100) {
|
|
128
|
+
const indent = (depth) => ' '.repeat(depth)
|
|
129
|
+
const render = (node, depth, column) => {
|
|
130
|
+
if (Array.isArray(node)) {
|
|
131
|
+
if (node.length === 0) return '[]'
|
|
132
|
+
const primitiveOnly = node.every((item) => item === null || typeof item !== 'object')
|
|
133
|
+
if (primitiveOnly) {
|
|
134
|
+
const inline = `[${node.map((item) => JSON.stringify(item)).join(', ')}]`
|
|
135
|
+
if (column + inline.length <= lineWidth) return inline
|
|
136
|
+
}
|
|
137
|
+
const body = node
|
|
138
|
+
.map((item) => `${indent(depth + 1)}${render(item, depth + 1, indent(depth + 1).length)}`)
|
|
139
|
+
.join(',\n')
|
|
140
|
+
return `[\n${body}\n${indent(depth)}]`
|
|
141
|
+
}
|
|
142
|
+
if (node !== null && typeof node === 'object') {
|
|
143
|
+
const entries = Object.entries(node)
|
|
144
|
+
if (entries.length === 0) return '{}'
|
|
145
|
+
const body = entries
|
|
146
|
+
.map(([key, item]) => {
|
|
147
|
+
const keyPrefix = `${indent(depth + 1)}${JSON.stringify(key)}: `
|
|
148
|
+
return `${keyPrefix}${render(item, depth + 1, keyPrefix.length)}`
|
|
149
|
+
})
|
|
150
|
+
.join(',\n')
|
|
151
|
+
return `{\n${body}\n${indent(depth)}}`
|
|
152
|
+
}
|
|
153
|
+
return JSON.stringify(node)
|
|
154
|
+
}
|
|
155
|
+
return `${render(value, 0, 0)}\n`
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Keep the Zenodo deposition metadata (.zenodo.json) and the citation file
|
|
160
|
+
* (CITATION.cff) aligned with the version and date being released. Zenodo's
|
|
161
|
+
* release validator hard-fails when CITATION.cff version differs from the
|
|
162
|
+
* release tag, so these must be bumped together with the manifests.
|
|
163
|
+
*/
|
|
164
|
+
function prepareReleaseMetadata(newVersion, dateStr) {
|
|
165
|
+
if (!SEMVER_PATTERN.test(newVersion)) throw new Error(`invalid version: ${newVersion}`)
|
|
166
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) throw new Error(`invalid date: ${dateStr}`)
|
|
167
|
+
const tagUrl = `https://github.com/ils15/pantheon-opencode/releases/tag/v${newVersion}`
|
|
168
|
+
const updates = []
|
|
169
|
+
|
|
170
|
+
if (existsSync(ZENODO_PATH)) {
|
|
171
|
+
const zenodo = JSON.parse(readFileSync(ZENODO_PATH, 'utf8'))
|
|
172
|
+
const zenodoPrevious = typeof zenodo.version === 'string' ? zenodo.version : null
|
|
173
|
+
if (zenodoPrevious && zenodoPrevious !== newVersion && typeof zenodo.description === 'string') {
|
|
174
|
+
zenodo.description = zenodo.description.replaceAll(zenodoPrevious, newVersion)
|
|
175
|
+
}
|
|
176
|
+
zenodo.version = newVersion
|
|
177
|
+
zenodo.publication_date = dateStr
|
|
178
|
+
zenodo.url = tagUrl
|
|
179
|
+
updates.push({ path: ZENODO_PATH, content: formatZenodoJson(zenodo) })
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (existsSync(CITATION_PATH)) {
|
|
183
|
+
const citationRaw = readFileSync(CITATION_PATH, 'utf8')
|
|
184
|
+
const citationMatch = /^version:\s*["']?([^"'\s]+)["']?\s*$/m.exec(citationRaw)
|
|
185
|
+
const citationPrevious = citationMatch ? citationMatch[1] : null
|
|
186
|
+
let citation = citationRaw
|
|
187
|
+
if (citationPrevious && citationPrevious !== newVersion) {
|
|
188
|
+
citation = citation.replaceAll(`Pantheon v${citationPrevious}`, `Pantheon v${newVersion}`)
|
|
189
|
+
}
|
|
190
|
+
citation = citation
|
|
191
|
+
.replace(/^version:.*$/m, `version: ${newVersion}`)
|
|
192
|
+
.replace(/^date-released:.*$/m, `date-released: ${dateStr}`)
|
|
193
|
+
.replace(/^url:.*$/m, `url: ${tagUrl}`)
|
|
194
|
+
updates.push({ path: CITATION_PATH, content: citation })
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return updates
|
|
198
|
+
}
|
|
199
|
+
|
|
114
200
|
// ---------------------------------------------------------------------------
|
|
115
201
|
// CHANGELOG updater
|
|
116
202
|
//
|
|
@@ -243,8 +329,8 @@ function contentHasUnreleased() {
|
|
|
243
329
|
return readFileSync(CHANGELOG_PATH, 'utf8').includes('## [Unreleased]')
|
|
244
330
|
}
|
|
245
331
|
|
|
246
|
-
function commitPreparedRelease(manifestPlan, changelogPlan) {
|
|
247
|
-
const updates = [...manifestPlan.updates]
|
|
332
|
+
function commitPreparedRelease(manifestPlan, changelogPlan, metadataUpdates = []) {
|
|
333
|
+
const updates = [...manifestPlan.updates, ...metadataUpdates]
|
|
248
334
|
if (changelogPlan.changed) {
|
|
249
335
|
updates.push({ path: CHANGELOG_PATH, content: changelogPlan.content })
|
|
250
336
|
}
|
|
@@ -252,6 +338,9 @@ function commitPreparedRelease(manifestPlan, changelogPlan) {
|
|
|
252
338
|
for (const document of manifestPlan.inventory.documents) {
|
|
253
339
|
console.log(` β ${document.entry.file} β ${manifestPlan.version}`)
|
|
254
340
|
}
|
|
341
|
+
for (const { path } of metadataUpdates) {
|
|
342
|
+
console.log(` β ${basename(path)} β ${manifestPlan.version}`)
|
|
343
|
+
}
|
|
255
344
|
if (changelogPlan.changed) {
|
|
256
345
|
console.log(
|
|
257
346
|
changelogPlan.notesGenerated
|
|
@@ -314,7 +403,11 @@ switch (command) {
|
|
|
314
403
|
console.log(`Bumping ${current} β ${newVersion} (beta)`)
|
|
315
404
|
const changelogPlan = prepareUnreleased(newVersion, date)
|
|
316
405
|
const manifestPlan = prepareManifests(newVersion)
|
|
317
|
-
commitPreparedRelease(
|
|
406
|
+
commitPreparedRelease(
|
|
407
|
+
{ ...manifestPlan, version: newVersion },
|
|
408
|
+
changelogPlan,
|
|
409
|
+
prepareReleaseMetadata(newVersion, date),
|
|
410
|
+
)
|
|
318
411
|
console.log(`\nDone. Commit the version inventory and CHANGELOG as v${newVersion}.`)
|
|
319
412
|
console.log(`Tag v${newVersion} will be created by the release workflow after merge to main.`)
|
|
320
413
|
break
|
|
@@ -347,7 +440,11 @@ switch (command) {
|
|
|
347
440
|
const notesBody = generateNotes()
|
|
348
441
|
const changelogPlan = prepareUnreleased(current, date, notesBody)
|
|
349
442
|
const manifestPlan = prepareManifests(current)
|
|
350
|
-
commitPreparedRelease(
|
|
443
|
+
commitPreparedRelease(
|
|
444
|
+
{ ...manifestPlan, version: current },
|
|
445
|
+
changelogPlan,
|
|
446
|
+
prepareReleaseMetadata(current, date),
|
|
447
|
+
)
|
|
351
448
|
console.log(`Tag v${current} will be created by the release workflow after merge to main.`)
|
|
352
449
|
break
|
|
353
450
|
}
|
|
@@ -360,7 +457,11 @@ switch (command) {
|
|
|
360
457
|
const notesBody = generateNotes()
|
|
361
458
|
const changelogPlan = prepareUnreleased(newVersion, date, notesBody)
|
|
362
459
|
const manifestPlan = prepareManifests(newVersion)
|
|
363
|
-
commitPreparedRelease(
|
|
460
|
+
commitPreparedRelease(
|
|
461
|
+
{ ...manifestPlan, version: newVersion },
|
|
462
|
+
changelogPlan,
|
|
463
|
+
prepareReleaseMetadata(newVersion, date),
|
|
464
|
+
)
|
|
364
465
|
console.log(`\nDone. Commit the version inventory and CHANGELOG as v${newVersion}.`)
|
|
365
466
|
console.log(`Tag v${newVersion} will be created by the release workflow after merge to main.`)
|
|
366
467
|
break
|
package/src/agents/mnemosyne.md
CHANGED
|
@@ -777,13 +777,32 @@ def _validate_heartbeat(heartbeat: object) -> None:
|
|
|
777
777
|
raise ValueError("heartbeat.turn_count must be a non-negative integer")
|
|
778
778
|
|
|
779
779
|
|
|
780
|
+
def _validate_version_metadata(version: object) -> None:
|
|
781
|
+
"""Validate optional checkpoint ``version`` metadata leniently.
|
|
782
|
+
|
|
783
|
+
``version`` is opaque application metadata (rehydrate does not consume it),
|
|
784
|
+
not a persistence requirement. It may be a positive integer, a JSON float
|
|
785
|
+
such as ``1.0``, or a version label like ``"1.5.0-beta.2"``. Absent/null
|
|
786
|
+
versions and any non-empty string remain valid, preserving existing integer
|
|
787
|
+
checkpoints while allowing forward-compatible labels. Only bools, empty
|
|
788
|
+
strings, non-finite/zero/negative numbers, and structured values are
|
|
789
|
+
rejected.
|
|
790
|
+
"""
|
|
791
|
+
if version is None:
|
|
792
|
+
return
|
|
793
|
+
if isinstance(version, bool):
|
|
794
|
+
raise ValueError("version must be a positive integer or version label")
|
|
795
|
+
if isinstance(version, (int, float)):
|
|
796
|
+
if not 1 <= version < float("inf"):
|
|
797
|
+
raise ValueError("version must be a positive integer or version label")
|
|
798
|
+
return
|
|
799
|
+
if not isinstance(version, str) or not version.strip():
|
|
800
|
+
raise ValueError("version must be a positive integer or version label")
|
|
801
|
+
|
|
802
|
+
|
|
780
803
|
def _validate_checkpoint_shape(checkpoint: dict) -> None:
|
|
781
804
|
"""Validate bounded structured checkpoint fields without sanitizing them."""
|
|
782
|
-
|
|
783
|
-
if version is not None and (
|
|
784
|
-
isinstance(version, bool) or not isinstance(version, int) or version < 1
|
|
785
|
-
):
|
|
786
|
-
raise ValueError("version must be a positive integer")
|
|
805
|
+
_validate_version_metadata(checkpoint.get("version"))
|
|
787
806
|
validators = (
|
|
788
807
|
("goal", _validate_goal),
|
|
789
808
|
("phase", _validate_phase),
|
|
@@ -222,15 +222,28 @@ export class BackgroundJobBoard {
|
|
|
222
222
|
async recoverRunningJobs(): Promise<void> {
|
|
223
223
|
if (!this.persistence) return
|
|
224
224
|
const records = await this.persistence.loadAllJobs()
|
|
225
|
+
const recoveredIDs: string[] = []
|
|
225
226
|
for (const record of records) {
|
|
226
227
|
if (record.state === 'running') {
|
|
227
228
|
record.state = 'error'
|
|
228
229
|
record.lastStatusError = 'Process restarted β job marked as errored'
|
|
229
230
|
record.updatedAt = Date.now()
|
|
231
|
+
record.completedAt = Date.now()
|
|
230
232
|
record.totalErrors++
|
|
233
|
+
record.terminalUnreconciled = true
|
|
234
|
+
recoveredIDs.push(record.taskID)
|
|
231
235
|
}
|
|
232
236
|
this.jobs.set(record.taskID, record)
|
|
233
237
|
}
|
|
238
|
+
// Persist + signal + notify for each recovered job (write-ahead-log pattern)
|
|
239
|
+
for (const taskID of recoveredIDs) {
|
|
240
|
+
const job = this.jobs.get(taskID)
|
|
241
|
+
if (job) {
|
|
242
|
+
await this.persistRecord(job)
|
|
243
|
+
await this.writeSignal(job)
|
|
244
|
+
this.notifyTerminal(job.taskID)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
234
247
|
}
|
|
235
248
|
|
|
236
249
|
// βββ Core Operations ββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -240,6 +253,16 @@ export class BackgroundJobBoard {
|
|
|
240
253
|
* The job starts in the `running` state with a generated alias.
|
|
241
254
|
*/
|
|
242
255
|
async registerLaunch(input: LaunchInput): Promise<BackgroundJobRecord> {
|
|
256
|
+
// Atomic concurrency check: validate BEFORE any mutation or await.
|
|
257
|
+
// JavaScript's single-threaded event loop guarantees this check + set
|
|
258
|
+
// cannot be interleaved with another registerLaunch call.
|
|
259
|
+
if (!this.canDispatch(input.agent)) {
|
|
260
|
+
throw new Error(
|
|
261
|
+
`Concurrency limit reached for agent "${input.agent}" ` +
|
|
262
|
+
`(${this.getRunningCount(input.agent)} running, max ${this.options.maxConcurrentPerAgent})`,
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
243
266
|
const prefix = getAgentPrefix(input.agent)
|
|
244
267
|
let sessionCounters = this.aliasCounters.get(input.parentSessionID)
|
|
245
268
|
if (!sessionCounters) {
|
|
@@ -434,7 +457,12 @@ export class BackgroundJobBoard {
|
|
|
434
457
|
job.terminalUnreconciled = false
|
|
435
458
|
|
|
436
459
|
await this.persistRecord(job)
|
|
437
|
-
|
|
460
|
+
// P1-1: reconcile is an acknowledgment, NOT a new terminal transition
|
|
461
|
+
// (onTerminal does not re-fire). Re-writing a `.signal.json` here leaked
|
|
462
|
+
// orphan signals with `state:"reconciled"` after the finalizeβreconcile
|
|
463
|
+
// cycle deleted them. Instead, remove any still-pending wake signal so
|
|
464
|
+
// reconcile leaves no `<alias>.signal.json` behind.
|
|
465
|
+
await this.deleteSignal(job.alias)
|
|
438
466
|
|
|
439
467
|
return job
|
|
440
468
|
}
|