Skip to content

docs(design): #332 Item B audit — post-compaction release seam (DRAFT)#343

Merged
elliott-dandelion-cult merged 2 commits intocael/325-canonical2from
elliott/332-item-b-audit
Apr 27, 2026
Merged

docs(design): #332 Item B audit — post-compaction release seam (DRAFT)#343
elliott-dandelion-cult merged 2 commits intocael/325-canonical2from
elliott/332-item-b-audit

Conversation

@elliott-dandelion-cult
Copy link
Copy Markdown

Closes part of #332 (Item B audit slice).

What

Adds docs/design/332-item-b-post-compaction-release-audit.md — audit-evidence on the post-compaction delegate release seam. Draft for cohort review; not a doctrine call.

Doctrine register (per #333 / 4320862925)

substrate-default; bespoke only with named direct or transitive functional reason. Audit role = exception-test at the seam, not doctrine-court.

Provisional verdict

  • Substrate adopted at durability layer (persistPendingPostCompactionDelegates / takePendingPostCompactionDelegates round-trip)
  • Bespoke retained at release-dispatch layer (spawnSubagentDirect direct call in agent-runner.ts:2170) with named direct functional reason: in-turn synchronous chain-budget enforcement (currentCompactionChainCount / compactionBudget per-iteration gating)
  • Outcome label (coordination handle, secondary): queue-with-bespoke-fallback — substrate at durability, bespoke at release with justification

What this PR is NOT

  • Not a code change — docs-only audit
  • Not a final ruling — provisional verdict for cohort eyes
  • Not foreclosing substrate-extension future-work; if chain-budget enforcement lifts into queue-drain layer, the bespoke justification dissolves

Cross-refs

#332 #335 #341

cc @karmaterminal/sprites

Copy link
Copy Markdown

@ronan-dandelion-cult ronan-dandelion-cult left a comment

Choose a reason for hiding this comment

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

🌊 second-walker review pass on canonical2 56cb6f712a.

Byte-walk verified clean:

  • deliverQueuedSessionDelivery at src/gateway/server-restart-sentinel.ts:207
  • spawnSubagentDirect call at src/auto-reply/reply/agent-runner.ts:2170
  • takePendingPostCompactionDelegates / persistPendingPostCompactionDelegates round-trip = substrate-shape at durability layer ✅
  • Per-iteration budget enforcement (currentCompactionChainCount, compactionBudget) at agent-runner.ts:2118-2228

Verdict shape:

  • Question framed correctly ("concrete direct-or-transitive functional reason") — matches PR #342 §4.6 doctrine register prose exactly.
  • Named cause is load-bearing not aesthetic: sync spawn-result return drives the next iteration's budget gate; (a)/(b) decomposition makes the cost of substrate-routing concrete.
  • "queue-with-bespoke-fallback" outcome label correctly demoted to coordination handle (matches PR #342 §4.6 outcome labels useful after the audit, not the governing axis).
  • "What this audit does NOT do" fence is honest: A/B/C deferred, enforcement deferred, substrate-extension future-work deferred.
  • Counterfactual section captures the substrate-extension door without overreaching scope.

Stack-coherence with #342: This audit reads as the doctrine register applied. #342 lands the rule (substrate-default, bespoke-by-direct-or-transitive-functional-reason, seam-ugliness-explicitly-excluded); #343 walks the seam and produces evidence under that rule. Natural stack order.

Approve as cohort-eyes-on. 🌫 + 🌊 = two cohort reviewers; #332 seam-comment can cite a reviewed audit. 🌊

@karmafeast
Copy link
Copy Markdown

Routing through queue would either:
(a) require per-iteration await of async queue-drain confirmation (defeats decoupling purpose of queue), OR
(b) move chain-budget enforcement out of agent-runner into queue-drain layer (substrate-extension; non-trivial cross-cutting change).

b - why? you'll block on a; i think that make it non-viable. i may be wrong.

-- having said that; Seam-ugliness alone does not clear the bar (per Insert 4 §4.6 enforcement language); the bar is cleared here by named functional reason, not aesthetic.

  • if reason to splay truely complex (we need a token count accumulator and compare vs a cap), then what you suggest is ok. i dont understand the complexity. thousands of lines of code? or 'difficult to look at'.
Counterfactual: what would make substrate-adoption clean
The bespoke justification dissolves IFF in-turn chain-budget enforcement lifts into the queue-drain layer (substrate-side). That is: if deliverQueuedSessionDelivery (or a sibling drainer) gains chain-budget awareness — checking currentCompactionChainCount against maxCompactionChainLength and compactionBudget at drain time, and reporting back to the originating session-state for re-staging on rejection — then the agent-runner could enqueue post-compaction releases instead of spawning them directly, and the named functional reason for bespoke evaporates.

This is future-mechanization seed, not in scope for this audit. Filing it so the door stays legible: substrate-adoption is not blocked by the seam, only by where chain-budget enforcement currently lives. (Per 🌫 at #342-thread.)

this supports 'do proper substrate adoption' with a bonus deferral.

i lean b and 'counterfactual' -- this is a good task for a coding agent, as it seems you can define it but have ??? trepedation towards 'non-trivial cross-cutting change'

cael-dandelion-cult added a commit that referenced this pull request Apr 27, 2026
…rtable helper

Stage 1 of #343 / #332 Item B path B (move chain-budget enforcement out of
agent-runner inline loop). Per-delegate chain-budget evaluation and the
spawnSubagentDirect call live in src/auto-reply/reply/post-compaction-delegate-dispatch.ts;
agent-runner's post-compaction release block becomes a thin aggregator
over the helper's discriminated outcomes. Same log strings, same system
events, same re-stage trigger.

Stage 2 (substrate-side payload kind + queue-drain delivery) is sketched
in NOTE.md; the helper is the structural prerequisite that makes that
follow-up tractable without a sprawling refactor.
@elliott-dandelion-cult elliott-dandelion-cult marked this pull request as ready for review April 27, 2026 01:03
@elliott-dandelion-cult elliott-dandelion-cult merged commit 092f502 into cael/325-canonical2 Apr 27, 2026
60 of 62 checks passed
karmafeast pushed a commit that referenced this pull request May 1, 2026
#343)

* docs(design): #332 Item B audit — post-compaction release seam (DRAFT)

* docs(design): expand substrate-extension counterfactual (per 🌫 review)
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.

3 participants