Skip to content

Let the existing wire metaclass own CLI tool declarations - #2626

Closed
trissim wants to merge 2 commits into
integration/bus-current-mainfrom
next/cli-tool-argument-registration
Closed

trissim wants to merge 2 commits into
integration/bus-current-mainfrom
next/cli-tool-argument-registration

Conversation

@trissim

@trissim trissim commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

An abstract subclass of CliReadArguments inherits its external aliases and the old __init_subclass__ hook immediately overwrites the Read decoder with that uninstantiable class. A normal read then raises TypeError. Replaying the integration-base source reproduces this exact failure.

CliToolArguments now uses the existing RegisteredWireMeta and one RegistryConfig, keyed by each declaration's external cli_names tuple. Registration happens after Pydantic/ABC construction. Decode derives matching shapes from that registry; the private types dictionary and registration hook are deleted. The same registry object is exposed through the normal library-owned view, without another alias map, metaclass or production class.

Claude ToolUse.call and OpenCode ToolState.call retain their shared decode entrypoint. Seven shapes preserve all 13 case-sensitive external spellings, field aliases, extra input, canonical records and edit patches. Unknown names and invalid arguments remain the original call. Exact duplicate alias tuples fail at declaration through the library. Overlapping nonidentical tuples fail explicitly at decode before validation; declaration-time overlap detection is not claimed. The new-case edit count remains one declaration, as before; the gain is correct shared lifecycle and collision handling.

Plan 6.4 now preserves the independent Pi producer ABI versus converter-coverage comparison, removes the bogus external-manifest deletion target, corrects the still-live ThreadRename.kinds entry and fixes the backend capability MRO instruction. Four other registration owners and name/sigil/path work remain. Shared phase-proof changes belong to #2627; this does not close the whole phase.

Source evidence uses NRA's original class census and compact family projection across Core/hooks/tests/tools, paired Toad and installed metaclass-registry/Pydantic source. Before/after: 1,643/1,644 modules, 7,434/7,438 original classes, 7,144 projected classes each, zero parse omissions. The 290/294 unprojected originals remain explicit, including four new function-local declaration controls. The compact index does not resolve the AutoRegisterMeta package re-export as a base of RegisteredWireMeta; source inspection and a fresh runtime MRO read confirm composition with ModelMetaclass. This is source evidence plus bounded runtime checks, not a global equivalence proof.

Validation:

  • Focused Claude/OpenCode models, edit presentation and declaration lifecycle: 31 passed in 0.63s.
  • Fresh CLI/UI-model entrypoint imports: 2 passed in 3.73s.
  • Genuine fresh declarations exercise automatic discovery, abstract exclusion, duplicate tuples and partial alias overlap without registry/state monkeypatches.
  • The initial run passed 26 and failed two newly written assertions that incorrectly put call identity on search preview records. The corrected check follows its actual ToolCall/transcript owner; original failed output is retained.
  • git diff --check passes. Receipts, baseline reproduction and runtime MRO are in /home/ts/.cache/agent-scratch/cli-tool-argument-family.

No live install or installed qualification was performed by this branch. The paired integration owner retains that handoff.

@trissim trissim left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted source checkpoint. The private hook ran before abstract-class exclusion and could hand a working Read alias to an uninstantiable specialization. Existing RegisteredWireMeta now owns that lifecycle; the private types map and hook are deleted. I read the metaclass/library contract, both real Claude/OpenCode consumers, all concrete alias declarations and the fresh-declaration controls. External spellings, input refusal behavior and recorded edit presentation remain at their existing owners. Exact duplicate tuples fail at declaration; partial alias overlaps fail at decode before validation can disguise the collision as invalid input. No declaration-time partial-overlap claim is made. Independently replayed actual CLI-family and edit-evidence cases: 21 passed in 0.47s. The plan also stops demanding deletion of independent producer ABI coverage and corrects its stale ThreadRename/backend-MRO instructions. Remaining registries/name/sigil/path work and installed qualification remain open.

@trissim

trissim commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Closed by the commander: no commit ahead of main; its work landed through #2635/#2636.

@trissim trissim closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant