Skip to content

docs(adr): ADR-0028 amendments from the adversarial review + ADR-0022 erratum (phantom broadcast) - #123

Merged
gonzafg2 merged 5 commits into
mainfrom
docs/adr-0028-amendments-adr-0022-erratum
Jul 19, 2026
Merged

gonzafg2 merged 5 commits into
mainfrom
docs/adr-0028-amendments-adr-0022-erratum

Conversation

@gonzafg2

Copy link
Copy Markdown
Owner

What

Two governance fixes from an adversarial review of ADR-0028 (merged in #122, Status Proposed):

  1. ADR-0028 amendments (in place — ADR-0015 immutability binds only Accepted ADRs).
  2. ADR-0022 erratum (ADR-0015 lane — factual claims false at acceptance): next commit on this branch.

Findings driving the amendments

# Finding Fix
H1 sync::broadcast shutdown referenced as existing; grep broadcast over the workspace: zero hits (the sync feature serves the exec mpsc channels) ADR-0028 now introduces the channel; ADR-0022 gets the erratum
H2 Drain never converges (no cooperative behaviour specified; ADR-0023 channel phase is un-timed) and a deadline abort skips exec.finished (async-path-only emission, channel.rs:535), breaking ADR-0023's every-exec.started-gets-an-exec.finished invariant Cooperative per-connection shutdown specified; invariant holds on the shutdown path; drop-guard required for abort/panic paths
H3 Up to 4 spawn_blocking tasks per exec (pumps + reap, exec.rs) × default cap 256 = 1024 > tokio's default 512 blocking threads → starvation at load Runtime sizes max_blocking_threads ≥ 4 × cap
H4 Alternative 4 claimed deterministic caps give "the same protection" as OpenSSH's probabilistic band — false at saturation (10 sources × 10 half-open = total, deterministic lockout) Claim corrected; lockout stated as an accepted §8.3 consequence + explicit Negative bullet
H5 Token bucket outside the stated evaluation order; refusal-reason precedence undefined Order fixed: rate limit → global → total half-open → per-source; first failure names reason
H6 connection.accepted/connection.refused co-occurrence unspecified (0.1.0 schema-freeze relevant) Declared mutually exclusive within the span
H7 Second-signal and exit-code semantics missing (the systemd ADR needs both) Second SIGTERM/SIGINT aborts immediately; exit 0 on both paths

Verified non-findings: workspace panic profile is unwind (RAII guards and JoinError logging hold), JoinSet/select!/signal available in the pinned tokio 1.51, accept()/join_next() cancel-safety.

Refs #109, follows #122.

https://claude.ai/code/session_01J2SZwLuDm1KjfYyPM8npTa

Still Proposed, so amended in place (ADR-0015 immutability binds only
Accepted ADRs). Findings addressed:

- The sync::broadcast shutdown channel does not exist yet (no
  broadcast anywhere in the workspace); the ADR now introduces it
  instead of consuming it, and points at the ADR-0022 erratum.
- Cooperative per-connection shutdown specified: in-flight execs run
  until exit or the imminent deadline, the child is killed through the
  owned-Child path, and exec.finished is emitted — the ADR-0023
  audit invariant holds on the shutdown path, with a drop-guard
  required for the abort and panic paths.
- Blocking-pool coupling declared: up to four spawn_blocking tasks
  per exec exceed tokio's default 512 threads at the default cap;
  the runtime sizes max_blocking_threads from the configured cap.
- Alternative 4 no longer claims deterministic caps give "the same
  protection" as the MaxStartups probabilistic band; the
  full-saturation lockout is stated as an accepted §8.3 consequence.
- Admission-check order fixed (rate limit first, then the three
  caps; first failure names the reason) and connection.refused /
  connection.accepted declared mutually exclusive.
- Second-signal (immediate abort) and exit-code semantics specified.

Claude-Session: https://claude.ai/code/session_01J2SZwLuDm1KjfYyPM8npTa
Signed-off-by: Gonzalo Fleming <[email protected]>
Copilot AI review requested due to automatic review settings July 19, 2026 05:02
@gonzafg2 gonzafg2 added the documentation Improvements or additions to documentation label Jul 19, 2026
…ever built

ADR-0015 errata lane: at acceptance (#86 sweep) this ADR claimed the
sync feature served a broadcast graceful-shutdown signal and that
Phase 1's broadcast shutdown path was driven by tests. Neither was
true — no broadcast exists in the workspace; sync serves the exec
layer's mpsc channels. Banner added; both claims corrected in place.
The shutdown broadcast is introduced by ADR-0028 (Phase 2).

Claude-Session: https://claude.ai/code/session_01J2SZwLuDm1KjfYyPM8npTa
Signed-off-by: Gonzalo Fleming <[email protected]>
@opencode-agent

Copy link
Copy Markdown

Review: PR #123 — ADR-0028 amendments + ADR-0022 erratum

Classification: ADR/RFC docs under docs/adr/. Reviewed for design soundness against MANIFIESTO commitments, threat model, and governance mechanics. No code.

Verdict: Approved. No high-signal findings.


ADR-0022 erratum — compliant with ADR-0015

The erratum corrects two factual claims that were false at acceptance:

  1. The sync feature was documented as providing a sync::broadcast shutdown channel — no broadcast path was ever built (workspace grep confirms zero broadcast hits).
  2. The signal exclusion claimed the phantom broadcast was "driven by tests."

The fix is correctly scoped: the sync feature rationale now reads mpsc — exec child-I/O channels, the signal exclusion states "Phase 1 ships no shutdown path at all," and the erratum banner carries date, PR reference, and description per ADR-0015. No decision change — the runtime choice, feature allowlist, and threading model are untouched. This is a textbook ADR-0015 erratum.

ADR-0028 amendments — sound under Proposed status

ADR-0028 is Proposed (ADR-0015 immutability binds only Accepted ADRs), so in-place amendment is governance-correct. Seven findings addressed:

Finding Fix quality
H1 — phantom broadcast referenced as existing Now states ADR-0028 introduces the channel; cross-references the ADR-0022 erratum. Internally consistent.
H2 — drain never converges; abort skips exec.finished Cooperative per-connection shutdown specified. Explicit commitment that ADR-0023's invariant holds on the shutdown path. Drop-guard required for abort/panic paths. Sound: this is the standard Rust pattern for the "finalize on drop" invariant, and the ADR-0024 audit-trail requirement (every exec.started must produce an exec.finished) is preserved.
H3 — blocking-pool starvation at load max_blocking_threads ≥ 4 × cap ties the runtime size to the admission cap. Correctly gates on admission control, not thread exhaustion.
H4 — false equivalence claim Deterministic caps now explicitly stated as not replicating OpenSSH's probabilistic band. Saturation lockout added as an explicit Negative bullet, accepted under §8.3. Honest.
H5 — token bucket outside evaluation order; refusal-reason undefined Four checks ordered: rate limit → global → total half-open → per-source. First failure names reason. Clean.
H6 — connection.accepted/connection.refused co-occurrence undefined Declared mutually exclusive within the span. Essential for 0.1.0 schema-freeze consumers.
H7 — second-signal and exit-code semantics missing Second SIGTERM/SIGINT aborts immediately; exit 0 on both paths. Satisfies the systemd ADR dependency.

Cross-reference integrity

  • ADR-0028 → ADR-0022 erratum: now correctly says ADR-0028 "introduces" the broadcast (not "reuses existing").
  • ADR-0022 → ADR-0028: the signal exclusion points at ADR-0028 as the introducer.
  • ADR-0028 → ADR-0023: the cooperative shutdown section correctly names the exec.started→exec.finished invariant and commits to preserving it.

MANIFIESTO + threat model alignment

  • chore(security): mark quantumssh.org aliases as live #4 (small surface): Token bucket and source map are first-party code — no new dependency. The signal feature delta is the single justified addition to the ADR-0022 allowlist.
  • Threat model §5.1.3: All three test handles (rate limits, half-open caps, deadlines) are now specified with configurable defaults.
  • Threat model §2.7 / ADR-0024: The exec.finished drop-guard preserves the audit invariant; connection.refused/connection.accepted mutual exclusivity is specified for the schema freeze.
  • Threat model §8.3: The non-DoS posture is correctly cited as the bound for saturation lockout (H4 fix).

github run

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates Phase-2 runtime governance documentation by amending ADR-0028 (Proposed) based on adversarial review findings and adding a post-acceptance erratum to ADR-0022 (Accepted) to correct factual claims that were already false at acceptance.

Changes:

  • Amend ADR-0028 to clarify admission-control evaluation order, shutdown semantics (including second-signal behavior), and operational constraints (blocking pool sizing, deterministic-cap trade-offs).
  • Add a Post-acceptance errata banner to ADR-0022 correcting the tokio sync feature rationale and removing the incorrect implication that Phase 1 had an existing shutdown broadcast path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/adr/0028-phase-2-concurrent-connections-limits-graceful-shutdown.md Clarifies Phase-2 concurrency admission checks, shutdown/drain/cooperative behavior, and operational sizing constraints.
docs/adr/0022-phase-1-async-runtime-tokio.md Adds annotated errata correcting previously inaccurate statements about Tokio feature usage and shutdown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@claude

claude Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

… exec.rs path

Review feedback on #123: the state-mutating rate-limit check moves to
last (a connection refused by a cap never grows the per-source map —
the load-shedding order for the rotating-source flood the ADR
discloses), the numbered list now carries all four checks, and the
Links path is spelled crates/quantumssh-core/src/exec.rs.

Claude-Session: https://claude.ai/code/session_01J2SZwLuDm1KjfYyPM8npTa
Signed-off-by: Gonzalo Fleming <[email protected]>
@opencode-agent

Copy link
Copy Markdown

I've read CLAUDE.md, the threat model summary, ADR-0015 (errata governance), and the full diff. This is an ADR/RFC docs PR — review is for design soundness, not code bugs.


Review: PR #123 — ADR-0028 amendments + ADR-0022 erratum

Classification: ADR/RFC docs under docs/adr/. Design-soundness review against MANIFIESTO commitments, threat model, and ADR-0015 governance.

Verdict: Approved. No high-signal findings.

All prior review comments (Copilot's 3-items-vs-4 mismatch, Claude's phantom src/exec.rs path, Claude's rate-limit-first ordering concern) are resolved in commit 1a0c9e8. The current files are internally consistent.


ADR-0022 erratum — compliant

  • Erratum banner carries date, PR reference, and description per ADR-0015.
  • Corrects two factual claims that were false at acceptance: the sync feature's stated purpose and the signal exclusion's phantom broadcast.
  • No decision change — runtime, feature allowlist, threading model untouched.
  • Textbook ADR-0015 erratum.

ADR-0028 amendments — sound

The final admission-check ordering (caps-first → rate-limit-last) is correct: three non-mutating O(1)/O(map) reads before the state-mutating token-bucket check. A saturated global cap drops connections without touching per-source state. The parent sentence names the "load-shedding" rationale, making the ordering deliberate rather than accidental.

Finding Final state
H1 phantom broadcast ADR-0028 now "introduces" the channel; cross-refs ADR-0022 erratum
H2 drain convergence + exec.finished Cooperative shutdown specified; drop-guard required; ADR-0023 invariant preserved
H3 blocking-pool starvation max_blocking_threads ≥ 4 × cap
H4 false equivalence Alternative 4 rewritten honestly; new Negative bullet for deterministic lockout
H5 evaluation order + refusal reason Four-item ordered list; caps-first, rate-limit-last; first failure names reason
H6 accepted/refused co-occurrence Declared mutually exclusive
H7 second-signal + exit code Second SIGTERM/SIGINT aborts immediately; exit 0 on both paths
Path typo (src/exec.rs) Corrected to crates/quantumssh-core/src/exec.rs

MANIFIESTO + threat model alignment

  • chore(security): mark quantumssh.org aliases as live #4 (small surface): No new dependency — token bucket is first-party. Feature-set delta is signal only.
  • Threat model §5.1.3: All three test handles (rate limits, half-open caps, deadline) now specified with configurable defaults.
  • Threat model §2.7 / ADR-0024: exec.finished drop-guard preserves the audit invariant. connection.refused/connection.accepted mutual exclusivity specified for schema freeze.
  • Threat model §8.3: Correctly cited as the bound for deterministic lockout (H4 fix).

Cross-reference chain

ADR-0028 → ADR-0022 erratum → ADR-0015 is now a clean chain. The ADR-0028 signal feature delta says "fires the shutdown broadcast introduced above" (not "reuses existing"), and the ADR-0022 signal exclusion says "Phase 1 ships no shutdown path at all" cross-referencing ADR-0028. Internally consistent.

github run

@opencode-agent

Copy link
Copy Markdown

Review: PR #123 — ADR-0028 amendments + ADR-0022 erratum

Classification: ADR/RFC docs under docs/adr/. Design-soundness review against MANIFIESTO commitments, threat model, and ADR-0015 governance. No code.

Verdict: Approved. No high-signal findings.


ADR-0022 erratum — compliant with ADR-0015

The erratum banner carries date, PR reference, and description per ADR-0015. It corrects two factual claims that were false at acceptance: the sync feature's stated purpose and the signal exclusion's phantom broadcast. Workspace grep confirms zero broadcast usage in crates/ — the codebase evidence matches the correction. No decision change. The inline sync feature comment now reads mpsc — exec child-I/O channels (see errata) and the signal exclusion now reads Phase 1 ships no shutdown path at all. Textbook ADR-0015 erratum.

ADR-0028 amendments — sound under Proposed status

ADR-0028 is Proposed — ADR-0015 immutability binds only Accepted ADRs, so in-place amendment is governance-correct. Seven findings addressed, all internally consistent in the final state:

Finding Resolution
H1 phantom broadcast "introduces" replaces "fires the existing"; cross-refs ADR-0022 erratum
H2 drain convergence + exec.finished Cooperative per-connection shutdown specified; drop-guard required for abort/panic; ADR-0023 invariant affirmed
H3 blocking-pool starvation max_blocking_threads ≥ 4 × cap — codebase confirms exactly 4 spawn_blocking in exec.rs:158-215
H4 false equivalence Alternative 4 rewritten honestly; new Negative bullet for deterministic lockout under §8.3
H5 evaluation order + refusal reason Four checks: caps-first (non-mutating), rate-limit-last (state-mutating); first failure names reason
H6 accepted/refused co-occurrence Declared mutually exclusive within the span
H7 second-signal + exit code Second SIGTERM/SIGINT aborts immediately; exit 0 on both paths

The admission-check ordering (caps-first → rate-limit-last) is load-shedding-correct: a saturated global cap drops connections without touching the per-source map, and the parent sentence now explicitly names the rationale.

Cross-reference chain

ADR-0028 → ADR-0022 erratum → ADR-0015 is a clean chain. The ADR-0028 signal feature delta says "fires the shutdown broadcast introduced above"; ADR-0022 says "ADR-0028 introduces it". The ADR-0028 → ADR-0023 path correctly names the exec.started→exec.finished invariant and commits to preserving it on all paths. Internally consistent.

MANIFIESTO + threat model alignment

  • chore(security): mark quantumssh.org aliases as live #4 (small surface): Token bucket and source map are first-party code — no new dependency. Feature-set delta is signal only, on an already-audited dependency (tokio).
  • §5.1.3: All three test handles (rate limits, half-open caps, deadlines) now specified with configurable defaults.
  • §2.7 / ADR-0024: exec.finished drop-guard preserves the audit invariant. connection.refused/connection.accepted mutual exclusivity specified for the schema freeze.
  • §8.3: Correctly cited as the bound for deterministic lockout (H4/H5 fixes).

github run

@opencode-agent

Copy link
Copy Markdown

Review: PR #123 — ADR-0028 amendments + ADR-0022 erratum

Classification: ADR docs under docs/adr/. Design-soundness review against MANIFIESTO commitments, threat model, and ADR-0015 governance. No code.

Verdict: Approved. No high-signal findings.


ADR-0022 erratum — compliant with ADR-0015

The erratum banner carries date, PR reference, and description per ADR-0015. It corrects two factual claims false at acceptance (the sync feature's stated purpose, the signal exclusion's phantom broadcast). Workspace grep broadcast over crates/ confirms zero hits — the correction matches codebase evidence. No decision change — runtime, feature allowlist, threading model untouched. Textbook ADR-0015 erratum.

ADR-0028 amendments — sound under Proposed status

ADR-0028 is Proposed — ADR-0015 immutability binds only Accepted ADRs, so in-place amendment is governance-correct. Seven findings addressed, all internally consistent:

Finding Final state
H1 phantom broadcast ADR-0028 now "introduces" the channel; cross-refs ADR-0022 erratum
H2 drain convergence + exec.finished Cooperative per-connection shutdown specified; drop-guard required for abort/panic paths; ADR-0023 invariant preserved
H3 blocking-pool starvation max_blocking_threads ≥ 4 × cap — confirmed: exactly 4 spawn_blocking in exec.rs:158-215
H4 false equivalence Alternative 4 rewritten honestly; new Negative bullet for deterministic lockout under §8.3
H5 evaluation order + refusal reason Four checks: caps-first (non-mutating reads), rate-limit-last (state-mutating); first failure names reason
H6 accepted/refused co-occurrence Declared mutually exclusive within the span
H7 second-signal + exit code Second SIGTERM/SIGINT aborts immediately; exit 0 on both paths

The admission-check ordering (caps-first → rate-limit-last) is the load-shedding-correct structure: a saturated global cap drops connections without touching the per-source map. The parent sentence explicitly names this rationale, making the ordering read as deliberate.

MANIFIESTO + threat model alignment

  • chore(security): mark quantumssh.org aliases as live #4 (small surface): Token bucket and source map are first-party code — no new dependency. Feature delta is signal only, on an already-audited dependency (tokio).
  • §5.1.3: All three test handles (rate limits, half-open caps, deadlines) now specified with configurable defaults.
  • §2.7 / ADR-0024: exec.finished drop-guard preserves the audit invariant. connection.refused/connection.accepted mutual exclusivity specified for the schema freeze.
  • §8.3: Correctly cited as the bound for deterministic lockout (H4/H5 fixes).

Cross-reference chain

ADR-0028 → ADR-0022 erratum → ADR-0015 is clean. ADR-0028 says "introduces" the broadcast (not "reuses existing"); ADR-0022's signal exclusion says "Phase 1 ships no shutdown path at all" and points at ADR-0028. The ADR-0028 → ADR-0023 path correctly names the exec.started→exec.finished invariant and commits to preserving it on all paths, including abort/panic. Internally consistent.

github run

@gonzafg2 gonzafg2 self-assigned this Jul 19, 2026
@gonzafg2
gonzafg2 merged commit 2e96ab7 into main Jul 19, 2026
11 checks passed
@gonzafg2
gonzafg2 deleted the docs/adr-0028-amendments-adr-0022-erratum branch July 19, 2026 20:40
gonzafg2 added a commit that referenced this pull request Jul 19, 2026
…ce (#126)

The note's banner and workstream map predated RFC-0010's acceptance
(#116) and ADR-0028 (#122, amended #123): the banner claimed no Phase-2
governance existed beyond RFC-0008, and the config/runtime rows still
pointed at to-be-written lanes. Refresh both, and add the
connection.refused event to the freeze checklist — ADR-0028
§Consequences names it a freeze item, but the checklist here never
picked it up.

Mutable-note lane per ADR-0027; nothing here decides anything.

Claude-Session: https://claude.ai/code/session_01J2SZwLuDm1KjfYyPM8npTa

Signed-off-by: Gonzalo Fleming <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants