Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm run audit:dependencies:production
- run: pnpm run check
- name: Verify persistent Morphogenesis and paper evidence
run: |
node examples/agent-morphogenesis/persistent.mjs /tmp/morphogenesis-persistent-ci
node experiments/morphogenesis-paper/governance/verify-persistent.mjs /tmp/morphogenesis-persistent-ci
node experiments/morphogenesis-paper/governance/verify.mjs docs/research/morphogenesis-paper-v0.5/governance
MORPHOGENESIS_GOVERNANCE_EVIDENCE=docs/research/morphogenesis-paper-v0.5/governance node --test experiments/morphogenesis-paper/governance/verify.test.mjs
env:
MORPHOGENESIS_PG_PORT: "5432"
PGUSER: agentplat_test
PGDATABASE: agentplat_test
PGPASSWORD: agentplat_test
- run: pnpm --filter @agentplat/sessions-redis test
- run: pnpm --filter @agentplat/audit-postgres test
env:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## Unreleased

## 0.3.0-beta.9 — prepared, not yet published

- Add opt-in Morphogenesis supersession admission and terminal cleanup receipts,
retaining stable owner operation identities and the accepted morphology head.
- Add a workflow compensation adapter and authority-neutral Room projection.
- Preserve original fence timestamps during delayed owner reconciliation.
- Add a runnable PostgreSQL Room/Team/Work example, contract tests and bounded
TLA+ model. Publish paper v0.5 with separate adversarial admission evidence.
- All 65 packages move together; npm `next` distribution requires the existing
protected release workflow and human staged-package approval. No `latest`
promotion or production-reliability claim is part of this change.

## 0.3.0-beta.8 — published 2026-09-14 (UTC)

All 65 public packages are available under `next`; `latest` was not promoted.
Expand Down
57 changes: 57 additions & 0 deletions docs/adr/0054-morphogenesis-superseded-resolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# ADR 0054: explicit resolution of a superseded Morphogenesis execution

Status: implemented, opt-in preview. Historical evidence remains versioned.

## Problem

Morphology-head CAS selects one successor but does not roll back Team or Work
effects of another admitted proposal. The v0.3 paper integration demonstrated
owner cleanup while the losing V1 execution remained `committing_morphology`.
A timeout or a later head alone cannot establish that a proposal never committed.

## Decision

`beginSupersededResolution` reads the authoritative head through the optional
`inspectHead` activation port. It admits only `team_active` or
`committing_morphology`, with no retained activation receipt, and a different
proposal at exactly expected epoch + 1 in the same scope. The observed head is
persisted in an immutable supersession binding by execution CAS. Legacy ports
without inspection fail closed. Later epochs require historical proof outside
this API; the coordinator does not guess.

`advanceSupersededResolution` reuses the existing owner pipeline: checkpoint,
fence authority, drain/detach or retire, release budget, then `superseded`.
Uncertain effects keep their prepared operation identity and reconcile through
the original owner. Missing evidence blocks progress. Cleanup never modifies the
accepted head. The terminal supersession receipt is distinct from a normal
activation/completion receipt, and `complete` refuses supersession executions.

The workflow compensation adapter opts into this exact loser-specific path.
It is not a generic pre-Team cancellation or post-commit rollback facility.
Room projection is optional, tenant-scoped and grants no authority.

## Compatibility and obligations

The execution schema version remains 1; supersession fields are absent from
legacy records so their canonical digests do not change. New phases are emitted
only by the opt-in API. Exhaustive TypeScript consumers must accommodate
`superseding` and `superseded`; use `isMorphogenesisExecutionTerminalV1` when both
successful completion and compensated loss are terminal for the application.
This addition requires a new coordinated preview package release.

Owners still authenticate, deduplicate stable operation IDs, prevent new work
once fenced, and wait for admitted work to drain. The optional original
`fencedAtLogicalMs` result preserves receipt identity across delayed reconciliation;
omission retains legacy behavior. A receipt is evidence, not an authority grant.

## Validation

`tests/morphogenesis-supersession.test.mjs` covers recruitment and creation,
lost acknowledgements, concurrent resolution, ambiguous histories, unavailable
owners, forged receipts, legacy record digests and authority-neutral projection.
`examples/agent-morphogenesis/persistent-local.mjs` exercises real PostgreSQL,
Room approval, Team and Work reducers, head contention and pending work.
Its catalog/membership and reviewers are fixtures; its rollback witness is
process-local. These results are not independent-host recovery evidence.
The bounded TLA+ abstraction under `experiments/morphogenesis-paper/model` is
separate evidence, not a refinement proof of this implementation.
80 changes: 80 additions & 0 deletions docs/research/morphogenesis-paper-v0.5/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Agent Morphogenesis paper v0.5

The manuscript separates historical v0.4 results from the new opt-in runtime and
its evidence. PDF: `output/pdf/agent-morphogenesis-paper-v0.5.pdf`.

## Evidence index

- `manuscript.md`, `references.bib`: editable paper and citation metadata.
- `historical-cells.md`: all 48 historical condition/shape/fault cells, computed
from the unchanged v0.4 oracle scores. Seeds are not independent reliability trials.
- `governance/`: 36 prescribed authority/recovery cells with four real controllers,
PostgreSQL and a common experimental signed admission envelope. The registration
retains the issuer trust anchor, code hashes and the explicitly bounded design.
- `persistent/`: PostgreSQL Room/Team/Work integration, competing successors,
terminal supersession, lost fence acknowledgement, pending work and real mandate
expiry. The environment records compiled module hashes and fixture limitations.
- `model/`: TLC logs for the two-proposal finite model and three failing mutations.
- `verifier-tests.txt`: independent verifier's positive and negative controls.
- `development-attempts/`: engineering pilots and failed integration attempts,
excluded from the final observations.
- `review-response.md`: addressed feedback and remaining research limitations.

The v0.4 frozen artifact is available at the
[paper publication revision](https://github.com/Agentplat/agentplat/tree/22b60bdae0411496a5295021d8a3988118721a82/docs/research/morphogenesis-paper-v0.4).
Its experiment source baseline remains
[the original source revision](https://github.com/Agentplat/agentplat/tree/e978544915a329387e13883fa352191f6993dcc7).
Do not run that frozen registration against the new runtime and relabel the result
as the historical execution. New runtime evidence has its own source manifests.

The new runtime, paper and evidence are pinned together by the
[paper-v0.5 source tag](https://github.com/Agentplat/agentplat/tree/paper-v0.5).
Use that tag for reproduction; the separate environment manifests retain the
pre-commit working-tree and compiled-module hashes recorded during execution.

## Reproduce the new extension

From the `paper-v0.5` checkout, Node.js 22.13+, pnpm 11.25 and Docker:

```sh
pnpm install --frozen-lockfile
pnpm --filter @agentplat/workflows-postgres... --filter @agentplat/collective-host-postgres... --filter @agentplat/collective-control-postgres... --filter @agentplat/rooms-mesh... --filter @agentplat/workflows-rooms... --filter @agentplat/runtime-mock... build
node experiments/morphogenesis-paper/governance/run-local.mjs /tmp/governance-new
node experiments/morphogenesis-paper/governance/verify.mjs /tmp/governance-new
MORPHOGENESIS_GOVERNANCE_EVIDENCE=/tmp/governance-new node --test experiments/morphogenesis-paper/governance/verify.test.mjs
node examples/agent-morphogenesis/persistent-local.mjs /tmp/persistent-new
node experiments/morphogenesis-paper/governance/verify-persistent.mjs /tmp/persistent-new
node --test tests/morphogenesis-supersession.test.mjs tests/morphogenesis.test.mjs
```

Output directories must be new. Both wrappers create and remove dedicated
loopback PostgreSQL containers. No model keys or external inference are needed.
Signatures, UUIDs, timings and the identity of the race winner can differ between
runs; compare validated invariants and per-cell outcomes, not random bytes.

For retained evidence, use the same verifiers with this directory's `governance`
and `persistent` subdirectories. `model/` corresponds to
`experiments/morphogenesis-paper/model/Supersession.tla`; follow that folder's
README to repeat TLC with Java and the upstream TLC 1.7.4 jar. The tool and Java
runtime are development dependencies, not vendored binaries or npm dependencies.

Render with ReportLab and Times New Roman/Arial/Arial Unicode fonts:

```sh
python3 -B experiments/morphogenesis-paper/render-v05.py
```

## Evidence limits

The new authority matrix measures the common owner's admission contract, not a
security feature unique to the Morphogenesis core. The strongest workflow
baseline ties on admission safety and terminal controller-chain reconstruction.
The fixed controller has no organizational transition denominator. The minimal
controller's retained admission chains do not imply successful cleanup.

The persistent contention test is Morphogenesis-specific; comparative full P5
coverage across contending workflows is not established. Identity/catalog inputs
and scripted reviewers are fixtures; the rollback witness is process-local.
TLC explores a bounded abstraction under stated fairness and owner assumptions,
not the full TypeScript implementation. No LLM-quality or production-reliability
claim is made. This preprint has not been submitted to a venue by this task.
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"schemaVersion": 1,
"id": "authority-decision_expired-durable",
"condition": "durable",
"cell": "decision_expired",
"clock": {
"origin": "2026-09-20T00:00:00.000Z",
"admissionMs": 300,
"scope": "prescribed owner clock; no skew tested"
},
"trustedPublicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAMfu0J4jWbQ7FuHnbOqp128BwAlAo8k8ivcux4jb667w=\n-----END PUBLIC KEY-----\n",
"proposal": {
"schemaVersion": 1,
"proposalId": "proposal:authority-decision_expired-durable",
"scopeDigest": "sha256:3e47e49a21d3ba805b0aa16ee286b87d518e8dee9f871d1c02cd64cbf0283c99",
"currentSnapshotDigest": "sha256:2e5b56c49070db022d69eef49227459bc87e493e29901418375c896f49f41029",
"expectedCurrentEpoch": 1,
"needDigest": "sha256:1de032b0dcf9d83f7bbcf9b8cd06071b0a0f78acfab6b9154138b3259c864be4",
"targetDigest": "sha256:173669cf05c79d692da68da68bab25861f00d465c280b712e600999737b079ae",
"operations": [
{
"schemaVersion": 1,
"operationId": "operation:recruit:authority-decision_expired-durable",
"operator": "recruit_existing",
"effectClass": "protected_external",
"dependsOnOperationIds": [],
"targetReferenceDigest": "sha256:52ef937a941e557ed5d14ed62a7d5bcf462d2523d814860c058a7688bed1a3d1",
"compensation": "none",
"operationDigest": "sha256:53df618d24d99619e81374ef2c6abed6b9061bc07b5b7d4826238747b7bce94f"
}
],
"processDefinitionDigest": "sha256:62c37a60ab175f36e6ba0ff4025a9bb1f77a3c402075fa7e82515e3bda12d017",
"budget": {
"maximumActiveAgents": 3,
"maximumNewAgents": 0,
"maximumConcurrentProvisioning": 0,
"maximumResourceUnits": 10,
"maximumInteractionUnits": 100,
"maximumActionUnits": 10,
"maximumInputTokens": 100,
"maximumOutputTokens": 100,
"maximumTotalTokens": 200,
"maximumDurationMs": 1000,
"maximumCosts": [
{
"currency": "USD",
"micros": 1000000
}
],
"budgetDigest": "sha256:e55a2b7cc011fcd30dc92e5988ac8184bc8c11b28db1eae81308b8165fb20afe"
},
"decisionRoute": "authorized_agent",
"proposerId": "agent:planner",
"proposerVersion": 1,
"proposerImplementationDigest": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"proposedAtLogicalMs": 220,
"expiresAtLogicalMs": 500,
"advisoryOnly": true,
"proposalDigest": "sha256:8f625e04f3eea08b2db5c9c8ac150a4e3de3a7b2c7be4ba5079d0fb1ed2f2648"
},
"admissions": [
{
"request": {
"operationId": "authority-decision_expired-durable:durable-activate",
"proposalDigest": "sha256:8f625e04f3eea08b2db5c9c8ac150a4e3de3a7b2c7be4ba5079d0fb1ed2f2648",
"scopeDigest": "sha256:3e47e49a21d3ba805b0aa16ee286b87d518e8dee9f871d1c02cd64cbf0283c99",
"subject": "agent:statistics"
},
"payload": "{\"proposalDigest\":\"sha256:8f625e04f3eea08b2db5c9c8ac150a4e3de3a7b2c7be4ba5079d0fb1ed2f2648\",\"scopeDigest\":\"sha256:3e47e49a21d3ba805b0aa16ee286b87d518e8dee9f871d1c02cd64cbf0283c99\",\"subject\":\"agent:statistics\",\"issuer\":\"authority:reference\",\"validFrom\":200,\"decisionUntil\":290,\"mandateUntil\":400}",
"signature": "RYIKkhp4kuElnkct40IZzxfZ+RNiHtie8WjuQnP1xRc4EM+qwcXAWBdzy1gGVm+Omn0pXIqK/fFZJO98JdgcCA==",
"at": 300,
"ownerAllows": true,
"allowed": false
}
],
"roles": [],
"chains": [],
"events": [
{
"sequence": 1,
"phase": 0,
"kind": "artifact-accepted",
"artifactDigest": "sha256:31c0a2313fa7c248fc8f01ec72696691f9d280dda42134bb84a72ccd0c2598f6"
},
{
"sequence": 2,
"phase": 1,
"kind": "artifact-accepted",
"artifactDigest": "sha256:372966a351b3dd6c84060035b4b4990f5a964edf6567c5bb2385a47364c6ed64"
},
{
"sequence": 3,
"phase": 2,
"kind": "artifact-accepted",
"artifactDigest": "sha256:90ecde2f899e0d1d036fa4cc30be3328c7c59c424d89f093f085e503e3bc4c6d"
},
{
"sequence": 4,
"phase": 3,
"kind": "owner-authorization"
},
{
"sequence": 5,
"phase": 3,
"kind": "owner-reconciliation",
"operationId": "authority-decision_expired-durable:durable-activate"
}
],
"controller": {
"condition": "durable",
"done": false,
"role": null,
"workflowStates": [
{
"schemaVersion": 1,
"tenantId": "missions",
"runId": "authority-decision_expired-durable:activate",
"processId": "mission-role",
"processVersion": "1",
"definitionDigest": "sha256:997b2b32d3bb926054e301bb701115f94dde9c409f64249be306e78a80cb990b",
"revision": 1,
"status": "failed",
"stageStates": [
{
"stageId": "authorize",
"status": "terminal",
"attempt": 1,
"startedAt": "2026-09-19T12:00:30.000Z",
"taskRunId": "authority-decision_expired-durable:activate:authorize:1",
"outcome": "succeeded",
"finishedAt": "2026-09-19T12:00:30.000Z"
},
{
"stageId": "apply",
"status": "terminal",
"attempt": 1,
"startedAt": "2026-09-19T12:00:30.000Z",
"taskRunId": "authority-decision_expired-durable:activate:apply:1",
"outcome": "failed",
"finishedAt": "2026-09-19T12:00:30.000Z",
"reasonCode": "task_executor_error"
},
{
"stageId": "finalize",
"status": "terminal",
"attempt": 0,
"outcome": "skipped",
"finishedAt": "2026-09-19T12:00:30.000Z"
}
],
"input": {
"caseId": "authority-decision_expired-durable",
"action": "activate"
},
"createdAt": "2026-09-19T12:00:30.000Z",
"updatedAt": "2026-09-19T12:00:30.000Z",
"stateDigest": "sha256:bb14e0ed3c6704a0a3c16a3d3ce856c5fe70660ab962749485291f163c07960c"
}
]
},
"denied": true,
"limits": "Synthetic signed admission envelope around real controllers and PostgreSQL; not a production identity provider or policy benchmark"
}
Loading
Loading