Repository navigation
refactor: consolidate Gateway and session owners - #180432
Conversation
Use the existing validated Gateway handler owner for all three catalog methods. Keep the current error mapping, logging, exact request options, and all six Labs checks before I/O and immediately before each reply. Extend existing boundary coverage for preview revocation, malformed inputs, and typed versus unknown public failures. All 16 owner/validator cases pass before and after the cut. Targeted native types, typed lint, format and planner pass; independent P0-P2 review is clean. Removes 18 net production lines without a new helper or public contract. Best-effort tradeoffs accepted: none newly introduced.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR consolidates Gateway validation, session preference projection, delivery helpers, operation queues, and worker resource bookkeeping. Example: Patch an existing session with execHost set to " GATEWAY ".
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR removes duplicate implementations using existing owners, with no concrete introduced regression found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway handlers receive validated RPC requests, preserve request authority, and invoke session, notification, catalog, and filesystem owners that return responses or commit existing state. flowchart TD
Clients --> GatewayHandlers
GatewayHandlers --> SharedValidation
SharedValidation --> SessionPreferences
SharedValidation --> PushAndCatalogOwners
SessionPreferences --> ExistingSessionState
PushAndCatalogOwners --> ResponsesAndEffects
Technical reviewBest possible solution: Land the existing-owner consolidation once the exact-head required checks complete successfully. Do we have a high-confidence way to reproduce the issue? No failing user scenario is claimed for this refactor, and no target code was executed during the read-only review. Is this the best way to solve the issue? The change appropriately reuses existing owners while preserving distinct policies, request identity, error envelopes, and cleanup ordering. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d08aeb1d984a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -192, Tests +168, Other -1. Total -25 across 26 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 4:23 AM ET / 08:23 UTC. |
|
Merged via squash.
|
* refactor(gateway): share Claws catalog validation and errors Use the existing validated Gateway handler owner for all three catalog methods. Keep the current error mapping, logging, exact request options, and all six Labs checks before I/O and immediately before each reply. Extend existing boundary coverage for preview revocation, malformed inputs, and typed versus unknown public failures. All 16 owner/validator cases pass before and after the cut. Targeted native types, typed lint, format and planner pass; independent P0-P2 review is clean. Removes 18 net production lines without a new helper or public contract. Best-effort tradeoffs accepted: none newly introduced. * refactor(daemon): reuse service path fallback owner * refactor(gateway): share push request validation * refactor(sessions): share patch preference projection * refactor(gateway): share file operation error envelopes * refactor(gateway): reuse normalized exec host projection * refactor(heartbeat): reuse shared summary type * refactor(sessions): share legacy delivery merge helpers * refactor(core): reuse async lock for operation queues * refactor(sessions): reuse worker pressure subscription owner
Adapt #190982 to the existing stable plugin handoff. Internal callers without an external recipient resume through webchat rather than the last recorded external route. Preserve current authority, target identity, cleanup, and settlement checks. Export only the existing internal-route predicate from #180432. The composed consumer test uses the host-owned SQLite shard for actual idle and queued dispatch and managed message-tool rejection. Adapted from e375530; helper export only from b109428. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Gateway and session code repeat preference projection, request validation, error shaping, FIFO operation queues, and delivery-context projection that already have shared owners.
What Changed
Reuse the existing session preference projector for verbose/trace and execution host settings; remove the orphan level-override module and its stale test mock. Migrate push and ClawHub handlers to the existing validated Gateway handler, keeping the original request-options identity and effect-time authority checks. Reuse the existing file-error, async-lock, memory-pressure subscription, physical-path fallback, heartbeat type, and delivery-context owners.
This is the Gateway/session AREA slice of a larger measured cleanup: 26 paths, 192 net production lines removed, and 168 net test lines added. The original accumulator touched 99 paths, so the campaign requires separate below-500 area PRs for attribution. The other open slice does not touch these production files.
No intended user-visible behavior, error text, protocol/config shape, schema, dependency, or public Plugin SDK contract changes. The legacy and current delivery-target predicates retain their different policies. Main's unrelated inline route-metadata projection stays inline.
Best-effort tradeoffs accepted
None introduced in this slice. Validation, authorization after awaits, FIFO ordering, failure recovery, joined cleanup, durability, and public contracts remain in place; this removes private duplicate implementations, not their safeguards. Phase E standalone session-memory machinery and tests are untouched.
Evidence
src/transcripts/library.query-budget.test-support.tsproduce 103 actual versus 100 expected. The third row is present verbatim in this branch's newer base04a0bdfa; the complete diff adds no suppression. The two cron/UI rows also have a retained identical clean-base replay from the preceding area. No allowlist was widened, and this failure is not reported green.