Skip to content

refactor(composition): unify capability bindings and cleanup ownership - #8441

Merged
gensokyo-dev merged 6 commits into
mainfrom
refactor/capability-module-ownership
Nov 1, 2026
Merged

gensokyo-dev merged 6 commits into
mainfrom
refactor/capability-module-ownership

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #8429. Refs #740.

Service construction, live availability and shutdown previously had separate server lists, so extending a capability required keeping multiple inventories aligned. Compose 49 precisely typed services through named bindings that register their close capability at acquisition; successful cleanup leaves the pending set, while failed owners remain retryable. CLI and MCP share the remaining Frida/Cutter/GDB/Rizin factories.

Contract and boundary impact

  • Owner: composition owns factories and lifecycle binding; application CapabilityScope owns pending cleanup, and provider-owned pure metadata supplies the shared static declaration. MCP retains argument/schema registration; BinarySession retains its single transition/admission barrier.
  • Scope/authority: maintenance of existing capabilities under the parent refactor; no new provider or target authority requiring a scope decision. Caller-owned optional observations remain borrowed. Android fallback remains available after construction/cleanup failures and is released after successful provider cleanup.
  • CLI/MCP: named handler contracts, caller choices and existing one-shot/connection lifetimes preserved. Both compact/full SDK catalogs are byte-identical to the pinned baseline (234 tools, 6 prompts; 180 CLI commands).
  • Evidence/catalog: identities and operation inventories move to pure source owners, with all source and compiled-verifier consumers migrated. The generated provider projection corrects 4 existing provenance omissions/assignments (web source/module tracing, Harmony, QLOG), yielding 67 providers instead of 63; other catalog sections remain unchanged. No new engine/platform qualification is implied.
  • Package/setup: generated catalogs and build outputs remain ignored; no installer/configuration changes.

Evidence and regression coverage

The new successful-peer cleanup regression fails with the old manual close list restored. Controlled tests cover synchronous/undefined cleanup failures, concurrent close, failed-owner retry, caller-owned observations, constructor failure and SDK shutdown/publication. The moved Frida test body is unchanged and discovered in its provider lane.

Actual public workflows: 5 CLI tasks per arm; 7 MCP tasks per arm (424 calls total), including real GitHub CLI, NuGet, agent-browser, NewPipe, WASM, Ghidra/jq and mixed target routing. Independent source-format oracles and complete baseline/feature Evidence/checkpoint/Unknown-history comparisons passed. Ghidra retained the same owned JVM across healthy reset.

Local Codex CLI requested gpt-6.1-terra/high with 19 selected tools: 32 calls across 4 domains, plus 9 calls in an independent fresh process. All complete facts/IDs/history matched baseline. The model honestly left its JS JSON.stringify self-check unverified after object key order changed; independent full structural/fresh-checkpoint verification resolved content equality. No model rerun or token-savings claim. Detailed verification.

The two actionable Greptile findings are fixed at their owners: fully erased module-edge facts are checked against compiler emit; 37 whole-provider bindings now resolve the same named canonical arrays used by contract families. A regression mutates the real ADB group with a new valid operation and proves it reaches the actual provider without a metadata edit. Both old representations fail the new checks. Final type/source (228 cases)/SDK-MCP (34 cases) checks pass; final real mixed-routing replay adds 58 calls with complete baseline/Unknown parity and no OOM. Public product and SDK catalogs are byte-identical to their qualified pre-review equivalents.

Validation performed

  • npm run build:cached, npm run typecheck, module/architecture/discovery/production-reachability checks, changed-file lint/typed lint, npm run docs:check, npm run format:check — passed (relevant test groups/results in the report).
  • Source/conformance, SDK schemas, CLI/MCP startup/availability/investigation/cleanup regressions — passed after correcting preserved harness/assertion failures described in the report.
  • Serial real tasks ran under 1 CPU/4 GiB hard/3 GiB early-stop with verified process-family cleanup; no OOM. Whole-repository ordinary/typed lint hit the local early-stop limit; bounded changed-file checks passed.
  • npm run knip — the sole failure is unused DarwinHelperCache in an untouched file; independently reproduced identically on clean baseline 6e9ee97. No unrelated repair.
  • CI CodeQL aggregate — six exact existing alert IDs are open on the same base 6e9ee97; all 24 paths were traced to equivalent pre-existing local environment selection. Attribution and base-instance evidence. No source suppression or global alert dismissal; owner-authorized unrelated-check exception applies after other checks/reviews complete.

Final head a7532ecd4: required CI (Static checks, Portable tests, CI required, Conventional PR title) passed; Codex completed with no new findings, Greptile passed and both actionable threads are resolved. The sole failed aggregate is the same six existing-base CodeQL alerts documented above.

Compatibility and remaining proof gaps

No caller-visible migration or new execution authority. Real JADX, Hopper/IDA/JEB/Cutter GUI/debugger/Frida target attachment and a genuine local model-weight artifact remain outside this verification scope; real NewPipe coverage is inventory/graph. This increment does not split BinarySession into competing lifecycle owners. Exact cleanup retry, synchronous failures, concurrent close and SDK publication/cancellation are checked at controlled production seams; real repeated close alone does not prove a natural cleanup failure.

Author readiness

Human owner: @N0zoM1z0

The owner explicitly authorized implementation, readiness declarations and merge, including delegation of normally human-filled fields. The agent reviewed the diff and evidence under that delegation; these declarations are entered on that basis. A separate in-person review is not asserted.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Concrete bounded issue linked; existing capability authority retained.
  • Superseded construction/close/catalog lists removed and relevant documentation updated.
  • Final real-workflow evidence, required CI and actionable review findings checked on exact head a7532ecd4; the six existing-base CodeQL alerts are the sole documented exception.

Compose typed services, live availability and exact cleanup capabilities together.
Derive provider catalogs from pure source declarations and share live-tool factories
between CLI and MCP. Retain failed cleanup owners without revisiting released peers.

Refs #8429

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Document paired public workflows, actual Codex CLI qualification, complete
Evidence parity, measured resource use and explicit provider/check limitations.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T05:14:17.641683Z a7532ec Manual request
ℹ️ 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.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 4971b35859

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[High impact] The PR appears safe to merge, with both previous findings addressed and no new blocking issue found.

Summary

Moves service construction, availability and cleanup into shared capability bindings. Provider catalogs read static declarations and canonical contract groups.

  • MCP services register their cleanup with one shared owner.
  • Provider catalogs draw identities and operations from shared declarations.
  • CLI and MCP use the same factories for four live tools.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Contracts["Canonical contract arrays"] --> Groups["TOOL_CONTRACT_GROUPS"]
  Groups --> Families["Tool-family selection"]
  Groups --> Catalog["Provider catalog"]
  Metadata["Pure provider metadata"] --> Declarations["CAPABILITY_DECLARATIONS"]
  Declarations --> Catalog
  Declarations --> Bindings["Typed service bindings"]
  Factories["Shared CLI/MCP factories"] --> Bindings
  Bindings --> Services["Services and availability"]
  Bindings --> Scope["CapabilityScope"]
  Scope --> Close["Close pending owners"]
  Close -->|Success| Released["Remove released owner"]
  Close -->|Failure| Retry["Retain owner for retry"]
Loading

Reviews (2) · Last reviewed commit: "docs(composition): qualify review correc..." · Reviewed by Greptile

Comment thread scripts/lib/import-specifiers.mjs Resolved
@gensokyo-dev

gensokyo-dev commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

CodeQL attribution for the six reported alerts on 4971b358592fcfa8cabd78eb5a4e705e9e0b1822:

All six exact alert IDs have open instances on the pinned base 6e9ee97a69cb16c7150d8b550e705cba055ee4f0 (refs/heads/main): 215, 490, 491, 493, 494, 495. GitHub reports their creation on 2026-10-30. The exact-base JavaScript analysis is 2069611109.

I inspected all 24 SARIF paths and obtained an independent source review. Their new source locations are the factories' default process.env: GDB/Rizin select the existing REA_GDB_COMMAND/REA_RIZIN_COMMAND, and Cutter selects the existing REA_CUTTER_BRIDGE_DIR. The original constructors already used these environment fallbacks. Production CLI/MCP callers still supply their previously selected explicit environments, with unchanged constructor options and argv.

RegularFile.ts and ProviderProcess.ts are byte-identical to base; the latter still launches structured argv with shell: false. Cutter's affected code is unchanged apart from the six-line identity-constant removal: the same path resolver, private-directory/ownership/no-symlink checks, descriptor-name and bounded regular-file checks remain. Neither new MCP request inputs nor expanded process/filesystem authority were introduced. This attributes the reports to existing explicit local configuration flows; it does not claim to repair the underlying open alerts.

No source suppression, global alert dismissal or unrelated security change is included. Per the owner's explicit instruction to allow merging when a failed check is unrelated to this PR, this existing-alert CodeQL aggregate is eligible for that exception after the remaining CI/review completes. Raw SARIF, exact-base alert instances and the attribution assessment are retained with the local verification receipts.

Final-head recheck: a7532ecd46b5f6b46b8f190bf23e287c96db963c reports the same exact six IDs above, with no additional finding. The reviewed factory defaults and sink code remain unchanged by the two review corrections.

Only whole-declaration type imports and type queries erase their module edges
under verbatimModuleSyntax. Compare the parser facts to compiler emit and retain
inline-only import/export edges in constructor ownership guards.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Share canonical contract groups between advertising families and provider
metadata. Keep precise subsets explicit, reject unknown groups and operations,
and prove a new real ADB group operation is included without a metadata edit.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Record compiler-backed module-edge regressions, canonical group ownership,
unchanged public catalogs and the final real mixed-domain checkpoint replay.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: a7532ecd46

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gensokyo-dev
gensokyo-dev merged commit e18594b into main Nov 1, 2026
58 of 59 checks passed
@gensokyo-dev
gensokyo-dev deleted the refactor/capability-module-ownership branch November 1, 2026 05:30
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 1, 2026
Upstream's composition refactor (morluto#8441) moved RIZIN_PROVIDER_IDENTITY
and OBJDUMP_PROVIDER_IDENTITY into their own modules, while this branch
had added the Rizin version probe beside the identity in RizinCommand.ts
and imported both from there. Take upstream's identity modules; the
probe stays with the command it builds and imports the identity from
RizinProviderIdentity.ts.
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 1, 2026
Take main a6caa79 (morluto#8441, morluto#8450). The one conflict was an import in
tests/boundary/providers/hopper/hopperAnalysisProfile.test.ts: main
moved HOPPER_PROVIDER_IDENTITY to HopperProviderMetadata.js, and this
branch added the rawLoadAtEntry fixture import; both are kept.
coyoteXujie pushed a commit to coyoteXujie/rea that referenced this pull request Nov 2, 2026
morluto#8441)

Bind typed service creation, observed availability and retryable cleanup in one composition owner. Reuse selected CLI/MCP factories and canonical contract groups without copying provider operation inventories.

Closes morluto#8429. Refs morluto#740.

Validated paired real application workflows, actual local Codex CLI Terra/high use, complete Evidence and Unknown checkpoint parity, compiler-backed import boundaries, SDK schemas and final real mixed routing. Automated review findings were fixed at their producing owners. Existing exact-base CodeQL alerts are documented on the PR under the owner-authorized unrelated-check exception; no global alerts or security rules were changed.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@morluto morluto added the area: providers Provider and capability discovery, including provider proposal triage label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: unify capability composition and retryable resource ownership

2 participants