Skip to content

Commit 22968c8

Browse files
brettchienclaude
andauthored
docs: add ADR for turn-boundary message batching (#598)
* docs: add ADR for batched turn packing in ACP session/prompt Records the structural decision extracted from RFC #580 (Turn-boundary message batching): how N concatenated arrival events are packed into the Vec<ContentBlock> crossing the broker → ACP boundary. Reuses the existing per-arrival-event <sender_context> template repeated N times rather than introducing a parallel <message index=N> wrapper schema, with one additive `timestamp` field on SenderContext. Closes the attribution gap surfaced independently by Triage (T1.4) and JARVIS/FRIDAY (B1) reviews. * docs: supersede batched-turn-packing with turn-boundary batching ADR Replaces the standalone packing ADR with the consolidated turn-boundary message batching ADR, which folds RFC #580 mechanism, T1.x dispositions, and the original packing design into a single document. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs(adr): sync turn-boundary-batching ADR with PR #686 Phase 1 implementation Updates the ADR to match decisions made during PR #686 review: - 3-valued MessageProcessingMode (per-message / per-thread / per-lane) replacing the earlier 2-valued (per-message / batched) design. §4.1 documents per-mode (cap, dispatcher key, idle timeout) tuple; §4.4 Phase 1 bullets reflect the unified Dispatcher::submit path; legacy "batched" alias is rejected at config parse. - Standalone <sender_context> Text block (commit 072010c). §3.1 / §3.3 / §3.4 / §3.5 / §3.6 + §6.4 rule 4 now describe the split-block layout: delimiter + transcripts + prompt + images. Transcripts move from before the envelope to inside the arrival event (between delimiter and prompt); images stay after prompt as in the pre-batching adapter. Empty prompt is omitted from the block stream. - New §6.10 — per-mode consumer idle timeout (PER_MESSAGE = 10s, DEFAULT = 300s) with Little's-Law rationale and sweep_stale eviction. - New §6.11 — SendError manual staging smoke matrix (the entry deferred out of CI in PR #686's first status update). - §6.7 batch reactions now explicitly sequential (not join_all parallel) so reaction-list ordering across a batch matches message-ID order. - Frontmatter: drop the self-referential "Supersedes: PR #598" line; add "Implementation PR: #686" so the ADR points at the wiring it documents. * docs(adr): fact-check and tighten turn-boundary-batching ADR vs PR #686 head Five rounds of fact-check + proofread against PR #686 (feature/turn-boundary-batching-v2 @ e119abf) caught two threads of drift: - Design contract: §2.5 SendError handler now matches commit afd6fff — proactive consumer.is_finished() check at submit head + transparent retry once on SendError; ❌ + ⚠️ + Err(ConsumerDead) only if the retry also fails. Motivated by the first-message-after-idle race; one-attempt bound preserves the no-spin-loop property. §6.11 staging smoke matrix split into Path A (PANIC_ONCE happy path, no user-visible signal) and Path B (PANIC_ALWAYS failing-retry surfaces ❌+⚠️). §4.4 Phase 1 plan + test list updated to the new contract. - Anchor audit vs declared base v0.8.2-beta.1 (52052b8): pre-existing drift fixed in adapter.rs references that had been wrong since the SHA pin was set in v0.2 — :131-152→:156-172, :138-143→:158-162 (7 sites), :148-152→:165-169, :154-161→:173-180, :181→:254 (was pointing at the wrong call), :240→:260. acp/connection.rs / acp/pool.rs / discord.rs / slack.rs anchors verified clean against 52052b8. - §2.6 rewritten: other_bot_present is a bool snapshot carried on BufferedMessage and read from batch.last() at dispatch time — not the Arc<AtomicBool> mirror of an earlier draft. §2.3 struct + submit signature corrected to match. - Anchor-pinning preamble (line 9) expanded to pin both SHAs explicitly: released-code anchors → 52052b8; conceptual descriptions of new modules → cross-checked against e119abf. - Appendix A replaced with a signatures-only skeleton pointing at src/dispatch.rs — drops the ~200-line body sketch that had drifted from the implementation; rationale moved into a short shape-choices list. - Path anchors swept: pool.rs → acp/pool.rs, connection.rs → acp/connection.rs (modules live under src/acp/ in v0.8.2-beta.1). - §6.6 metric table cell tokens_per_event (was context_tokens_per_event, inconsistent with the code block immediately below). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Brett Chien <1193046+brettchien@users.noreply.github.com>
1 parent 4f050e5 commit 22968c8

1 file changed

Lines changed: 1068 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)