Skip to content

feat(moa): every_n fanout cadence + privacy redaction filter (opt-in, redesigned from #63448/#60463) - #70284

Merged
teknium1 merged 2 commits into
mainfrom
moa/advisor-controls-cluster
Jul 24, 2026
Merged

feat(moa): every_n fanout cadence + privacy redaction filter (opt-in, redesigned from #63448/#60463)#70284
teknium1 merged 2 commits into
mainfrom
moa/advisor-controls-cluster

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Two opt-in advisor-control dials, engineered from community intent where the submitted implementations weren't merge-shaped: an every_n fan-out cadence that reuses cached guidance on off-cadence iterations (from #63448 / issue #63393), and a privacy redaction filter with display/full modes and safe patterns (from #60463 / issue #59959). Both config-gated, both default-off, both Co-authored-by @webtecnica.

Changes (2 commits)

fanout: every_n cadence (issue #63393 — multiplicative advisor latency in tool-heavy turns is real):

  • Extends the existing fanout enum rather than adding a parallel knob (the submitted tool_call_batch_cadence ran advisors every Nth iteration but gave the aggregator NO advice in between — worse than user_turn; it also never interacted with fanout and its counter leaked across turns).
  • Off-cadence iterations reuse the cached guidance from the last on-cadence run (same mechanism user_turn already uses); counter scoped per user turn.
  • Normalization round-trip + docs section added.

moa.privacy_filter (issue #59959):

  • Reuses the repo's central redaction helpers instead of the submitted hand-rolled regex list in moa_loop.
  • Patterns: emails, API-key shapes, JWT/token shapes. The submitted bare 10-digit phone matching was dropped — it mangled line numbers, timestamps, and hex IDs in exactly the code-review advisory outputs MoA runs on (E.164 +-prefixed numbers are already covered by the central redactor).
  • Two modes: display (traces + user-visible reference events redacted; acting model sees raw) and full (aggregator input redacted too — the issue's literal ask). Default off.
  • 12 filter tests including code-review-shaped advisory text that must NOT be mangled.

Validation

Check Result
4 targeted suites (new cadence + filter tests, moa_config normalization +11) 98 pass / 0 fail (re-run post-rebase)
ruff clean

Supersedes #63448 and #60463 (both close with credit — the issues were legitimate, the mechanisms needed redesign; details in each close comment). Fixes #63393, #59959.

Infographic

moa-advisor-controls

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on adc471d

all good!

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Jul 23, 2026
teknium1 and others added 2 commits July 23, 2026 17:05
Extends the fanout enum with 'every_n:<N>' (N >= 2): advisors run on the
first iteration of each user turn and every Nth tool iteration after it;
off-cadence iterations REUSE the cached guidance from the last on-cadence
run via the same cache mechanism the user_turn fanout uses, so the
aggregator still gets advice on every step. The cadence counter is scoped
per user turn (resets on a new user message) and only advances when the
advisory state actually changes, so streaming retries never consume a
cadence slot. Mapping form {mode: every_n, n: N} normalizes to the
canonical string. Unknown/degenerate values fall back to per_iteration.

Addresses issue #63393 (advisor fan-out multiplies turn latency/cost by
the tool-iteration count). Redesigned from PR #63448: the submitted shape
skipped references entirely on off-cadence iterations (aggregator ran
advice-less); this version keeps the last advice in play, credited for
the idea and cadence framing.

Config-gated, default-off (default fanout remains per_iteration).

Co-authored-by: webtecnica <75556242+webtecnica@users.noreply.github.com>
Adds moa.privacy_filter ('' | display | full, default off — issue #59959):

- display: redact user-visible surfaces only (reference blocks emitted to
  the UI + saved MoA trace records, including per-advisor full input/output
  and the aggregator-input copy); the aggregator sees raw advisor text so
  synthesis quality is unaffected.
- full: additionally redact the advisor text injected into the aggregator
  prompt, on both the persistent facade path and the one-shot /moa
  synthesis path (the issue's literal ask). Legacy boolean true maps here.

Secret/credential shapes (API-key prefixes, JWTs, private keys, DB
connection strings) are delegated to the central redactor
(agent.redact.redact_sensitive_text, force=True + code_file=True); the MoA
filter adds only email and clearly delimited phone-number patterns. No
bare 10-digit matching: line numbers, timestamps, epoch values, git SHAs,
IPs, versions, and source-code assignments in code-review-shaped advisory
text pass through byte-identical. The reference cache always holds raw
text — redaction happens at each consuming surface, so a mid-session mode
change never leaks or double-redacts.

Reworked from PR #60463: replaced its hand-rolled pattern list (which
matched bare digit runs and re-implemented key shapes) with central-
redactor reuse + safe patterns, and split the single boolean into
display/full modes. Credited for the feature framing.

Co-authored-by: webtecnica <75556242+webtecnica@users.noreply.github.com>
@teknium1
teknium1 force-pushed the moa/advisor-controls-cluster branch from 0f39534 to adc471d Compare July 24, 2026 00:05
@teknium1
teknium1 merged commit f7b90e6 into main Jul 24, 2026
37 checks passed
@teknium1
teknium1 deleted the moa/advisor-controls-cluster branch July 24, 2026 00:50
@webtecnica

Copy link
Copy Markdown
Contributor

Closing — absorbed by @teknium1 in #70284 (merged f7b90e6f). Your MoA fanout cadence and privacy filter designs were redesigned and merged as part of the advisor-controls cluster. Co-authored-by @webtecnica credited in the commit. Supersedes your earlier approach with proper config-gating and tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MoA: add periodic advisor refresh cadence for tool-heavy turns

3 participants