Skip to content

refactor(reporting): reuse bounded readers and diagnostic facts - #178123

Merged
steipete merged 1 commit into
mainfrom
deslop/z43-5-reporting-owners-20261015
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z43-5-reporting-owners-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Private reporting paths duplicate facts and mechanics already owned elsewhere: the memory host implements another bounded HTTP body reader, diagnostic churn merge supports states its writers cannot produce, and security reporting prepares the same tool policies twice.

User Impact

No intended user-visible change. Memory response limits/errors, real diagnostic churn recovery and security exposure findings remain intact. The internal edge-case tradeoffs below are best effort; no operator action or migration is required.

Why This Change Was Made

The memory-host reader delegates byte collection, truncation and cancellation to the existing bounded HTTP readers through its private runtime facade. Its existing JSON/error prefixes, strict UTF-8 decoding, snippet suffix/character limit, non-Error abort messages and empty-body behavior remain at the adapter.

Diagnostic churn merges use the sequence numbers recorded with every observation and clear; the real churn recovery, same-millisecond ordering and owner/policy waits stay intact. Recent diagnostic phases retain their fresh outer list without copying private read-only records. The process-global logger still shares state across current module copies, without repairing a hypothetical older module's object shape. Security exposure reporting shares policy preparation while preserving both projections, their text and ordering.

Net production reduction: 102 lines across six production files; eight files total including tests. This is a rule-14 lane residue, not a LARGE campaign PR. No configuration, persisted schema, protocol, dependency or public SDK signature changes.

Best-effort tradeoffs accepted

  • Mixing incompatible old and new logging module implementations in the same running process is no longer repaired by adding a missing field. Normal same-version module reloads still share the current singleton. This was module-shape compatibility, not a cited human incident; restart repairs incompatible live code mixing.
  • A trusted internal diagnostic consumer that mutates a borrowed phase record can affect later diagnostic reads. All current consumers only read it; the returned outer list remains detached. No public mutation contract or human incident justifies per-record copies.
  • Churn states with timestamps but no observation sequence are no longer independently reconciled. Every real observation and clear writes both together. The human-reported churn recovery from [Bug]: Loop detection evaded by varying tool arguments; stuck-session recovery treats looping tool calls as progress #112479 remains, including same-timestamp clear/alias merging; only unreachable internal alternatives are removed.
  • The private memory adapter now follows the canonical reader's rejection for invalid internal byte limits and normalization of non-Error stream failures. All production callers provide valid limits. Real external byte bounds, strict UTF-8, content-length checks and abort/error behavior remain covered; no public configuration is removed.

Evidence

  • Frozen-source focused proof: 83/83 tests across 11 files, four serial shards with maxWorkers1. This covers memory HTTP/upload readers and security exposure, diagnostic churn/phase/logger state/reload, and the mandatory suppression gate. New cases cover non-Error preabort, a truncated UTF-8 tail, and same-timestamp clearing across independent session references.
  • Targeted TypeScript, focused lint, formatting and diff checks passed. Runtime-value import cycles:0. Hosted exact-head CI owns broad proof, including Madge; no broad local suite, build or E2E was run.
  • Fresh isolated P0-P2 review of the frozen eight-file diff: scoped-clean, no actionable findings. Simplification retained existing owners rather than adding a new abstraction.
  • No live provider, deployment, device, or migration proof claim. No changelog change; release-note context is this PR.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 20, 2026 05:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T06:01:03.645249Z 4ff02d2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 4ff02d2ae8f0adcc37c164d9ef9003ccdc856357
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/security/audit-extra.sync.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reuses bounded HTTP readers, simplifies diagnostic bookkeeping, and shares security-report policy preparation.

Example: A memory-provider error body contains abc€tail and the diagnostic byte cap is 5.

  • Before: The memory-specific reader returns abc... [truncated], dropping the incomplete UTF-8 tail.
  • After: The canonical reader produces the same bounded diagnostic through the memory adapter.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused consolidation with no actionable finding; available validation supports production-path contracts in process, without end-to-end runtime evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence consists of focused test results and static checks, with no shipped-entry-point claim or material authority change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible defect is claimed; duplicated reporting mechanics create maintenance drift.
