Repository navigation
refactor(core): deslop redundant options and state - #166364
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: blocked before merge. Reviewed October 7, 2026, 3:03 AM ET / 07:03 UTC (Revision 6). ClawSweeper reviewWhat this changesThis PR simplifies internal option forwarding and reply bookkeeping, and keeps Doctor’s web-provider registrations within its tool-inspection lifetime. Merge readiness⛔ Blocked before merge - 1 item remains The latest head resolves the prior integration concern and has no identified blocking introduced defect. The inspection-lifetime repair remains distinct from current main’s provider-selection fix, and this maintainer-authored PR should remain open for landing. Priority: P3 Review scores
Verification
How this fits togetherDoctor inspects configured agents and plugin tools to report runtime schema problems. Plugin provider resolution supplies search availability during that inspection, while the inspection owner controls registration reuse and cleanup. flowchart TD
A[Agent configuration and plugin manifests] --> B[Doctor tool inspection]
B --> C[Inspection-owned registrations]
C --> D[Web-provider resolution]
D --> E[Reuse matching providers]
D --> F[Load missing providers in owned cache]
E --> G[Schema findings]
F --> G
B --> H[Release registrations and cache]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -125, Tests +105. Total -20 across 37 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one inspection owner for registration, supplemental discovery, and cleanup while preserving ordinary runtime provider selection and existing public contracts. Do we have a high-confidence way to reproduce the issue? Yes, the Doctor tool-schema check and real-loader fixtures provide a focused path for registration reuse, provider precedence, and release behavior; the captured body reports before/after failures. This review inspected source and coverage without executing that path. Is this the best way to solve the issue? Yes, the patch extends the existing inspection lifetime and preserves main’s ordinary provider-selection owner, avoiding a competing registry or public API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 43ca3a7be0c8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
Compatibility-proof scope looks narrowable here. The stored-data detector appears to be firing because this refactor touches several Doctor repair/runtime-policy files, but the introduced delta is option/state derivation cleanup rather than a persisted-shape change. A useful proof would therefore be behavior-equivalence at the repair boundary rather than a migration narrative:
If those outputs are identical, that directly answers the compatibility blocker the scanner is raising without inventing a migration that this PR does not seem to introduce. I also checked the changed-file set: the flagged files are present, but the PR surface is entirely source refactoring with no test/config/generated file delta. That makes an equivalence replay more informative than generic upgrade prose. |
|
I converted the remaining migration/checklist ambiguity into a concrete compatibility evidence contract: The key source finding is that the detector-hit files still have the same mutation/output owners. For example, the candidate removes the redundant So the proposed proof is base-vs-candidate equivalence across existing repair fixtures:
If those pass, the appropriate conclusion is “no stored-data contract change; no migration/backfill required”, which matches the latest review narrative while giving the stale checklist item a concrete verification path. |
4af8770 to
50ef4ff
Compare
Remove repeated internal option projections and unread plugin trust parameters. Derive follow-up and progress bookkeeping from their existing owners while preserving public SDK, CLI, config, protocol, and persisted data contracts.
941093c to
656182d
Compare
Pass existing internal options through core helpers and derive flags and bookkeeping from their existing owners. Preserve public SDK signatures, CLI/config/protocol shapes, persisted data, explicit output projections, and asynchronous snapshots. Keep Doctor's selected and supplemental provider registrations under one inspection lifetime. Preserve provider precedence and source selection, honor main's ordinary runtime registry ownership, and reject provider lookup after inspection release. Removes 125 net production lines across 35 files. The derivable-core sweep and BELOW-1000 coverage are recorded in the PR. Validation includes the original 778 focused tests and SDK API comparison, final 51 focused tests, affected type graphs, zero runtime and Madge cycles, the suppression gate, and independent review. Exact-head hosted CI run 37584466877 passed on 656182d.
What Problem This Solves
Core command, reply, channel, and plugin helpers repeatedly reconstruct internal options and maintain bookkeeping already available from an owning object.
Doctor's web-search availability probe also caused a second plugin-registration pass during tool-schema inspection. That could repeat failed registrations, select a different duplicate provider, and leave supplemental providers outside the inspection's cleanup lifetime.
What Changed
Pass existing options through internal helpers, derive Doctor's default-agent flag from its path, remove unread plugin-trust parameters, and derive follow-up and progress bookkeeping from their existing owners. Explicit serialized projections and asynchronous snapshots remain where their behavior matters.
Web-provider discovery reuses matching inspection-owned registrations and loads missing declared or legacy providers under the same inspection's cache lifetime. Matching inspections keep their source checks, provider precedence, and release guard before ordinary registry reuse. Main's prepared-generation and ordinary request-registry selection remain authoritative outside inspections.
Public SDK signatures, CLI/config/protocol shapes, persisted data, search availability, and per-agent tool factories are preserved. No suppression, baseline, ignore, budget, timeout, or retry policy is weakened.
Lane l424 (derivable-core), BELOW-1000: 125 net production lines removed across 35 files (325 added, 450 deleted), excluding tests, fixtures, test support, generated files, and declarations.
Coverage and retained boundaries
The initial structural sweep read production TypeScript files in commands (662), CLI (541), auto-reply (519), plugins (782), and channels (290), then widened to flows (51) and routing (12). Detailed caller/consumer review covered changed helpers plus command registration, plugin rollback, channel finalizers, routing indexes, and setup/discovery flows.
Retained public CLI command-group and plugin test-runtime signatures, exact status output projections, channel SDK contracts, authority/admission snapshots, distinct route/session identities, and lifecycle-owned caches. Cross-repository reference searches covered src, extensions, packages, ui, apps, scripts, docs, and test.
Evidence
pnpm test src/flows/doctor-tool-schema-inspection.test.ts --maxWorkers=1reported 29.17 seconds runner wall time and 26.81 seconds in Vitest.pnpm test src/plugins/tools.inspection.test.ts --maxWorkers=1reported 419.54 seconds wall time (415.80 seconds in the runner; 368.93 seconds in CI-mode Vitest) on the contended macOS host, mostly compilation; test bodies totaled 4.135 seconds. Fresh independent review was scoped-clean through P2.CI attribution: the original
checks-node-changed-compact-large-9failure was duplicate Doctor registration, also reproduced on its main parent; this PR repairs the inspection flow. The laterchecks-node-changed-compact-large-20failure was cron's built-artifact selection. Main fixed that inf8f80eaff271049014578a54d394face26ea8d83; the rebase preserves that owner and drops the duplicate lane fix. The corresponding CI-gate failures were consequential; 26 and 21 fail-fast cancellations respectively remain historical missing coverage, to be replaced by the final exact-head run. The published941093c4head could not attach full CI because it conflicted with that main repair.Final reviewed head:
656182db410f5c8026ec03436d18ff350a013846, tree0c082d9e29045783f194f9eedc58b2331ede1fa3. The reviewed, signed tree passed the rebase checks above. Hosted CI on this exact head is required before landing.