Repository navigation
refactor(types): remove chained type assertions in extensions - #124079
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 4:36 AM ET / 08:36 UTC. ClawSweeper reviewWhat this changesThe branch removes selected chained TypeScript assertions across extensions by using typed construction, narrowing, and direct structural values. Merge readinessKeep open. The prior P3 binding-identity finding is fixed, but this maintainer-labeled PR still needs direct Codex-source contract review before a merge recommendation. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw extensions translate provider, channel, and tool APIs into the shared plugin SDK. This PR refines typing at those boundaries while intending to preserve runtime data flow. flowchart LR
A[Provider or channel API] --> B[Extension adapter]
B --> C[Typed boundary conversion]
C --> D[Plugin SDK contract]
D --> E[Agent or channel runtime]
Decision needed
Why: Repository policy requires the acting reviewer to inspect Codex source before a Codex-related merge verdict, and that source is unavailable here. Before merge
Agent review detailsSecurityNone. PR surfaceSource -25. Total -25 across 34 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Validate the changed Codex app-server request and response conversions against the sibling Codex source, then merge once exact-head checks are green. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a static type-refactoring PR, not a report of user-visible failure. Is this the best way to solve the issue? Unclear: the identity repair is appropriate, but the broader Codex protocol conversions need direct upstream-contract inspection before they can be called the best solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f4beff12cd5e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
|
Merged via squash.
|
…aw#124079) * refactor(types): remove chained assertions in extensions * fix(codex): preserve canonical binding identity
What Problem This Solves
A maintainer-requested static-analysis campaign found 185 chained type assertions in this assigned plugin lane. These assertions discard type evidence, obscure real owner contracts, and prevent clean enablement of the new rule across
extensions/*.Why This Change Was Made
This removes the 57 sites that can be repaired without runtime behavior changes: preserving discriminants and literal structure, carrying typed objects through construction, narrowing dynamic values at existing boundaries, using the actual exporter capability constraint, and deleting stale Discord constructor compatibility. It also preserves the Codex binding normalizer's canonical no-op identity path after ClawSweeper identified an eager-clone regression. Sites that depend on SDK-private state, nominal duplicate dependencies, incomplete public contracts, or new runtime parsing are intentionally left for the rule-enablement or owner follow-up work below.
AI-assisted: yes. The final committed branch passed two independent Codex autoreview runs with no accepted/actionable findings.
User Impact
No user-visible behavior changes. The affected plugin code keeps the same runtime values and flow while gaining stronger compile-time evidence. Production code shrinks by 25 lines.
Evidence
node scripts/check-changed.mjs: passed theextensionsandextensionTestslanes. Crabbox had no readyci-fastprovider, so the repository wrapper used its documented serialized local fallback.check-lint-core-4failed on pre-existingno-shadowerrors inui/src/test-helpers/control-ui-e2e.ts:2746and:2753, reproduced unchanged on currentorigin/main(d2be00e171f63).git diff --check: passed.origin/main: clean, no accepted/actionable findings.app-server-protocol/src/protocol/v2/thread_data.rs:256,item.rs:226,account.rs:282,turn.rs:407, plus app-server emission/refresh paths inbespoke_event_handling.rs:1287andexternal_auth.rs:67.Intentional and deferred leftovers