Reason: The maintainer-approved direction removes duplicated owners and unreachable alternatives while preserving supported behavior and explicitly accepting bounded internal tradeoffs.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: the consolidation is useful, and the introduced diff has no actionable correctness or security finding.

Priority: P3
Reviewed head: 4ff02d2ae8f0adcc37c164d9ef9003ccdc856357

Before merge

None.

Findings

None.

Agent review details

How this fits together

Memory HTTP responses enter shared byte readers and leave as bounded diagnostics or strictly decoded JSON; diagnostic observations and configured tool policies feed existing liveness and security reports.

flowchart TD
  A[Memory HTTP responses] --> B[Memory response adapter]
  B --> C[Canonical bounded readers]
  C --> D[JSON or error diagnostics]
  E[Run activity observations] --> F[Diagnostic reports]
  G[Configured tool policies] --> H[Security exposure reports]
Loading

Technical review

Best possible solution:

Retain the consolidation around existing reader, diagnostic, and tool-policy owners.

Do we have a high-confidence way to reproduce the issue?

This is a behavior-preserving refactor rather than a bug report; source inspection confirms the duplicated mechanics and the production writer invariants.

Is this the best way to solve the issue?

The diff uses existing owners, removes the replaced reader loop and policy projection pass, and keeps adapter-specific contracts without unnecessary new machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4b77c23f6831.

Provenance checked

  • Memory bounded response reading keeps the original intent (refactor(http): share bounded response byte consumption #140654: Shared byte accounting deliberately retained caller-specific decoding, abort errors, cancellation, and cleanup; earlier repairs also protected UTF-8 prefixes and capture-tee settlement.)
  • Diagnostic churn ordering keeps the original intent (fix(agents): stop stable tool argument churn #112620: Continuous same-result argument churn must age independently of mechanical progress while preserving owner and policy-wait boundaries.)
  • Diagnostic phase record copies changes intended behavior with a stated reason (e84d4b2: The original phase-history implementation returned shallow record copies; history supplied no separate mutation incident, and current production consumers only read records.)
  • Logging singleton shape repair changes intended behavior with a stated reason (2456c77: Lifecycle-owned logging configuration added appliedConfig and initialized older process-global singleton shapes; this PR explicitly drops incompatible-version live mixing while retaining same-version sharing.)
  • Security exposure reporting keeps the original intent (feat(security): audit open ingress control-plane tool exposure #100965: Open ingress needs a dedicated warning for persistent control-plane tools alongside runtime/filesystem exposure.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b2cda56 adds src/logging/diagnostic-argument-churn-activity.ts:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b2cda568987e; files: src/logging/diagnostic-argument-churn-activity.ts)
  • WhatsSkiLL: Raw commit 79c517d adds src/logging/diagnostic-argument-churn-activity.ts:139 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 79c517df8942; files: src/logging/diagnostic-argument-churn-activity.ts)
  • Vincent Koc: Raw commit be7d86e adds packages/memory-host-sdk/src/host/response-snippet.ts:70 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: be7d86ed8005; files: packages/memory-host-sdk/src/host/response-snippet.ts)
  • NIO: Raw commit 589f1c0 adds src/security/audit-extra.sync.ts:498 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 589f1c00de32; files: src/security/audit-extra.sync.ts)

PR surface

Source -102, Tests +48. Total -54 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 53 155 -102
Tests 2 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 101 155 -54

Review metrics

Metric Value Why it matters
Production versus test changes Production +53/-155 lines; tests +48/-0 lines The production reduction removes duplicated mechanics; added tests protect abort-message, UTF-8 truncation, and same-timestamp clear contracts.

Labels

Label changes:

  • add P3: Internal maintenance cleanup with no intended user-visible behavior change or demonstrated urgent defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: Internal maintenance cleanup with no intended user-visible behavior change or demonstrated urgent defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 20, 2026, 2:14 AM ET / 06:14 UTC.

@steipete
steipete merged commit 8fb3a20 into main Oct 20, 2026
212 checks passed
@steipete
steipete deleted the deslop/z43-5-reporting-owners-20261015 branch October 20, 2026 07:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant