Skip to content

THOTH-ASYNC-01-ADR-01: approve ADR-0012 shared async architecture - #960

Draft
ja573 wants to merge 42 commits into
feature/workerfrom
feature/async/adr-0012
Draft

ja573 wants to merge 42 commits into
feature/workerfrom
feature/async/adr-0012

Conversation

@ja573

@ja573 ja573 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

THOTH-ASYNC-01-ADR-01 - ADR-0012 shared async architecture, Amendment 9 final approval-state source

Programme: #957 THOTH-ASYNC-01
Owning task: #958 THOTH-ASYNC-01-ADR-01
Risk: CRITICAL

This PR carries the current Route-B approval-state version of ADR-0012 under
docs/engineering/decisions/README.md.

The architecture decision is APPROVED, but it is not yet repository-authoritative.
Repository authority still requires this exact approved version to pass the remaining
review and merge gates and become reachable from develop.

PR Draft/Ready state, checks, review/thread state, merge authorization and merge state
remain GitHub-owned lifecycle evidence rather than repository-source lifecycle records.

Current exact source identity

target:
feature/worker @ b44303c214498baf76c9d9a0a7cab374377f9cbe

source branch:
feature/async/adr-0012

current head:
e41f377202379238b91eb43d60f5115aa8adc20f

current tree:
38f4153d961f771f177ba354a717845115b2c497

direct parent:
8699af5635b8f18691ceaeccd3b24707a71ef4f2

final ADR-0012 blob:
cbe8322d95fe8d5e9911d421a5f10f1ae4afd55c

ADR state:
APPROVED / Javi, CTO / 2026-10-08

decision-register blob:
c618d9d2eec622660ee7c1868111f747efa27629

CHANGELOG blob:
2731521f363189063b9ab09068df7852889121a2

implementation-report blob:
5c3b5a096acd2b3c43161aca03249212a9a7c453

Amendment 9 Route-B approval lineage

The configured final-head review of the preceding Amendment-8 approval-state head
identified R-E258-01: coalescing attachment to an existing not-yet-started job
could race the first worker claim/start transition. A router could observe the job
as coalescible, the worker could start it, and the router could then attach a new
route disposition from its stale observation.

Specification Amendment 9 is recorded on #958 as comment 6046180884.

Its fresh independent CRITICAL specification review is recorded as APPROVED in
#958 comment 6046871411.

The content-approved Amendment-9 candidate was:

candidate head:
8699af5635b8f18691ceaeccd3b24707a71ef4f2

candidate ADR blob:
0fc33df9aca61a2c82af452426f5574bfd3493cf

candidate state:
PROPOSED

CTO exact candidate-content approval:
#958 comment 6065867982

The one bounded Route-B approval-state commit is the current head:

approval-state head:
e41f377202379238b91eb43d60f5115aa8adc20f

final ADR blob:
cbe8322d95fe8d5e9911d421a5f10f1ae4afd55c

state:
APPROVED / Javi, CTO / 2026-10-08

CTO exact-final-blob approval:
#958 comment 6066232057

Independent control inspection proved the final ADR is architecture-equivalent to
candidate blob 0fc33df9... after removing only the authorized approval-state
representation.

Effective specification

The current architecture is governed by the #958 base specification plus
Specification Amendments 1-9 and their associated review/control records.

Amendment 9 adds one durable ordering boundary between:

  • a new coalescing attachment to an existing coalescible logical job; and
  • that job's first successful durable execution claim/start transition.

For every logical job kind that permits many-route-to-one-job coalescing:

  • the job is coalescing-open only before that first successful claim/start;
  • the first committed claim/start permanently makes the job coalescing-sealed;
  • retry, lease reclaim, WAITING/resume, reconciliation, cancellation/recovery and
    later attempts never reopen coalescing;
  • attachment and first claim/start share one database-atomic serialization/lock/CAS
    boundary or equivalent database-enforced order;
  • a stale application-level pre-check followed by later attachment is insufficient.

The architecture defines both race orders:

  • attachment first: the disposition commits, and the later execution must genuinely
    represent every accepted pre-seal disposition/input under the kind's approved
    coalescing semantics;
  • claim/start first: the job seals, the later attachment is refused, no disposition
    is committed, the (event_id, route_key) slot remains unused, and the route
    obligation remains owed/visible through the existing error/attention-recovery path.

A rolled-back first claim does not durably seal the job.

The exact schema, SQL, lock and state encoding remain implementation-specification
details. CURRENT_STATE / REVISION_BOUND semantics, job identity, route-disposition
uniqueness, Amendment-8 withdrawal/selection ordering, target-scoped effect
serialization, claim-token fencing and external-write safety remain unchanged.

Current finding disposition

R-E258-01:
VALID / HIGH / MATERIAL ARCHITECTURAL CORRECTION

specification:
CLOSED BY SPECIFICATION AMENDMENT 9

source:
CLOSED IN CURRENT APPROVED SOURCE

existing PR review thread:
REMAINS OPEN PENDING FINAL-HEAD REVIEW / ADJUDICATION

The thread is intentionally not resolved by this metadata reconciliation.

What ADR-0012 continues to establish

ADR-0012 defines the shared PostgreSQL-backed asynchronous event/route/job architecture,
including:

  • one stable logical route_key;
  • append-only activation epochs;
  • immutable route-contract revisions;
  • canonical revision semantic signatures and atomic equivalent-revision convergence;
  • (event_id, route_key) disposition uniqueness;
  • continuous producer-emission-set coverage;
  • in-epoch IN_EPOCH_CONTRACT_MISMATCH anomalies;
  • revision-validated historical enrollment;
  • database-atomic withdrawal/selection ordering;
  • deterministic materializer compatibility;
  • per-revision route-health visibility;
  • safe revision withdrawal and permanent retirement;
  • explicit durable coalescing with the coalescing-open/coalescing-sealed boundary;
  • target-scoped duplicate/regression protection;
  • job attempts, leases/claim tokens, bounded retries and reconciliation safety;
  • trusted/untrusted worker boundaries;
  • the separately gated BE-04 expand/migrate/contract transition.

Repository and programme boundaries

thoth owns the generic durable engine and canonical PostgreSQL state.

Domain-specific provider/dissemination semantics remain in their owning repositories.
In particular, thoth-dissemination continues to own dissemination behaviour.

Cross-repository implementation remains separately decomposed, authorized and reviewed.
No downstream repository may guess an unmerged upstream contract.

Scope and effects

This PR is an architecture/documentation decision.

It does not authorize:

  • shared-engine runtime implementation;
  • schema/data migration execution;
  • BE-04/DIS-02 activation;
  • Hosting implementation;
  • provider/IAM/runtime mutation;
  • worker deployment;
  • external writes;
  • release;
  • production activation.

Architecture approval is not implementation authorization.

Cumulative PR footprint

Against feature/worker @ b44303c214498baf76c9d9a0a7cab374377f9cbe,
the PR footprint remains exactly:

CHANGELOG.md
docs/engineering/ai-delivery/implementation-reports/THOTH-ASYNC-01-ADR-01-implementation-report.md
docs/engineering/decisions/ADR-0008-machine-roles-and-durable-job-primitives.md
docs/engineering/decisions/ADR-0010-staff-operations-console.md
docs/engineering/decisions/ADR-0012-shared-asynchronous-event-and-job-execution.md
docs/engineering/decisions/decision-register.md

ADR-0008 and ADR-0010 carry only the bounded partial-supersession metadata already
approved in this PR. ADR-0013 and shared decision-process/control doctrine are unchanged.

Remaining gate sequence

separate CTO DRAFT -> READY authorization
-> DRAFT -> READY
-> fresh configured final-head automated review
-> adjudication of R-E258-01 and any new review findings
-> fresh independent CRITICAL exact-head review
-> separate CTO exact-head merge authorization
-> guarded merge
-> programme integration / ADR-0013 reliance reconciliation if applicable

No merge, programme reliance, runtime implementation, migration, deployment, release or
production activation is implied by this metadata reconciliation.

Tracks #957 and #958.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T18:31:02.256881Z e41f377 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd5223deee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ja573
ja573 marked this pull request as ready for review October 6, 2026 13:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9db91af7bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ja573
ja573 marked this pull request as draft October 6, 2026 17:32
ja573 added 3 commits October 6, 2026 18:57
Propose the Amendment-6/7 material pre-authority correction of ADR-0012
as a PROPOSED Route-B candidate (#958), closing R-9DB-01 in source.

- ADR-0012: Status APPROVED -> PROPOSED with no current approver or
  approval date. Every activation epoch references exactly one
  immutable route-contract revision with a canonical semantic
  signature; eligibility requires epoch membership and a match to that
  revision; continuous producer-version coverage with expand/contract
  and cross-route fan-out; durable IN_EPOCH_CONTRACT_MISMATCH
  anomalies; field-by-field historical-enrollment validation; atomic
  database-level revision equivalence; deterministic materializer
  compatibility; per-revision route health; safe revision withdrawal
  and route retirement. Superseded route-level-contract wording is
  reconciled across sections 3.2, 3.3, 3.9, 3.15, 7-12.
- decision register: ADR-0012 row PROPOSED; Last updated 2026-10-06.
- CHANGELOG: one new PROPOSED correction entry; history preserved.
- implementation report: candidate stage, Amendments 6-7 history and
  candidate validation evidence.

ADR-0008, ADR-0010, ADR-0013 and shared control files unchanged.
Architecture proposal only: no runtime, migration, provider,
deployment, release or activation change.
Record the CTO exact candidate-content approval of 2026-10-06 for the
Amendment-6/7 Route-B candidate (head b596536, ADR-0012 blob cd897d5)
as durable decision state, as the single approval-state commit Route B
permits (#958).

- ADR-0012: Status PROPOSED -> APPROVED, Approved by: Javi, CTO,
  Approval date: 2026-10-06, and the leading section 12 approval-state
  paragraphs; no architecture text changes (normalized comparison with
  the candidate blob shows no difference).
- decision register: ADR-0012 row approval state only.
- CHANGELOG: route-contract correction entry approval-state wording only.
- implementation report: approval-state stage, no-drift proof and
  validation evidence.

ADR-0008, ADR-0010, ADR-0013 and shared control files unchanged.
Architecture approval only: no runtime, migration, provider,
deployment, release or activation change.
Report-only control-record recovery of the Amendment-6/7 approval-state
report (#958). The approval-state authorization erroneously required the
report to copy the GitHub identifier of the CTO content-approval record
into repository source; repository-authoritative Route-B doctrine
(docs/engineering/decisions/README.md) prohibits that and takes
precedence.

- implementation report only: remove the copied identifier, record the
  content approval through owning issue #958, approval date 2026-10-06,
  candidate head b596536 and candidate ADR-0012 blob cd897d5, replace
  the deviation framing with the reconciled control fact, and record the
  recovery and its validation.

ADR-0012 (a7d95ca), its approval state, approver and date, the
decision register and CHANGELOG are unchanged. No runtime, migration,
provider, deployment, release or activation change.
@ja573
ja573 marked this pull request as ready for review October 7, 2026 11:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22bd94dc95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ja573
ja573 marked this pull request as draft October 7, 2026 11:28
Report-only correction of the control-record recovery report (#958,
PR #960) after the configured final-head automated review of the
recovery head 22bd94d. Control adjudicated its two findings on #958:
the topology finding rested on a non-head object and was rejected
against the authoritative PR head/parent graph (no lineage change);
the transient review-thread-state finding was accepted.

- implementation report only: stage-time review-thread inspections are
  rephrased as historical stage evidence, the live assertion about the
  number and resolved state of PR #960 review threads is replaced by
  durable wording that points to PR #960 as the authority for current
  thread state, the final-head review outcome is recorded substantively
  without review identifiers, and the correction and its validation are
  recorded as the current stage.

ADR-0012 (a7d95ca), its approval state, approver and date, the
decision register and CHANGELOG are unchanged. No runtime, migration,
provider, deployment, release or activation change.
@ja573
ja573 marked this pull request as ready for review October 7, 2026 15:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b4bb1b022

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ja573
ja573 marked this pull request as draft October 7, 2026 15:38
Two-path correction after the configured final-head automated review of
the transient-state correction head 9b4bb1b (#958, PR #960). Both
findings were accepted by control; the CTO classified the ADR change
as a FACTUAL CLARIFICATION of prior approved ADR-0012 blob a7d95ca.

- ADR-0012: replace the unconditional "exactly one durable disposition
  exists for each (event_id, route_key)" sentence in section 3.2,
  section 3.5 and invariant 8 with the at-most-one uniqueness rule, each
  paired with the already-selected rule that an eligible route
  obligation remains owed until it receives exactly one disposition.
  No-disposition cases (ineligible events, in-epoch mismatch, refused
  enrollment, approved divergence), validated enrollment, duplicate
  prevention, job idempotency, header approval fields and section 12 are
  unchanged; no architecture decision changes.
- implementation report: replace statements about which live PR #960
  lifecycle gate is pending with the durable lifecycle model (GitHub,
  through #958 and PR #960, owns current gate state), record the
  clarification and its validation, and advance the stage record.

Decision register and CHANGELOG unchanged. No runtime, migration,
provider, deployment, release or activation change.
@ja573
ja573 marked this pull request as ready for review October 7, 2026 16:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb3129f13a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ja573
ja573 marked this pull request as draft October 7, 2026 18:27
@ja573
ja573 marked this pull request as ready for review October 7, 2026 19:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2588f7b7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ja573
ja573 marked this pull request as draft October 7, 2026 21:09
@ja573
ja573 marked this pull request as ready for review October 8, 2026 18:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e41f377202

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +5801 to +5805
no slot is consumed;
- case 2, eligible backlog: an eligible obligation may temporarily have no
disposition while owed and visible (line 360; undispositioned eligible-event
backlog, line 552);
- case 3, in-epoch contract

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Serialize anomaly creation with revision withdrawal

When a producer records an in-epoch contract mismatch concurrently with withdrawal of the only selectable revision that could validly enroll it, withdrawal can observe no anomaly, pass the section 3.2 strand check, and commit before the event transaction records the anomaly; the required revision is then unavailable and the anomaly has no approved resolution path. Fresh evidence in this revision is this explicit deferral of the strand-check timing question, while the new atomic-order rule covers revision selection but not anomaly creation. Require anomaly creation and other mutations of the strand predicate to share a database-atomic order with withdrawal, or require a commit-time recheck, so invariant 39 can actually hold.

AGENTS.md reference: AGENTS.md:L350-L361

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CTO/control disposition: VALID / HIGH / BLOCKING as R-E41F-01. This is a MATERIAL ARCHITECTURAL CORRECTION: the current withdrawal/selection ordering does not make withdrawal's strand-prevention predicate stable against concurrent creation of an unresolved mismatch anomaly (or another already-defined mutation that can turn the predicate unsafe). The implementation report explicitly deferred this timing question. Specification Amendment 10 is recorded on #958 as comment 6066621583. This thread remains unresolved pending fresh independent CRITICAL specification review and a separately authorized Route-B correction.

@ja573
ja573 marked this pull request as draft October 8, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant