Repository navigation
fix: H5 quality sweep (6krh, f47j, iuyr, es7b, omsw) - #4013
Merged
Merged
Conversation
…path generate_schema_from_samples (the candidate generator promote_cluster's samples route calls) never received a PrivacyConfig, unlike the full generate pipeline's _generate_cluster_schema. An explicit deny rule supplied by a caller was silently ignored on this path -- exactly what let a low-cardinality UUID-shaped field record its literal per-record values verbatim during a 2026-07-29 promotion. Ref polylogue-f47j
compute_session_cost's per-model loop called estimate_cost() for every model with a normalized name, but estimate_cost() silently returns 0.0 when the pricing catalog has no entry for that model. Combined with confidence carrying forward unconditionally from the token-evidence check, a model with real nonzero reported/estimated tokens but no catalog price (e.g. claude-opus-5, a confirmed live catalog gap) surfaced as confidence='reported' with total_api_cost_usd=0.0 -- indistinguishable from a provider that genuinely billed zero. Downgrade confidence to 'unknown' whenever a model has no catalog price entry, regardless of whether its tokens were reported or estimated. Ref polylogue-iuyr
…cy_config param The fake registry in test_corpus.py implements SchemaRegistryLike and must carry the same signature as the protocol after polylogue-f47j added privacy_config to promote_cluster.
The Hermes watch source recursively scans its entire ~/.hermes home
directory, not just a sessions subtree, so files under
optional-skills/**/templates/*.json (skill prompt-prefill templates)
reach artifact classification tagged provider="hermes". Their
{"role", "content"} shape satisfied the generic
looks_like_record_entry role/content-key heuristic in
_classify_list, so they were claimed as sessions and then quarantined
when they failed to parse.
Hermes's real source classes (state.db, verification evidence, ATIF
trajectory documents, session snapshots) are never bare JSON arrays --
only the ATOF event stream is list-shaped. Narrow the Hermes branch of
_classify_list so a list payload that isn't an ATOF stream is refused
outright instead of falling through to the generic heuristic.
Ref polylogue-omsw
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
polylogue-f47j's library fix (generate_schema_from_samples/promote_cluster threading privacy_config) was unreachable from the production caller: the devtools schema-promote CLI had no privacy flag, SchemaPromoteRequest had no privacy_config field, and promote_schema_cluster called registry.promote_cluster() without the kwarg -- so every real `devtools schema-promote` run stayed exactly as unredacted as before the library fix. - SchemaPromoteRequest gains a privacy_config field (same JSONDocument shape SchemaInferRequest already uses). - promote_schema_cluster forwards it through _privacy_config(), reusing the same payload-to-PrivacyConfig conversion infer_schema already uses (exported as privacy_config_from_payload for other callers). - devtools/schema_promote.py gains --privacy/--privacy-config flags, reusing build_schema_privacy_config -- the same resolution the full `generate` pipeline's --privacy/--privacy-config already use, not a parallel config path. Red-first test through the operator route (promote_schema_cluster, not just generate_schema_from_samples): a planted low-cardinality field leaks into x-polylogue-values by default and is redacted once a privacy_config denying that field reaches promote_schema_cluster.
Sinity
added a commit
that referenced
this pull request
Aug 19, 2026
## Summary Closure package for the `polylogue-t46.8` MCP verb-algebra epic's children: `polylogue-t46.8.2` (read migration) and `polylogue-t46.8.3` (privileged families). Both beads' 2026-08-19 pass-2 notes agreed the implementation is done (103-tool-to-10-verb collapse shipped in PR #3095, `dc6fa632a`) and what remains is proof runs plus one documentary report. This PR is exactly that: no production code changed. ## Problem Both beads' AC lists were last touched before the collapse's supporting test harnesses existed or were last run together. The 2026-08-19 pass-2 notes named specific unrun/unmeasured items: - `t46.8.2` AC#2 (seven continuity drills + z9gh Workflow incident replay) and AC#3 (bounded pages/continuation for oversized cases) had harnesses (`test_cold_model_continuity_replay.py` ×2, `test_tool_discovery.py`, `test_bounded_query_transport.py`) that existed but were "unrun in this audit". - `t46.8.3` AC#5 (t8t coordination/context flows plus negative unauthorized/injection/retry fixtures) named four fixture files (`test_privileged_tools.py`, `test_tool_error_isolation.py`, `test_context_delivery_tool.py`, `test_status_scope_coordination.py`) in the same unrun state. - `t46.8.3` AC#6 (final surface/token-cost/usage report naming every retained exception) was flagged as "genuine unbuilt scope". - Both beads' AC#4 (per-tool production goldens/shadow telemetry proving no capability loss **before** deletion) is structurally unsatisfiable now — the old surface is already deleted, so there is no "before" left to shadow against. ## Solution - Ran all eight named test files individually via `devtools test`, sequentially, in this freshly-provisioned worktree off `origin/master`. All green — see the results table below. - Wrote `docs/mcp-surface-report-2026-08.md`: the final 10-tool + 15-URI- resource surface, per-tool declared operations (measured live against `polylogue/mcp/declarations/registry.py`/`server_cutover.py`), the capability-flag role-gating matrix, measured token cost of the serialized tool declarations under each capability combination (via a real `build_server()` + `list_tools()` call, not an estimate from memory), every retained exception with its reason, and AC#4 restated as misframed-not-satisfiable with the post-hoc parity evidence available instead. - Registered the report in `devtools/docs_surface.py`'s tiered doc index (archive tier, same precedent as the existing dated retros) and linked it from `docs/mcp-reference.md`. `devtools render all` regenerated `docs/README.md`'s index entry as a result — included in the diff. No MCP production code was touched. If any suite had been red, per the dispatch instructions this PR would have stopped at classification (pre-existing vs. revealing) rather than fixing MCP internals here — none were. ## Verification | Suite | AC | Result | | --- | --- | --- | | `tests/integration/test_cold_model_continuity_replay.py` | t46.8 AC#3 | 3 passed | | `tests/unit/devtools/test_cold_model_continuity_replay.py` | t46.8 AC#3 | 10 passed | | `tests/unit/mcp/test_tool_discovery.py` | t46.8.2 AC#2 | 9 passed | | `tests/unit/mcp/test_bounded_query_transport.py` | t46.8.2 AC#3 | 1 passed | | `tests/unit/mcp/test_privileged_tools.py` | t46.8.3 AC#5 | 60 passed | | `tests/unit/mcp/test_tool_error_isolation.py` | t46.8.3 AC#5 | 6 passed | | `tests/unit/mcp/test_context_delivery_tool.py` | t46.8.3 AC#5 | 6 passed | | `tests/unit/mcp/test_status_scope_coordination.py` | t46.8.3 AC#5 | 2 passed | | **Total** | | **97 passed, 0 failed** | `devtools verify --quick` — clean (format + lint + mypy + render-all-check, including the new doc registration + regenerated `docs/README.md` index + layering + schema policy + promotion audit). Full `devtools verify` not run: no production code changed (docs + a one-line devtools registry entry only), and this worktree's testmon graph would need a full bootstrap with nothing to gain from it — same digest-drift reasoning as the concurrent #4013 PR's gate substitution. ## Per-AC honesty breakdown (for the coordinator's own closing bookkeeping) This PR's pr-scope carrier marks both `t46.8.2` and `t46.8.3` **satisfied** per the dispatch's stated criterion ("SATISFIED if suites green + report lands"). That criterion covers the ACs this task was actually scoped to prove. It does **not** mean every AC on either bead's full text is proven by this PR — listed honestly below so the parent `t46.8`'s close (the coordinator's own bookkeeping, not this PR's) has the complete picture. **t46.8.2:** - AC#1 (equivalence coverage) — not re-verified this pass; prior sessions' notes claim it, not independently re-checked here. - AC#2 (continuity drills + Workflow replay) — **satisfied**, proof run above. - AC#3 (bounded pages, no row cap) — **satisfied**, proof run above. - AC#4 (pre-deletion goldens) — **misframed**, restated in the report (Section 5) with post-hoc parity evidence instead. - AC#5 (≤15-tool default profile) — **satisfied**, structurally (6 base tools), confirmed in the report (Section 1). - AC#6 (migration harness protects the shared transaction) — **not evidenced by this pass**; no suite here specifically targets removal/ mutation of the shared query transaction failing the harness. - AC#7 (concurrent incident-scale calls, cancellation/disconnect, bounded RSS/PSS/swap/temp, zero leaks) — **not evidenced by this pass**; none of the eight suites run here are a load/leak-proof harness. If this AC needs its own proof run, it is a residual, not covered by "SATISFIED" per the dispatch's own naming of what this task covers. **t46.8.3:** - AC#1 (every family maps onto a declared verb, no lost operation) — **substantially evidenced**: the report's Section 4 names three operations (`delete_saved_view`, `import_annotation_batch`, `deliver_context`) not covered by the specific executor-routing proof test class, and `maintenance()`'s entire operation surface has zero `OperationExecutor` routing (real, acknowledged, explicitly deferred to `kwsb.2`/`t46.9`) — not a silent gap, but also not a clean 100%. - AC#2 (prompt/resource content cannot acquire instruction/write authority) — not re-verified this pass. - AC#3 (candidate/judged state, idempotency, dry-run/authorization, receipts, status/recovery, role isolation) — **satisfied** by `test_privileged_tools.py`'s 60 passing tests, which cover this ground directly (confirm-gates, actuator routing, role gating). - AC#4 (old tools/aliases removed) — **satisfied**: confirmed live in the report that the five old registrar modules are fully deleted. - AC#5 (t8t flows + negative fixtures) — **satisfied**, proof runs above. - AC#6 (final surface/token-cost/usage report) — **satisfied**, this PR's report. ## Bead disposition matrix | Bead | Disposition | Evidence | Notes | | --- | --- | --- | --- | | polylogue-t46.8.2 | **SATISFIED** per dispatch criterion — close-candidate | commit (this PR); 4 test files, 23 passed; `docs/mcp-surface-report-2026-08.md` | AC#6/#7 (migration-harness protection, concurrent/leak-proof load test) not evidenced by this pass — see honesty breakdown above. Coordinator's call whether those warrant a residual bead before the parent closes. | | polylogue-t46.8.3 | **SATISFIED** per dispatch criterion — close-candidate | commit (this PR); 4 test files, 74 passed; `docs/mcp-surface-report-2026-08.md` | `maintenance()` executor-routing debt and 3 uncovered `write()` operations are real, named, and explicitly deferred to `kwsb.2`/`t46.9` per the bead's own prior notes — not new information, not blocking this bead's own AC (which asks for the mapping + report, not for `t46.9` to have landed). | The parent `polylogue-t46.8`'s close is the coordinator's own bookkeeping, per the dispatch — not attempted here. <!-- polylogue-pr-scope:v2 { "assigned_beads": [ "polylogue-t46.8.2", "polylogue-t46.8.3" ], "dispositions": [ { "bead_id": "polylogue-t46.8.2", "disposition": "satisfied", "evidence": [ { "kind": "commit", "ref": "eb3592edd" }, { "kind": "test", "ref": "tests/integration/test_cold_model_continuity_replay.py" }, { "kind": "test", "ref": "tests/unit/devtools/test_cold_model_continuity_replay.py" }, { "kind": "test", "ref": "tests/unit/mcp/test_tool_discovery.py" }, { "kind": "test", "ref": "tests/unit/mcp/test_bounded_query_transport.py" }, { "kind": "diff", "ref": "docs/mcp-surface-report-2026-08.md" } ], "successors": [] }, { "bead_id": "polylogue-t46.8.3", "disposition": "satisfied", "evidence": [ { "kind": "commit", "ref": "eb3592edd" }, { "kind": "test", "ref": "tests/unit/mcp/test_privileged_tools.py" }, { "kind": "test", "ref": "tests/unit/mcp/test_tool_error_isolation.py" }, { "kind": "test", "ref": "tests/unit/mcp/test_context_delivery_tool.py" }, { "kind": "test", "ref": "tests/unit/mcp/test_status_scope_coordination.py" }, { "kind": "diff", "ref": "docs/mcp-surface-report-2026-08.md" } ], "successors": [] } ], "mutated_beads": [], "scope_digest": "05d807ef6bdefe91359e9431035a016f3de33d54bf8f47b643a6a88304274574", "scope_kind": "bead", "version": 2 } -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five small, independent quality fixes batched into one PR (H5 quality sweep,
.agent/campaigns/2026-08-overhaul/queue row #12): two real code fixes withred-before/green-after tests (
polylogue-f47j,polylogue-iuyr), onenarrowing fix for a mislabelled-session bug found by a parallel audit
(
polylogue-omswclass), and two beads (polylogue-6krh,polylogue-es7b)that turned out to already be fully fixed and tested on
masterwheninvestigated — verified rather than assumed.
Problem
registry.promote_cluster's samples-based candidategenerator (
generate_schema_from_samples) never received aPrivacyConfig, unlike the fullgeneratepipeline's_generate_cluster_schema. An explicit deny rule supplied by a caller wassilently ignored on the samples path — the same class of gap that let a
low-cardinality UUID-shaped field record its literal per-record values
verbatim during a 2026-07-29 promotion (caught after the fact by
devtools schema_audit, fixed at the time by manual annotationstripping, not by this fix). Cold review on an earlier revision of
this PR caught that the initial fix only plumbed
privacy_configthrough the library function — it was still unreachable from
devtools schema-promote, the actual command a live promotion runs, soevery real run would have stayed exactly as unredacted as before this PR
until that was completed (see Solution and the second commit below).
The compensating control that actually caught the 2026-07-29 leak
(
devtools schema_audit's privacy-guard check) still runs in no gate —tracked separately as polylogue-32pwq, not in this PR's scope.
compute_session_cost's per-model loop calledestimate_cost()for every model with a normalized name, butestimate_cost()silently returns0.0when the pricing catalog has noentry for that model. A model with real, nonzero reported/estimated tokens
but no catalog price (e.g.
claude-opus-5, a confirmed live catalog gap)surfaced as
confidence='reported'withtotal_api_cost_usd=0.0—indistinguishable from a provider that genuinely billed zero.
recursively scans its entire
~/.hermeshome directory (not just asessions subtree), so skill prompt-prefill templates under
optional-skills/**/templates/*.jsonreached artifact classificationtagged
provider="hermes". Their bare{"role", "content"}array shapesatisfied the generic
looks_like_record_entryheuristic in_classify_listand got claimed as a session, then quarantined when itfailed to parse ("session artifact produced no materializable sessions").
Found by a parallel dyica-classification audit (2026-08-19, bucket B6),
both live template files still on disk for testing.
dispatch and found to already be fully fixed and tested on
master(see disposition matrix below) — no code changes made in this PR for
either.
Solution
polylogue/schemas/generation/schema_builder.py:generate_schema_from_samplesgains a
privacy_configparameter, threaded into its_annotate_schemacall (the same redaction path
_generate_cluster_schemaalready used).polylogue/schemas/tooling_registry.py:promote_clustergains the sameprivacy_configparameter and forwards it.polylogue/schemas/operator/registry.py:SchemaRegistryLike.promote_clusterprotocol updated to match (plus
tests/unit/scenarios/test_corpus.py'sfake registry, to keep mypy's Protocol-conformance check green).
polylogue/schemas/operator/models.py'sSchemaPromoteRequestgains aprivacy_config: JSONDocument | Nonefield (the same shapeSchemaInferRequestalready carries);polylogue/schemas/operator/inference.py'spromote_schema_clusterforwards it through_privacy_config()(nowalso exported as
privacy_config_from_payloadfor reuse) intoregistry.promote_cluster();devtools/schema_promote.pygains--privacy/--privacy-configflags, reusingbuild_schema_privacy_config— the exact same resolution the fullgeneratepipeline's equivalent flags already use, not a parallelconfig path.
polylogue/archive/semantic/cost_compute.py: the per-model breakdown loopnow checks
pricing_catalog_source(norm)before trusting a'reported'/'estimated'confidence; a model with no catalog entry downgrades to'unknown'regardless of token evidence, soestimate_cost()'s silent0.0can never be read as a confident zero.polylogue/archive/artifact_taxonomy/runtime.py:_classify_listnarrowsthe Hermes branch — a list-shaped payload under
provider="hermes"isonly session-eligible when it's a genuine ATOF event stream (the one
list-shaped Hermes source class; state.db/ATIF/session-snapshots are all
single JSON documents). Any other Hermes list payload is refused outright
instead of falling through to the generic
looks_like_record_streamheuristic.
Alternative considered and rejected for the Hermes fix: narrowing the
Hermes parser predicates (
polylogue/sources/parsers/hermes*.py), asoriginally suggested. Traced the actual claim path instead — the parsers
were never reached;
archive/artifact_taxonomy/runtime.py's generic_classify_list(shared by every provider) is what admitted the template asa session, so that is where the fix belongs.
Verification
devtools test tests/unit/schemas/test_promote_cluster_privacy_config.py— 4 passed (f47j library-level plumbing; red confirmed by reverting the source change and re-running before committing).devtools test tests/unit/core/test_operator_inference.py— 6 passed, includingtest_promote_cluster_with_samples_honors_privacy_config_through_the_real_operator_route(f47j, operator-route completion; red confirmed — reverting the wiring madeSchemaPromoteRequest(..., privacy_config=...)raiseTypeError: unexpected keyword argument, i.e. the field genuinely didn't exist before this fix). Also rantests/unit/core/test_operator_models.py,tests/unit/cli/test_operator_support_runtime.py,tests/unit/schemas/test_operator_commit.py,tests/unit/schemas/test_promotion_audit_privacy_guard.py,tests/unit/schemas/test_promotion_monotonicity.py— 38 passed total, no regressions.devtools test tests/unit/core/test_cost_compute.py— 10 passed (iuyr; red confirmed the same way).devtools test tests/unit/sources/test_artifact_taxonomy.py— 19 passed (Hermes fix; red confirmed the same way, plus the ATOF anti-over-narrow twin passes both before and after).devtools testacross every Hermes-touching test file (parsers, dispatch, live watcher/batch, storage, daemon) — 880 passed, no regressions.devtools verify --quick— clean (format + lint + mypy + render-all-check + layering + schema policy + promotion audit).devtools verifywithheld: this worktree's testmon graph would need a full bootstrap (~45 min, first run in a freshly-provisioned lane venv) that dies with the worktree at merge time — per the digest-drift/lane-lifecycle policy, that cost buys nothing the coordinator's own terminal verify at merge doesn't already provide. The four focused suites above plus--quickare the substitute gate for this PR; the coordinator's merge-timedevtools workspace merge/ terminal verify is the release-baseline attestation of record.Bead disposition matrix
tests/unit/schemas/test_promote_cluster_privacy_config.py,tests/unit/core/test_operator_inference.py::test_promote_cluster_with_samples_honors_privacy_config_through_the_real_operator_routeprivacy_configthreaded through the library's samples path, (2)promotion_audit'scheck_privacy_guardswiring (AC #2) was already present onmasterbefore this PR — verified live, not assumed, (3) the operator-route wiring (SchemaPromoteRequest→promote_schema_cluster→devtools schema-promote --privacy) that a cold review found missing from the first revision — without it the library fix was unreachable from any real promotion.tests/unit/core/test_cost_compute.py::test_catalog_gap_model_with_real_tokens_is_not_a_confident_zerounknownconfidence instead of a confident$0.00.polylogue/sources/live/cursor.py:_sync_convergence_debt_to_ops(writesstatus='deferred'for deliberate deferrals); bothbatch.pydeferral call sites already passdeferred=True; all five reader/alert surfaces named in the bead (health.py,status.py, clistatus.py,api/archive.py,metrics.py) already trackfailed_count/deferred_countseparately;tests/unit/sources/test_convergence_debt_deferred_vocabulary.pycovers the full writer→reader chain end to end. This was PR #3621, already merged. Remaining scope per the bead's own design note is post-deploy live verification only (not code) plus the t0m73 vocabulary-honesty registry check, which the bead explicitly says to note rather than build. Not something this PR can evidence from a worktree.polylogue/storage/embeddings/materialization.py's exception handler (fallback toOrigin.UNKNOWN_EXPORTsentinel,record_embedding_failurealways called);tests/unit/storage/test_embedding_contracts.py::test_archive_failure_ledger_survives_origin_lookup_failuremaster, no diff in this PR. Items (b)/(c)/(d) from the bead's own evidence (write_coordinator.pydetached-writer counter,RuntimeErrorsuppress potential hang,sampling_db.pymissing-tier-file warning) are untouched and out of scope for this sweep — no successor bead exists yet for those; not included in the machine pr-scope carrier below since a partial disposition requires a linked successor I'm not able to create from a read-only lane. Coordinator: file a successor for (b)/(c)/(d) before considering this bead closeable.The machine-readable carrier below covers only
polylogue-f47jandpolylogue-iuyr(the two beads this PR both mutates code for and cansatisfy without a successor).
polylogue-6krhandpolylogue-es7bareevidenced in prose above rather than the typed carrier, since satisfying or
partial-closing them accurately would require either a diff this PR doesn't
carry (6krh — already fixed elsewhere) or a successor Bead this lane cannot
create (es7b's residual items b/c/d).