Skip to content

refactor(gateway): deslop gateway - #164603

Merged
steipete merged 8 commits into
mainfrom
deslop/l349-gateway-root2-20261003
Oct 4, 2026
Merged

steipete merged 8 commits into
mainfrom
deslop/l349-gateway-root2-20261003

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Gateway root retained single-use forwarding layers, unused internal options, and repeated projection/cleanup logic after the first cleanup pass. This batch keeps behavior with its existing owners and removes 565 net production lines across 46 files. Tests/support add 38 lines across 3 files. Configuration, stored data, wire responses, CLI output, and public SDK contracts are unchanged; no migration or operator action is required.

The simplifications inline the one-call request executor; remove unused HTTP message-channel options; remove the approval-audience source-provider abstraction; consolidate pairing and iOS approval projections; reuse existing session/store/type owners; and simplify worker evidence, channel suppression, credential planning, diagnostics, and bounded media filenames. Cleanup transactions retain their exact-record and live-authority checks. Creation forwarding, archive reading, session resolution, and cleanup/error paths with ambiguous contracts were withdrawn rather than changed during landing.

Fixes found along the way

Restored the embeddings endpoint’s explicit chat.send admission and scope resolver after review caught an incomplete restoration. The existing trusted-proxy test now proves reader denial before provider work, writer success, and admin-only model override. Its negative control failed for the intended HTTP 200/effect mismatch; the corrected 43-test suite passed (55.97 s wall, no extra Gateway boot).

Registered the shared OpenAI-compatible Gateway fixture with the existing lifetime owner, preventing reset hooks from deleting its active database. Existing startup/close behavior and cleanup assertions remain; there are no new sleeps, retries, relaxed timeouts, or weakened assertions.

Validation and scope

Conflict-only rebase onto cc740dfaf528fa92d36af5eba2e97c15708c3c4f retained main’s archive and session-resolution implementations. Exact rebased head 4062cde6201020b26dbce49376cca3682d2e0cb2 passed 306 tests across 13 files (134.76 s), production and Gateway-root/server test types, strict lint (48 files, 0 warnings/errors, 18.41 s), and both zero-cycle checks. Earlier full static validation passed all 27 dependent type graphs, guards, and three dead-export scans. Independent P0/P1 reviews are clean; current ClawSweeper review reports no actionable patch or security finding.

The isolated sessions.create command passed on clean main and unchanged prior candidate on the same lease. The earlier timeout’s cause remains unproven; creation-forwarding changes were withdrawn and the full worktree-creation suite passes. Earlier Mac startup and history timing failures are not claimed as fixed. No full-tree green CI claim is made below.

The batch is BELOW-1000 after exhausting sound opportunities and preserving concurrent changes. The complete largest-first 314-file coverage log follows the evidence.

Evidence

Reviewed/tested PR head: 4062cde6201020b26dbce49376cca3682d2e0cb2. Exact-head CI: 37173313459. Five root failures remain; the aggregate gate reflects them. No failed check is being called green.

PR job / failure Independent main evidence
checks-fast-baseline-ratchets: check-test-mock-exports.mts exits with spawnSync git ENOBUFS The same command/error on scheduled main 301a040200d10e65813c434a57364c5eb79e7b97: job 111351985083. This PR does not change the ratchet or its Git/source-loading helpers.
checks-node-changed-compact-large-14-2: aggregate global preview lacks lastMessagePreview Same test, field, and payload on main job 111351986703, also reproduced in a clean main Linux checkout. The preview handler and enrichment producer are unchanged; resident preview enrichment is optional.
checks-node-compact-small-3: type-suppression inventory has 18 entries rather than 16 Same two src/plugin-sdk/plugin-config-runtime.test.ts negative type assertions on main job 111351986757, also reproduced locally on clean main. This PR does not alter these assertions or inventory tooling.
checks-node-changed-compact-small-4-1: presence expects [email protected] first but receives [email protected] Clean main 301a040… reproduced the identical email-order mismatch on repetition 3 of 20; the other 19 repetitions passed. Unchanged producers timestamp each connection and sort descending by timestamp; the unchanged assertion incorrectly pairs that result with insertion order. Both identities are present. No stability fix is claimed.
checks-node-changed-compact-small-5-2: catalog refresh observes one readAcpSessionMetaForEntries call rather than zero Twenty focused clean-main repetitions passed. Replaying the CI job's recorded 33-file selection, four-worker group, and Node 24.19.0 on clean main 301a040… reproduced the same one-call assertion. The baseline lease reached its hard TTL during later shard cases; the matching failure was captured, but a completed full-shard result is not claimed. The test, row-fact/ACP producer, and catalog invalidation source are unchanged by this PR; the reviewed inlining adds no read or await.

Baseline focused command: node scripts/run-vitest.mjs src/gateway/server-request-context.presence.test.ts src/gateway/server-methods/sessions-list-config.test.ts (20 separate diagnostic executions, no changed tests or retry behavior). The recorded-shard comparison used node --import tsx scripts/ci-run-node-test-shard.mts with the original job's decoded test-group configuration.

The exact candidate passed 306 focused tests, production and Gateway test typechecks, strict lint, both zero-cycle gates, and independent P0/P1 review. Its security-fast, OpenGrep, all Security High checks, and security-sensitive review passed. The earlier embeddings authority bug is fixed and has a failing-before/passing-after regression; no security, authority, or permission failure is admitted by this exception.

Under the explicit coordinator order, these inherited non-security failures are reported for the main CI owner rather than repaired in this lane. Merged as 917be1c590630ec4def5a9e7d547da15bb8d2c6f by squash pinned to the API head above; ancestry verified on fresh main. Final measured production reduction: 565 lines.

The review bot’s data-model prompt is a path-classification false positive: embeddings-http.ts only inlines provider-option construction and removes internal aliases; embeddings-provider-lifetime.ts inlines retention in the same in-memory retirement map. Neither changes stored vector metadata, schemas, formats, or migrations. The managed-image refactor retains the same SQL transitions, exact-record checks, transaction owner, and cleanup ordering. No data migration is introduced or required.

Gateway-root coverage: 314 production files over 200 lines
Lines File Result
1698 src/gateway/server-channels.ts READ: Combined suppressed-account projection and removed one-use default-runtime wrappers; original awaited cleanup, lifetime fences and restart ownership retained.
1685 src/gateway/server-chat.ts READ: Reserved heartbeat/Automations overlap; live event pacing, generation fencing, and terminal persistence remain.
1619 src/gateway/managed-image-attachments.ts READ: Retention, transcript membership, scoped authority, resizing and HTTP range handling have distinct contracts; no safe large consolidation.
1450 src/gateway/session-reset-service.ts READ: Retained: generation-specific cleanup, authoritative instance checks, ACP custody, guarded revocation retries, and postcommit publications are separate documented lifecycle contracts.
1436 src/gateway/node-registry.ts READ: Pairing leases, reconnect invalidation, transport fences, and SDK-visible methods each retain distinct lifecycle contracts.
1430 src/gateway/config-reload.ts READ: Retained source-epoch ownership, watcher/write reconciliation, persisted-but-unapplied baselines, and plugin drain receipts; no sound structural reduction without changing these contracts.
1375 src/gateway/session-create-service.ts READ: Creation forwarding cleanup withdrawn during the timeout investigation; exact original creation/commit option assembly retained.
1371 src/gateway/server-cron.ts READ: Reserved cron/heartbeat closure: wires canonical CronService to Gateway admission, agent/session targeting, notifications, system-monitor convergence, watcher handoff, mutation routing, and shutdown settlement.
1210 src/gateway/watch-node-http.ts READ: Consolidated node pairing-resolution events and removed repeat validation of already schema-validated bounded Watch declarations; preserved async authorization and response cleanup.
1185 src/gateway/call.ts READ: Inlined single-caller request executor into call owner, removing duplicate resolved-argument DTO and forwarding; auth/scope/deadline/abort behavior retained.
1135 src/gateway/control-ui.ts READ: media ticket, descriptor lifetime, range, and SPA routing guards preserve distinct authorization and response contracts; no further sound reduction.
1109 src/gateway/server-node-events.ts READ: Reserved heartbeat closure: dispatches paired-node events with connection revalidation, ordered voice dedupe/admission, image persistence and orphan cleanup, exec-run authorization, notification/exec heartbeat routing, chat subscriptions, APNs, and generation-bound presence writes.
1076 src/gateway/server-startup-post-attach.ts READ: Retained deferred readiness, plugin replacement, lazy prewarming, and distinct sidecar shutdown ownership; heartbeat owns associated tests and adjacent cron startup boundary.
991 src/gateway/openai-http.ts READ: Removed fixed message-channel option forwarding; retained explicit endpoint admission options required by the security regression rule.
895 src/gateway/openresponses-http.ts READ: Removed fixed message-channel option forwarding; retained explicit endpoint admission options required by the security regression rule.
763 src/gateway/exec-approval-lifecycle.ts READ: Expiry, observation retirement, handoff retention, and uncertain-verdict publication are distinct authority states.
746 src/gateway/server-http.ts READ: Ordered route admission and auth are distinct; lazy route modules are shared with upgrades/probes.
745 src/gateway/server-reload-hot.ts READ: SKIP: heartbeat Automations PR owns this file; runtime publication/recovery order remains untouched.
743 src/gateway/tool-resolution.ts READ: Protected heartbeat and Automations closure; kept tool policy and grant construction unchanged.
738 src/gateway/exec-approval-manager.ts READ: First-answer persistence and recovery guards preserve live authority through awaited writes; no safe removal.
737 src/gateway/control-ui-session-pr-subscriptions.ts READ: watcher, replacement, source, refresh, delivery and shutdown generations protect separate live-authority lifetimes.
736 src/gateway/session-row-projection-record.ts READ: Retained metadata/generation, parent-index and archived-row cutover contracts; no simpler equivalent found.
731 src/gateway/server-broadcast.ts READ: Recipient authority, sequence, serialization and backpressure caches have independent contracts; no safe consolidation.
726 src/gateway/github-publication-executor.ts READ: Local index custody, remote effects reconciliation and attribution are distinct ordering boundaries; retained.
719 src/gateway/server-plugin-reload.ts READ: Retained ordered drain, activation, rollback, and failed-retirement ownership; shared-looking phases have different publication and recovery contracts.
717 src/gateway/server-restart-sentinel.ts READ: Reserved heartbeat closure: recovers revision-bound restart intents through durable continuation/notice queues, preserves update-owner verification and target routing, and clears the singleton only after downstream custody is durable.
717 src/gateway/session-row-projection.ts READ: Runtime remains single projection owner; extracted subowners enforce independent readiness and invalidation lifetimes.
715 src/gateway/mention-inbox.ts READ: Preserve shipped 2026.9.8 synchronous SDK compatibility and FIFO worker/native authority reconciliation.
715 src/gateway/server-startup-finish.ts READ: Reserved heartbeat closure: attaches transport before usable readiness, publishes deferred plugin generations and sidecar owners, activates scheduled services, and wires config/security reload plus post-ready maintenance with shutdown fencing.
712 src/gateway/sessions-patch.ts READ: Simplified: call the canonical model-fallback builder directly instead of a Gateway forwarding helper; catalog generator remains necessary for synchronous preparation before asynchronous catalog acquisition.
709 src/gateway/node-registry-private.ts READ: Private worker proof and generation-bound dispatch preserve required separation from public invocations.
708 src/gateway/server-session-events.ts READ: Transcript queue aliases retain physical-store generation and publication ordering; legacy marker still has current producers.
707 src/gateway/cron-stream-job-owner.ts READ: Reserved cron closure: serializes one source process lifecycle, durable source identity, generation fencing, restart backoff/exhaustion, loss counters, and bounded teardown with retained failed handles.
707 src/gateway/session-sharing.ts READ: Initial and pre-commit checks intentionally revalidate current roles, target identity and creation custody.
707 src/gateway/session-utils-row.ts READ: Explicit wire-field ordering, absence semantics and per-snapshot temporal projection are observable contracts.
705 src/gateway/github-personal-oauth.ts READ: Personal profile leases, rotating token recovery and selection CAS are required; retained.
702 src/gateway/session-companion-ask.ts READ: Cancellation, request ownership, per-source fencing, CLI versus embedded execution and cleanup are real contracts; snapshot getter flushes pending notes.
695 src/gateway/server-restart-sentinel-agent-delivery.ts READ: Reserved restart/heartbeat closure: replays generated-media completion against exact requester/store/lifecycle custody, reconciles durable delivery evidence, charges attempts once, dead-letters ambiguous side effects, and persists internal media without duplicate visible sends.
694 src/gateway/cli-session-history-index.worker.ts READ: New main owner retains bounded SQLite batches, local sequence references, identity-first deduplication, monotonic matching floors, and stable ordinal paging; no lane changes.
694 src/gateway/server-lifecycle.ts READ: Reserved heartbeat closure: assembles node/watch/terminal/cron owners, publishes readiness/runtime handles through kernel methods, and stages admission fencing, run preparation, sidecar drain, plugin teardown, and diagnostic lifetime cleanup.
693 src/gateway/session-observer.ts READ: Excluded by heartbeat PR closure; tracked and dormant terminal-state ownership is deliberate.
689 src/gateway/server-worker-environment-startup.ts READ: Retained lazy artifact generation, revocation fencing, startup cleanup, and late-bound dispatch; distinct installation and node-enrollment contracts prevent a sound larger collapse.
682 src/gateway/server-chat-state.ts READ: Run-owned mutable record, incremental text projection, and provisional subscription indexes carry real release and rollback contracts.
681 src/gateway/chat-abort.ts READ: Cancellation must retain delegated authority, transcript settlement and queue/execution distinction; no redundant owner found.
681 src/gateway/hooks.ts READ: Protected heartbeat closure; hook wake and dispatch contracts retained.
680 src/gateway/server-close.ts READ: Reserved heartbeat closure: orders Gateway hooks, reply drain, runtime/channel/process disposal, heartbeat-before-cron settlement, socket closure, and final plugin/database retirement while retaining slow cleanup ownership and reporting warnings/failures.
680 src/gateway/session-activity-summaries.ts READ: Reserved concurrent x01 retry/timeout lane and heartbeat closure: schedules bounded utility-model recap work with transcript-generation commit guards, provider backoff and retry floors, exact lifecycle cancellation, hidden-session exclusions, and public summary-state projection.
680 src/gateway/session-sharing-preparation.ts READ: Positive/negative/incognito acquisitions require separate native source and postimage fences.
679 src/gateway/hooks-mapping.ts READ: Protected heartbeat closure; dynamic transforms and fan-out boundaries retained.
679 src/gateway/question-session-access.ts READ: Prepared facts and retained source lifetime protect current authority; unused access argument requires caller cutover outside assigned root-file scope.
677 src/gateway/cron-stream-output.ts READ: Reserved cron closure: bounds pipe intake and line matching, preserves truncated-gap semantics, batches/coalesces output, owns dispatch cadence, and classifies pending/in-flight losses through stop.
676 src/gateway/server-runtime-subscriptions.ts READ: Audit and heartbeat subscription closure is protected; terminal publication fencing is substantive.
672 src/gateway/chat-display-projection.sanitize.ts READ: Display privacy, phased text, exact tool payload, and truncation flags carry distinct wire contracts.
668 src/gateway/mcp-app-operations.ts READ: Tool approval, requester authority and resource reads have distinct lifetime checks; retained.
665 src/gateway/github-repository-publication.ts READ: Checkpoint and personal publication admission differ from local-worktree ownership; no safe policy unification.
659 src/gateway/http-auth-utils.ts READ: device fallback rate accounting, live profile ceilings, cookie grants and post-await authority cannot be merged safely.
656 src/gateway/session-utils-list.ts READ: Federation winner, sorted-page retention, visibility and owner-first paging remain distinct required stages.
653 src/gateway/operator-approval-store.receipts.ts READ: Audit closure excluded; bounded SQL snapshot and receipt attribution contracts retained.
652 src/gateway/server-startup-config.ts READ: Serialized secret activation and deferred degradation/recovery track rollback lineage and provider-auth-only refresh; state cannot be collapsed without altering publication semantics.
652 src/gateway/session-worktree-preparation.ts READ: Rollback simplification withdrawn; original primary-cause aggregation, checkout/current-source custody, isolation checks, and rollback ordering retained.
651 src/gateway/session-row-projection-materialize.ts READ: Prepared/resident/private materialization paths retain different custody; no safe branch retirement found.
650 src/gateway/question-manager.ts READ: Synchronous shipped SDK resolution and async durable commits have distinct settlement contracts; no sound collapse.
647 src/gateway/agent-runtime-identity-token.ts READ: Audit/cron closure excluded; signed shape normalization and live delegated authority retained.
647 src/gateway/chat-display-projection.history.ts READ: Heartbeat/cron projection closure is reserved; TTS and forwarded-message deduplication preserve different transcript identities.
645 src/gateway/github-oauth-lifecycle.ts READ: Removed identity forwarding helper calls; uses the existing configured-identity owner directly.
640 src/gateway/session-utils-model.ts READ: Route-specific catalog/thinking policy and released stale-capability compatibility remain live callers.
636 src/gateway/config-reload-plan.ts READ: SKIP: heartbeat Automations PR owns this file.
633 src/gateway/github-publication.ts READ: Shared worktree claims and requester reconciliation retain different custody from repository checkpoints.
622 src/gateway/probe.ts READ: read-only device-token routing, verified listener evidence and diagnostic detail timeout boundaries remain necessary.
615 src/gateway/node-invoke-plugin-policy.ts READ: Audit closure excluded; plugin risk, dispatch authority, and completion attribution are distinct.
612 src/gateway/server-maintenance.ts READ: The small coercion cleanup was withdrawn because its required assertion-baseline update overlaps open lanes; original maintenance guards remain.
604 src/gateway/mcp-http.ts READ: Protected heartbeat closure; native tool authority and MCP transport lifetime retained.
602 src/gateway/server-runtime-state-prepare.ts READ: Bootstrap owns conditional worker/control capabilities and generation refs; lazy preparation boundaries are required.
597 src/gateway/control-ui-session-prs.ts READ: stale quota snapshots, forced refresh ordering, checkout publication and fork lookup already share their owners.
596 src/gateway/server-worker-placement-startup.ts READ: Retained independently tracked reconciliation, disk-space, and suspend work plus startup/shutdown drain ordering; no optional production dependency or unused runtime knob found.
595 src/gateway/server-runtime-state.ts READ: Explicit transport return contract retained; inference exposed the private portal startIngress method to consumers and broke their type contract.
590 src/gateway/server-startup-bootstrap.ts READ: Retained source/runtime config split, runtime-only auth/origin overlays, schema admission, and live plugin metadata generation; each overlay has a distinct reload contract.
589 src/gateway/github-publication-store.ts READ: Typed receipts, digest checks and execution CAS preserve durable behavior; storage migration would exceed cleanup scope.
587 src/gateway/github-publication-git-transport.ts READ: Command guards differ before and after effects; safe Git transport and snapshot handling retained.
587 src/gateway/server-request-context.ts READ: Removed private client-type mirror and singleton sets; reused live-client recipient filtering for approval broadcasts without changing capability/scopes or revocation rules.
586 src/gateway/sessions-history-http.ts READ: Preserved reauthorization and lifecycle fencing around JSON/SSE snapshots, coalescing, stream error cleanup, and bounded private state.
585 src/gateway/cli-session-history.claude.ts READ: Coalesce CLI fallback messages during the existing scan instead of replaying a second array through a single-use wrapper.
579 src/gateway/mcp-grant-store.ts READ: Protected heartbeat closure; host-only grant and native creator authority retained.
579 src/gateway/session-recovery-service.ts READ: Recovery queue, worker drain, source generation and successor publication fences serve distinct lifecycle phases.
578 src/gateway/github-repository-publication-executor.ts READ: API object publication differs materially from local Git/index publication; no transport unification.
578 src/gateway/session-artifact-read.ts READ: Artifact identities, message-role counters, preview byte limits and paged cursors preserve observable wire semantics.
572 src/gateway/github-personal-publication.ts READ: Explicit selected-account confirmation and exclusive local workspace custody remain required.
572 src/gateway/github-publication-coordinator-methods.ts READ: Admission, orphan recovery and worker claims have observable ordering; retained.
571 src/gateway/auth.ts READ: Wrapper cleanup withdrawn because the OpenGrep trusted-proxy security regression rule requires the named origin guard.
565 src/gateway/operator-run-authority.ts READ: Preserved source identity retention, monotonic revocation, live role checks, and original-versus-current model authority intersection.
565 src/gateway/session-lifecycle-state.ts READ: Excluded by heartbeat PR closure; no changes.
556 src/gateway/server-cron-notifications.ts READ: Reserved cron closure: transports guarded webhooks and failure alerts, redacts command diagnostics, preserves accepted/unknown delivery outcomes, and retains detached notification admission through cleanup.
548 src/gateway/server-reload-restart.ts READ: Retained restart debt and emission state machine; its focused tests are heartbeat-owned, so the coordinator rewrite would enter the protected closure.
543 src/gateway/chat-display-projection.core.ts READ: Recovery and display ordering consume reserved heartbeat/history projection; meaningful distinct presentation paths retained.
543 src/gateway/session-utils-store-lookup.ts READ: Prepared/eager lookup modes preserve distinct ordered-error and physical-source contracts.
541 src/gateway/server-core-runtime.ts READ: Kernel method availability, generation publication and attached-plugin replacement remain distinct owners.
538 src/gateway/server-restart-sentinel-notice.ts READ: Reserved restart/heartbeat closure: prepares and reserves durable notice custody, preserves route/thread translation, records platform-send facts before queue acknowledgement/hooks, and reconciles bounded retries without replaying ambiguous sends.
537 src/gateway/mcp-http.runtime.ts READ: Protected heartbeat closure; schema cache lifetime and native tool admission retained.
534 src/gateway/mcp-app-form-resources.ts READ: Question ownership, bounded upload budgets and App preview authorization have separate boundaries.
533 src/gateway/github-repository-publication-store.ts READ: Checkpoint digests, branch receipt lineage and execution fencing cannot be removed as redundancy.
527 src/gateway/session-transcript-read-kernel.ts READ: Different missing-database, reset-archive, read-window and exact-ID policies are intentional; generic dispatcher already owns projection.
524 src/gateway/chat-attachments.ts READ: Inline/offloaded media and rollback ordering enforce durable custody, image budgets and real caller options.
523 src/gateway/node-command-policy.ts READ: Platform defaults, pairing approval, dangerous command policy, and plugin declarations have distinct contracts.
518 src/gateway/server-methods.ts READ: Classified extra handlers in one pass while preserving plugin precedence, enumerable-property semantics, and safe auxiliary object creation.
518 src/gateway/server-reload-managed-secrets.ts READ: Source-only and full-secret publication share shape but use distinct CAS, lineage, rollback, and policy commit contracts; retained.
516 src/gateway/server-plugin-in-process-authority.ts READ: Retained live operator/caller/captured authority boundaries; requireScopedClient and disableSyntheticClient have production callers including plugin SDK.
514 src/gateway/server-aux-handlers.ts READ: Kept approval authority/terminal publication ordering and lazy per-kind handlers; heartbeat owns associated test and cron-grant closure.
514 src/gateway/server-runtime-services.ts READ: Reserved heartbeat closure: starts detached cron/maintenance after readiness, binds scheduled heartbeat execution to the serving context, rechecks current conversation authority during outbound recovery, and retains queue/runtime owners until shutdown settlement.
506 src/gateway/server-plugin-subagent-runtime.ts READ: Retained bounded completion ownership, model-override authorization, and public runtime result normalization; no safely removable owner.
504 src/gateway/server-reload-managed.ts READ: Retained managed restart preparation, shared-auth generation custody, and source-vs-runtime acceptance; focused managed-context tests are heartbeat-owned.
503 src/gateway/control-ui-asset-retention.ts READ: manifest/inode verification, atomic publication and claimed pruning preserve update and concurrent-preparer contracts.
503 src/gateway/operator-approval-store.rows.ts READ: Persisted untrusted row codecs and lifecycle tuple checks are required; no schema/retention changes.
502 src/gateway/session-observer-model.ts READ: Revision floors, dormant ownership, bounded persistence and lazy completion imports have named contracts.
501 src/gateway/server-plugin-reload-cleanup.ts READ: Retained separate drain/disposal/recovery budgets and unbounded settlement ownership; extraction would add indirection for minimal savings.
498 src/gateway/net.ts READ: Shared public address helpers have outside-root consumers; host/proxy/IPv6 distinctions encode security and platform contracts.
490 src/gateway/node-invoke-system-run-approval.ts READ: Applied: fold single-consumer error module into sanitizer; direct code/message/runId arguments replace repeated option objects.
484 src/gateway/operator-approval-standing-grants.ts READ: Cron closure excluded; definition-generation and parent-approval authorization retained.
484 src/gateway/tools-invoke-shared.ts READ: Preserved canonical shared HTTP/RPC invocation flow; scheduled-tool and upload-custody integration overlaps protected ownership.
483 src/gateway/server-worker-placement-session-target.ts READ: Deduplicated exact session-target selection inside its owner; inlined one-call cleanup closure while preserving release-before-settlement and post-release authority guard.
476 src/gateway/sessions-resolve.ts READ: Cleanup withdrawn during conflict-only rebase; retained current main preparation, deleted-agent validation, and resolver behavior.
468 src/gateway/session-row-placement-projection.ts READ: Batch coalescing, queued capacity, stale read leases and resident/exact priority are intentional.
463 src/gateway/session-sharing-policy.ts READ: Membership, creator, role-cap, incognito and sandbox authorization have separate documented semantics.
462 src/gateway/operator-approval-store.transitions.ts READ: Cron closure excluded; transactional first-answer and consumption contracts retained.
461 src/gateway/cron-exit-watchers.ts READ: Reserved cron closure: reserves process watcher slots before spawn, retries failures, retains cancelled predecessors and write-capable terminal callbacks, and transfers live children between scheduler owners.
461 src/gateway/session-history-tail.ts READ: Sparse pages require bounded widening, indivisible sequence groups, recovery context and snapshot generation fences.
459 src/gateway/plugin-icon-http.ts READ: Another open deslop PR owns this file; skipped edits.
455 src/gateway/session-list-filters.ts READ: Candidate, visibility, profile/facet, activity and owner filters intentionally run in different orders.
453 src/gateway/model-account-connect.ts READ: Retained required per-operation authorization, bounded sign-in lifetime, secret staging, and commit/replay state; no speculative alternate strategy.
451 src/gateway/cron-creator-authority-grant.ts READ: Reserved cron closure: mints and consumes single-use creator/management grants bound to live run, operation signal, requester provenance, delegated authority, method, and expiry; supports revocation and retained commit checks.
451 src/gateway/session-utils-store.ts READ: Public synchronous/read-only loaders and deleted ACP owner detection have current production callers.
449 src/gateway/client.ts READ: Host adapter owns auth storage, read-only policy and SSH lifetime; package/runtime boundary is necessary.
447 src/gateway/mcp-app-standalone-host.ts READ: Serialized browser host cannot share runtime imports; initialization and teardown phases are observable.
441 src/gateway/plugin-node-capability.ts READ: Another open deslop PR owns this file; skipped edits.
440 src/gateway/server-plugins.ts READ: SKIP: heartbeat Automations PR owns this file.
439 src/gateway/mcp-app-extension-runtime.ts READ: Native and embedded MCP owners have different preparation contracts; authority retention and approval checks retained.
439 src/gateway/session-access-authority.ts READ: Source grants, invocations and session-only borrows intentionally have independent revocation lifetimes.
438 src/gateway/dashboard-session-title.ts READ: Retained source custody release/reacquisition, title deduplication and retry, bounded attachment decoding, and speculative utility title behavior.
432 src/gateway/session-row-projection-refresh.ts READ: Exact/bulk read ownership, FIFO coalescing and selection priority require current state machinery.
430 src/gateway/mcp-app-host-files.ts READ: Read/write/subscription lifetimes differ; synchronous commit authority cannot reuse async interaction checks.
430 src/gateway/server-http-upgrades.ts READ: Upgrade budgets, node capability auth and current principal checks cannot be merged with HTTP semantics.
426 src/gateway/approval-web-push.ts READ: Receipt custody, delivery grouping, and post-await recipient/lifetime checks serve distinct request/terminal paths.
424 src/gateway/mcp-app-standalone.ts READ: Ticket signature, retained view binding and HTTP method behavior each enforce a distinct contract.
423 src/gateway/session-transcript-files.fs.ts READ: Reset archive discovery preserves per-identity fallback ordering, path containment and compressed header validation.
421 src/gateway/human-mention-policy.ts READ: Retained bounded identity-directory cache and distinct requester/recipient visibility decisions; every projection field has a consumer.
418 src/gateway/auth-rate-limit.ts READ: loopback penalties, overload admission and lockout retention have distinct concurrency/abuse contracts.
413 src/gateway/operator-model-presentation.ts READ: Retained distinct catalog/history/default redaction and current role publication; field-removal behavior protects wire merge semantics.
410 src/gateway/conversation-turn.ts READ: Durable reservation, route reauthorization and process-local reply waiter are separate owners; wire results differ by terminal state.
409 src/gateway/user-profiles-http.ts READ: retained bounded Gravatar reader because shared response reader does not await overflow cancellation; existing regression requires settlement.
408 src/gateway/session-row-scope.ts READ: Physical federation and logical aliases differ; index selection avoids resident-store scans.
407 src/gateway/server-run-shutdown.ts READ: Reserved heartbeat closure: drains pending replies/queued turns, waits for terminal persistence, marks exact live run generations for restart recovery before cancellation, and distinguishes normal stop from recoverable restart aborts.
405 src/gateway/control-ui-plugin-assets.ts READ: immutable advertised revisions, byte-budget serialization, receipt and registry generations remain distinct owners.
405 src/gateway/server-secrets-reload.ts READ: Snapshot CAS, auth generation ownership and exact-account recovery are separate ordered contracts.
404 src/gateway/node-registry.invoke-stream.ts READ: Ordered progress, hard/idle deadlines, not-ready execution proof, and lifecycle settlement remain necessary.
403 src/gateway/server-startup-plugins.ts READ: Plugin metadata completion may legitimately return undefined; startup maintenance, candidate disposal, and diagnostic surfaces preserve separate ownership and lazy boundaries.
397 src/gateway/session-transcript-archive-reader.ts READ: Cleanup withdrawn after the schema lane PR #164286 claimed this file; original archive reader and local types preserved.
394 src/gateway/server-plugin-in-process-dispatch.ts READ: Retained distinct authorization/error handling for reads, session mutations, and agent facade dispatch; common import wrappers would not simplify control flow.
393 src/gateway/session-membership-projection.ts READ: Dirty-key publications and exact physical-store generations avoid main-thread SQLite reads and stale memberships.
392 src/gateway/exec-approval-ios-push.ts READ: Applied: remove unused paired-target scope bypass and token wrapper; resolve explicit cleanup targets at caller; reuse terminal handler.
391 src/gateway/github-user-identity.ts READ: Cloudflare issuer qualification, immutable GitHub identity and public metadata cache retain required boundaries.
389 src/gateway/operator-approval-store.kernel.ts READ: Insertion conflicts, optional identity companion admission, and bounded keyset queries preserve persisted contracts.
385 src/gateway/server-control-ui-root.ts READ: Root-generation byte caching and cancellation preserve stale-asset and custom-root contracts.
384 src/gateway/server-node-subscriptions.ts READ: Pairing generation, delayed serialization, delta receipts and dual indexes protect live delivery ownership.
383 src/gateway/cron-stream-watchers.ts READ: Reserved cron closure: maintains one stream owner per job, reconciles against mutation/reconcile epochs, bounds retired counter seeds, and settles all owners before reporting teardown failures.
383 src/gateway/mcp-http.loopback-runtime.ts READ: Protected heartbeat closure; capture generations and completion drains retained.
381 src/gateway/server-instance-runtime.ts READ: Closed principals and recovery delivery custody are protected restart-related boundaries.
375 src/gateway/server-chat-progress-snapshot.ts READ: Bounded native JSON capture, replay grouping and status transitions protect payload and continuity contracts.
368 src/gateway/github-publication-git-index.ts READ: Hardlink recovery identity and ref/index durability preserve accepted writes; canonical filesystem helpers differ in error semantics.
368 src/gateway/github-repository-publication-recovery.ts READ: Receipt reconciliation after authority loss is not retry authority; retained distinct recovery path.
367 src/gateway/control-ui-session-prs-checks.ts READ: pagination, exact check/job association, rerun detection and partial degradation protect GitHub response completeness.
366 src/gateway/session-identity-projection.ts READ: Row-identity caches and uncached fallback projection both have live callers; ownership and participation projections differ.
363 src/gateway/message-action-turn-capability.ts READ: Retained current opaque turn capability and source authority checks; scheduled grants are protected neighboring closure.
362 src/gateway/github-publication-availability.ts READ: Prepared repository and managed worktree owners have distinct live checks; no redundant owner found.
362 src/gateway/session-utils-store-sources.ts READ: Sync native and async worker discovery preserve distinct custody and registry renewal contracts.
358 src/gateway/session-row-membership-read.ts READ: Sharing readiness remains independent of display readiness; storage-generation admission is required.
357 src/gateway/control-ui-session-pr-read.ts READ: Projection consolidation withdrawn after declaration emission caught the captured Row versus MaterializedRow distinction; original typed paths retained.
352 src/gateway/server-worker-placement-reclaim.ts READ: Captured one exact target resolver in lifecycle context and reused it for preparation and failed reclaim; preserved all live identity, revision, cancellation, and drain checks.
350 src/gateway/board-host-tools.ts READ: retained board capability/live-ticket checks and per-method dispatch; cron-connected paths excluded from edits.
348 src/gateway/control-ui-public-session.ts READ: anonymous rate/parallel caps, source-scoped deduplication and final publication revocation all remain required.
347 src/gateway/session-lifecycle-preparation.ts READ: Creation admission, delayed target selection, synchronous commit guards and cleanup preserve source custody.
346 src/gateway/ws-log.ts READ: Retained distinct Error versus object rendering semantics, bounded preview, incognito omission, and inflight timing; recent logging owner change.
344 src/gateway/node-catalog.ts READ: Skipped open-PR overlap; read complete catalog, with a possible single-use row-builder inline deferred to its owner.
338 src/gateway/http-utils.ts READ: removed unused message-channel options; both production callers now directly use normalized header with webchat fallback.
338 src/gateway/session-transcript-catalog.ts READ: Canonical cursors retain source and branch anchors; user-visible projection/redaction and portable provenance require separate stages.
336 src/gateway/embeddings-http.ts READ: Simplified provider option assembly; retained explicit chat.send scope and shared-secret resolver, with real trusted-proxy denial/provider-effect regression proof.
336 src/gateway/github-publication-requester.ts READ: Source admission and restored requester scopes must revalidate independently; retained.
336 src/gateway/server-cron-lazy.ts READ: Reserved cron/heartbeat closure: defers scheduler import, preserves captured spawn/read-worker contexts, fences concurrent start/stop generations, and forwards pause/resume, drain, and watcher-handoff responsibilities.
335 src/gateway/session-transcript-index.fs.ts READ: Archive navigation retains bounded metadata only and materializes selected payloads under pre/post file identity checks.
334 src/gateway/server-startup-config-helpers.ts READ: Simplified inactive auth-surface warning selection without changing empty-warning fallback; kept secret preflight reuse and recovery hints.
331 src/gateway/conversation-route-ownership.ts READ: Plugin, configured ACP and runtime route ownership have distinct precedence and unavailable outcomes.
329 src/gateway/mcp-http.request.ts READ: Another open deslop PR and heartbeat closure own this file; skipped edits.
328 src/gateway/operator-access-policy.ts READ: Retained plugin policy and profile lifetimes, weak retention/finalization, monotonic denial, and persisted grant resume validation.
325 src/gateway/github-personal-publication-store.ts READ: Account-owned digest, execution CAS and confirmation projection preserve persisted receipt contracts.
324 src/gateway/session-history-snapshot.ts READ: Incognito actor routes and durable history share pagination while keeping original authority and database scope.
323 src/gateway/node-runner-inventory-runtime.ts READ: Eligibility, copied escaping proof, inventory issues, and readiness notification each have separate caller contracts.
322 src/gateway/client-bootstrap.ts READ: Configured/explicit targets, local/remote auth and TLS/SSH precedence are independently used contracts.
319 src/gateway/control-ui-plugin-tabs.ts READ: visible projection, route shadow ownership and per-plugin grants expose different shapes with current scope enforcement.
319 src/gateway/node-claude-skill-runtime.ts READ: Session/placement fences and callback settlement are necessary across resource delivery and workshop calls.
319 src/gateway/session-row-projection-ancestors.ts READ: Bounded ancestry and reentrant exact preparation preserve membership and archive pins across yields.
317 src/gateway/operator-role-policy.ts READ: Retained assignment cache invalidation, current identity/source role resolution, and separately required session creation authorization.
316 src/gateway/server-kernel.ts READ: Lazy shutdown capture and resource-retirement recovery prevent in-place update teardown failures.
316 src/gateway/session-row-presentation.ts READ: Recipient-local authorization and publication view reuse remain separated; signature fields are live.
315 src/gateway/restart-trace.ts READ: Inlined one-use metric-entry forwarding and process-resource collector into the existing diagnostic owner.
314 src/gateway/managed-image-record-store.kernel.ts READ: Combined duplicate exact-plan checks and cleanup transitions in one worker-side owner; commands and transactions unchanged.
314 src/gateway/operator-approval-placement-grants.ts READ: Grant owner/placement revalidation retained; simplifying synchronous storage would require broader worker migration.
313 src/gateway/control-ui-session-prs-git.runtime.ts READ: filesystem ref shortcuts have necessary symbolic/ambiguous fallback semantics; bounded untracked stats preserve behavior.
313 src/gateway/method-scopes.ts READ: Retained explicit method policy and dynamic parameter-dependent scope decisions; fallback differs between discovery and authorization.
307 src/gateway/session-transcript-title-reader.ts READ: Bounded title probes, generation/reset-aware cache and detached string storage prevent full transcript rescans and retention.
305 src/gateway/server-shared-auth-generation.ts READ: Monotonic ownership revisions and private reader bindings implement authority; no safe reduction.
304 src/gateway/server-broadcast-narration.ts READ: Pacing retains newest text while subscription/run/socket fences prevent late delivery.
303 src/gateway/credentials.ts READ: local/remote SecretRef, environment and password/token precedence differ intentionally and have named operator contracts.
303 src/gateway/http-common.ts READ: response rejection, teardown and representation clearing differ across committed/unsent HTTP states.
301 src/gateway/event-web-push.ts READ: Retained authorization-before-send and grouping; cron/scheduled notifications are protected neighboring closure.
299 src/gateway/session-store-key.ts READ: Logical owner, fixed physical store and shipped main aliases require distinct canonicalization modes.
298 src/gateway/web-push-authority.ts READ: Retained paired-device/profile/preference/session preparation and synchronous sender start under current authority.
297 src/gateway/control-ui-plugin-auth-cookie.ts READ: process-scoped signed cookies, canonical paths and sandbox probe behavior preserve browser/security contracts.
297 src/gateway/session-history-state.ts READ: SSE append eligibility preserves projected prefixes and raw watermark state; ordinary and worker profile projection differ.
297 src/gateway/session-repository-materialization.ts READ: Pinned source, settled publication, worktree restoration and final session binding each need current authority and rollback.
295 src/gateway/channel-health-monitor.ts READ: Continuation restart budget and shutdown handoff are separate lifecycle states; no removable branches.
295 src/gateway/operator-approval-session-events.ts READ: Replay coalescing only while unsettled and lifecycle revision fencing preserve exact audience visibility.
294 src/gateway/server-in-process-dispatch.ts READ: Accepted/final response custody and noncancelling deadlines differ; exception cause/payload preservation required.
293 src/gateway/chat-display-projection.canvas.ts READ: Canvas preview shape, route bounds and duplicate retention are distinct wire contracts; no safe owner consolidation.
293 src/gateway/server-discovery-runtime.ts READ: Reserved concurrent lifecycle closure: serializes mDNS/wide-area advertisement generations under plugin claims, retains exact pending/acquired registrations across publication, and cleans late handles after bounded startup waits without releasing ownership early.
291 src/gateway/mention-inbox-projection.ts READ: Selective copy-on-write cohorts retain global item/replay budgets and committed object identity.
291 src/gateway/presence-summary.ts READ: Consolidated identical optional connection field projections into one fixed typed field loop; ordering and omitted fields preserved.
290 src/gateway/github-publication-pull-requests.ts READ: Finding a new PR and reconciling a dispatched historical effect need different evidence; retained.
290 src/gateway/session-reset-acp.ts READ: Retained: bounded cancellation and close outcomes plus runtime-ownership repair, deferred metadata commit, and child-parent physical ownership checks each have separate contracts.
289 src/gateway/device-revocation.ts READ: Accepted source authority, source identity cohorts, and retained request holds are separate revocation contracts.
289 src/gateway/session-transcript-readers.ts READ: Existing generic reader owns worker routing; special reads retain distinct cancellation, capture and archive policies.
287 src/gateway/conversation-list.ts READ: Configured/live discovery preserves ordering, metadata replacement and plugin callback binding before authority-checked registration.
286 src/gateway/chat-queued-turns.ts READ: Queue idempotency and cancellation transfer retain exact entry identity and source withdrawal ordering.
285 src/gateway/ingress-attribution.ts READ: Retained separate listener-owned Tailscale proof and generic proxy policy; caches bind authority once to the IncomingMessage.
283 src/gateway/operator-approval-store.ts READ: FIFO worker preparation and native SDK v2026.9.4 guard compatibility retained; cron closure also excluded.
282 src/gateway/control-ui-session-prs-landing.ts READ: direct/squash/indirect landings, partial clone refs and Git ambiguity fallback cannot be collapsed equivalently.
282 src/gateway/node-pending-work.ts READ: Per-generation queues, retired-generation TTL pruning, default status pagination, and revision semantics are necessary.
281 src/gateway/session-create-model-selection.ts READ: Preserved the creation guard factory and model selection because a newly opened cross-cutting PR owns this file.
276 src/gateway/server-startup-trace.ts READ: Console, timeline, restart traces, and canary progress have separate schemas and timing contracts; no redundant owner or dead export.
274 src/gateway/channel-operator-authority.ts READ: Current identity, assigned policy and original-grant custody enforce distinct authorization boundaries.
273 src/gateway/chat-display-projection.helpers.ts READ: Core text/media/provenance predicates have shared callers; cron-related projection is reserved.
273 src/gateway/server-model-catalog.ts READ: Prepared/static/full reads have different lazy/discovery contracts; owner reacquisition and auth publication are required.
273 src/gateway/session-transcript-record-parser.ts READ: Oversized image recovery is bounded, preserves sibling payloads and verifies exact marker ownership; no safe generic parser substitution.
267 src/gateway/github-public-api.ts READ: Lazy plugin facade declares a host-facing contract and owns credential routing; cannot import plugin private types.
266 src/gateway/server-startup-log.ts READ: Retained shipped log bytes and model/catalog reasoning precedence; private formatting helpers each express a distinct presentation rule.
265 src/gateway/session-group-catalog.ts READ: Read/write serialization and admission fences protect committed catalog snapshots and recovery.
264 src/gateway/open-responses.schema.ts READ: Retained public wire schemas, strict fields, supported aliases, and assistant-phase validation; reductions would alter public protocol.
263 src/gateway/board-view-ticket.ts READ: ticket integrity and current runtime/registry authority are independent required checks.
263 src/gateway/chat-abort-lifecycle-internal.ts READ: Raw execution, terminal dispatch, persistence and removal are separately settled lifecycle barriers.
263 src/gateway/http-auth-user-profile.ts READ: asynchronous identity acquisition and synchronous disclosure have distinct catalog/authority needs.
258 src/gateway/control-ui-link-preview.ts READ: anonymous destination validation, bounded fetch/image work and live opt-out checks preserve external disclosure policy.
258 src/gateway/control-ui-session-pr-check-details.ts READ: bounded exact-head details retain quota/stale behavior and before/after authorization; no equivalent deletion found.
258 src/gateway/project-github-search.ts READ: Retained exact/affiliated/global ranking and degradation differences, credential-scoped cache, grouped authority, and cancellation.
256 src/gateway/session-groups.ts READ: Applied: inline single-use category-update forwarder into existing rename/delete owner, preserving worker sequence.
255 src/gateway/session-row-projection-generation.ts READ: Observations protect physical file birthtime plus logical session generations; fences are not redundant.
254 src/gateway/local-request-context.ts READ: Retained minimal embedded-context contract and lazy lifecycle owner; cron methods are protected neighboring closure.
254 src/gateway/session-utils-core.ts READ: Child-owner liveness/cache and usage/title derivation are reused across projection and search.
253 src/gateway/server-reload-contracts.ts READ: SKIP: heartbeat Automations PR owns this file.
252 src/gateway/mcp-http.handlers.ts READ: Protected heartbeat closure; scheduler alias and execution receipt behavior retained.
251 src/gateway/auth-surface-resolution.ts READ: passive probe and interactive credential failure/fallback semantics intentionally differ.
251 src/gateway/node-pairing-ssh-verify.ts READ: Probe scope, host/key identity, cooldown and concurrency caps are security contracts; no unused public knobs.
249 src/gateway/control-ui-static.ts READ: inlined one-use compression adapter; encoding, compression single-flight, cache recency and response headers preserved.
249 src/gateway/session-sharing-read.ts READ: Applied: one sharing-snapshot projection for prepared and cached event authorization.
247 src/gateway/update-run-watcher.ts READ: Retained detached updater freshness exception, scan/reconcile coordination, schema-publication timing, and terminal-notice deduplication.
246 src/gateway/server-connection-state.ts READ: Per-connection projections share prepared facts with explicit membership and run invalidation.
246 src/gateway/session-utils-projection.ts READ: Lifecycle-scoped metadata maps and transcript fallback use existing owners and current callers.
245 src/gateway/control-ui-public-session-token.ts READ: durable identity codec, exact locator schema and read-only anonymous resolution are named contracts.
245 src/gateway/live-chat-projector.ts READ: Incremental projection avoids full-prefix work while keeping control/media tail parsing and replacement contracts.
244 src/gateway/github-publication-shared-read.kernel.ts READ: Worktree and repository historical selection have different lifecycle qualification; retained.
244 src/gateway/session-event-payload.ts READ: Explicit absent/null/default field projection preserves client reconciliation; lifecycle metadata omissions are intentional.
243 src/gateway/session-sharing-target-input.ts READ: Method-specific target parsing distinguishes absent, invalid, alias and generated-session inputs.
241 src/gateway/http-byte-range.ts READ: RFC validator/range ordering, bigint overflow handling and descriptor ownership remain necessary.
241 src/gateway/session-row-prepared-read.ts READ: Applied: inline single-use private-row consumer into canonical deferral callback, retaining synchronous lifetime and cleanup.
240 src/gateway/server-broadcast-live-text.ts READ: Receipts, pending queue and run retirement each own separate delivery facts; no duplicate policy.
238 src/gateway/provider-browser-auth.ts READ: Retained callback single-use state, exact current browser origin, expiry and restart cancellation; no redundant validation across trust boundaries.
237 src/gateway/device-scope-upgrade.ts READ: Skipped open-PR overlap; read complete coordinator and retained durable reconciliation/lifetime boundaries.
237 src/gateway/workspace-icon-http.ts READ: Retained bounded icon scan/cache and exact session-root checks after filesystem awaits; aliases keep tested public resource caps.
235 src/gateway/cli-session-history.claude-snapshot.ts READ: Oversized records parse off-thread, cache retains immutable redacted snapshots and concurrent imports share pending work.
235 src/gateway/server-chat-metadata-lifecycle.ts READ: Retained prepared-model availability and event-version fencing plus subordinate refresh coalescing; startup catch-up and ordinary publications have distinct failure contracts.
235 src/gateway/session-history-worker-reader.ts READ: Typed union dispatch preserves lazy loading and per-kind response shapes; generic mapping would conceal contract differences.
232 src/gateway/credentials-secret-inputs.ts READ: active SecretRef scan and demand-resolution backstop preserve credential precedence without resolving inactive secrets.
232 src/gateway/server-startup-session-migration.ts READ: Session-only orphan repair validates Gateway lock/lease, predecessor identity, retained-run ownership, and receipt atomicity; none are obsolete shape migrations.
232 src/gateway/session-row-projection-read.ts READ: Bounded worker acquisition retains native candidates, continuations and per-row revision acceptance.
231 src/gateway/stale-install.ts READ: Retained explicit published-June updater recovery compatibility because caller cutover is outside root-only lane and installed-driver behavior matters.
229 src/gateway/tool-resolution-completion.ts READ: Protected heartbeat closure; completion lineage bounds and authority checks retained.
227 src/gateway/github-repository-publication-snapshot.ts READ: Remote standalone script is a worker protocol boundary; snapshot digest and normalized Git content checks retained.
227 src/gateway/internal-source-reply-persistence.ts READ: Retained idempotent transcript replay, original owner fence, media commit custody, and task-owned cleanup.
227 src/gateway/startup-auth.ts READ: retained legacy persist/baseHash options because ensureGatewayStartupAuth is public SDK gateway-runtime and browser caller still passes persist.
226 src/gateway/connection-details.ts READ: Retained explicit SSH/TLS credential scope and CLI/env/service target precedence; optional resolvers have callers and diagnostics must preserve redaction.
224 src/gateway/local-http-probe.ts READ: Retained certificate observation generations, endpoint-bound last served pins, proxy-owned loopback bypass, and stream boundedness.
224 src/gateway/session-group-catalog.kernel.ts READ: Transaction/group-authority and additive defaults schema contracts retained; no schema change authorized.
224 src/gateway/session-transcript-derived-readers.ts READ: Artifact versus SQLite usage intentionally differ for zero totals, cost and estimated context; single accumulator already owns aggregation.
221 src/gateway/session-companion-rpc.ts READ: Ask, read and reset have distinct connection and source-authority requirements and stable error mappings.
220 src/gateway/server-plugin-runtime-client.ts READ: Retained explicit internal metadata allowlist and transport-owned profile accessors; forwarding all input would weaken the authority boundary.
219 src/gateway/node-invoke-plugin-approval.ts READ: Reviewer projection, runtime provenance, allow-once redemption, and standing grant binding have distinct purposes.
218 src/gateway/session-incognito-lifetime.ts READ: Deadline scheduling and original in-memory database identity are distinct from deletion owner; no cross-owner collapse.
217 src/gateway/mcp-http.schema.ts READ: Getter failures, malformed schemas and recursive comparison currently have explicit supported behavior; no equivalent shared helper.
217 src/gateway/session-create-service.types.ts READ: Retained: typed public-adapter and trusted creation options have production callers; lifecycle preparation, publication callbacks, and atomic initialization have distinct contracts.
216 src/gateway/approval-session-audience.ts READ: Applied: remove private one-implementation Sources interface/factory; traversal directly uses runtime lineage and storage owners.
216 src/gateway/probe-auth.ts READ: strict target credentials, SecretRef diagnostics and synchronous/async entry points serve distinct CLI contracts.
216 src/gateway/server-runtime-config.ts READ: CLI override/bind/auth validation is public behavior; canonical output fields preserve contracts.
215 src/gateway/session-utils-display.ts READ: Display fallbacks and subagent run reconciliation encode current visible behavior and shipped edge cases.
214 src/gateway/server-plugin-reload-channels.ts READ: Retained metadata-vs-runtime target collection, partial rollback, and channel handoff outcomes; superficially duplicate flows differ intentionally.
213 src/gateway/node-connection-notifications.ts READ: Primary/fallback scheduling and replacement-bound source authority retained; no safe structural reduction.
212 src/gateway/node-plugin-tool-snapshot.ts READ: Registered versus node-supplied descriptors retain different trust and precedence; bounded sorting/dedupe retained.
212 src/gateway/session-event-prepared-row.ts READ: Budgeted event publication reacquires prepared views after yields and joins all pending publication work.
210 src/gateway/session-companion-context.ts READ: Excluded by another open PR; bounded contiguous context and final snapshot fence must remain.
209 src/gateway/call-device-auth.ts READ: Retained read-only device-store routing, auth-none exemption, and client-identity selection; these are separate observable trust contracts.
209 src/gateway/server-plugins-node-runtime.ts READ: Retained lifecycle-fenced duplex framing and policy projection; plugin wrapper and admitted-owner entry points have separate consumers.
208 src/gateway/session-row-projection-archive.ts READ: Bounded LRU materialization, overlapping page pins and cold lineage updates have distinct lifetimes.
206 src/gateway/session-catalog-identity.ts READ: Portable remote attribution, batched source profile facts and local GitHub linking serve different projections.
206 src/gateway/skill-library-authoring.ts READ: Retained mixed-person revocation and exact admitted-run ownership; storage calls require separate worker migration beyond behavior-neutral cleanup.
205 src/gateway/session-row-projection-context.ts READ: Per-domain revisions preserve cheap runtime/profile refresh without discarding model caches.
205 src/gateway/update-run-notice-target.ts READ: READ only; overlap guard marks this file protected, so no edits despite fully inspecting route and command-owner validation.
203 src/gateway/github-actions-read.ts READ: Bounded board capability reads, credential-scoped caching and response projection retained.
203 src/gateway/node-reapproval-coordinator.ts READ: Latest queued request, duplicate followers, and serialized cleanup preserve coalescing and pairing order.
202 src/gateway/mcp-app-transcript.ts READ: Two-pass transcript reconstruction avoids retaining unrelated messages and preserves latest matching result precedence.

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 4062cde6201020b26dbce49376cca3682d2e0cb2
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/auth-config-utils.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/credential-planner.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/exec-approval-ios-push.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/github-oauth-lifecycle-helpers.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/github-oauth-lifecycle.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-utils.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/resolve-configured-secret-input-string.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/server-methods.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-startup-secret-diagnostics.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 11:18 PM ET / October 4, 2026, 03:18 UTC (Revision 4).

ClawSweeper review

What this changes

The PR removes unused Gateway forwarding helpers and options, consolidates repeated projections and cleanup logic, and strengthens HTTP authorization and test-fixture lifetime coverage.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains useful maintainer-owned cleanup. The prior embeddings admission defect and merge-conflict concern are resolved; no new actionable defect was found in the introduced patch. Exact-head CI still has failures whose causes are not established by this review.

Priority: P3
Reviewed head: 4062cde6201020b26dbce49376cca3682d2e0cb2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent refactor with meaningful regression coverage and no supported blocking patch finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies, and the reviewed patch does not materially expand authority. Reported Gateway HTTP authorization and fixture-lifetime validation is supplemental; the stored-data formats and migration contracts remain unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies, and the reviewed patch does not materially expand authority. Reported Gateway HTTP authorization and fixture-lifetime validation is supplemental; the stored-data formats and migration contracts remain unchanged.
Evidence reviewed 10 items Pinned patch ownership: Reviewed the introduced hunks from cc740df to 4062cde. The verified GitHub test merge has the pinned base and head as its two recorded parents; its delta contains the Gateway changes and preserves the base-only updater work.
Prior admission finding resolved: The embeddings endpoint explicitly requires chat.send and uses the shared-secret scope resolver before provider work. The extended trusted-proxy case checks reader denial with zero provider and embedding calls, writer success, and writer-only model-override denial. The contributor records the intended failing negative control and passing correction in #164603 (comment).
Authorization regression boundary: The changed test exercises the real Gateway HTTP admission path using trusted-proxy reader and writer identities, with mocked embedding effects. It extends the existing authorization case rather than introducing an additional Gateway boot.
Findings None None.
Security None None.

How this fits together

The Gateway accepts HTTP and WebSocket requests, applies authentication and session policy, and dispatches work to agents, providers, channels, and workers. This refactor simplifies those internal paths while preserving their response and lifecycle contracts.

flowchart TD
  A[HTTP and WebSocket clients] --> B[Gateway authentication]
  B --> C[Request and session policy]
  C --> D[Agent and provider dispatch]
  C --> E[Session and worker owners]
  D --> F[Responses and events]
  E --> F
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -565, Tests +38. Total -527 across 49 files.

View PR surface stats
Area Files Added Removed Net
Source 46 841 1406 -565
Tests 3 117 79 +38
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 49 958 1485 -527

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/gateway/embeddings-http.ts, vector/embedding metadata: src/gateway/embeddings-http.ts, vector/embedding metadata: src/gateway/embeddings-provider-lifetime.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the consolidation within the existing Gateway owners, preserving authorization, synchronous session presentation, and cleanup settlement contracts.

Do we have a high-confidence way to reproduce the issue?

Not applicable to the cleanup request. The prior embeddings defect has a focused HTTP regression and reported negative control; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Removing single-use forwarding and reusing existing owners is a maintainable approach, and the reviewed hunks preserve the relevant admission and lifecycle checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 35f60579010c.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible behavior change or demonstrated urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-author exemption applies, and the reviewed patch does not materially expand authority. Reported Gateway HTTP authorization and fixture-lifetime validation is supplemental; the stored-data formats and migration contracts remain unchanged.

Evidence

What I checked:

  • Pinned patch ownership: Reviewed the introduced hunks from cc740df to 4062cde. The verified GitHub test merge has the pinned base and head as its two recorded parents; its delta contains the Gateway changes and preserves the base-only updater work. (b9a4b15385f1)
  • Prior admission finding resolved: The embeddings endpoint explicitly requires chat.send and uses the shared-secret scope resolver before provider work. The extended trusted-proxy case checks reader denial with zero provider and embedding calls, writer success, and writer-only model-override denial. The contributor records the intended failing negative control and passing correction in refactor(gateway): deslop gateway #164603 (comment). (src/gateway/embeddings-http.ts:175, 4062cde62010)
  • Authorization regression boundary: The changed test exercises the real Gateway HTTP admission path using trusted-proxy reader and writer identities, with mocked embedding effects. It extends the existing authorization case rather than introducing an additional Gateway boot. (src/gateway/embeddings-http.test.ts:601, 4062cde62010)
  • Watch pairing boundary retained: Schema validation and canonical Watch identity checks run before authentication and pairing. The consolidated predicate still rejects capabilities, empty or unsupported commands, and unsupported permissions; removing the later repeated predicate does not expand the admitted surface. (src/gateway/watch-node-http.ts:224, 4062cde62010)
  • Stored-data contract unchanged: Managed-image cleanup retains the exact planned-record comparison, claim/delete state distinction, synchronous worker transaction, commit admission, and receipt publication. The patch does not alter schema, serialized records, retention, or migration behavior. (src/gateway/managed-image-record-store.kernel.ts:207, 4062cde62010)
  • Internal caller cutover: The request-context helper has two production callers, OpenAI HTTP and OpenResponses HTTP, and both previously supplied the removed fixed options. The remaining references are tests; no public plugin export or competing implementation was found. (src/gateway/http-utils.ts:284, 4062cde62010)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-03T23:10:05.676Z sha ea093ac :: blocked before merge. :: none
  • reviewed 2026-10-03T23:41:50.067Z sha 753faa8 :: needs real behavior proof before merge. :: [P1] Restore the embeddings endpoint’s method-scope admission
  • reviewed 2026-10-04T03:01:27.922Z sha 1b29b251e5bb855bcdc138f804bad4f918493d60 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@steipete
steipete force-pushed the deslop/l349-gateway-root2-20261003 branch from 1b29b25 to 4062cde Compare October 4, 2026 03:10
@steipete
steipete enabled auto-merge (squash) October 4, 2026 03:12
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

The P1 embeddings admission finding is fixed in 4062cde6201020b26dbce49376cca3682d2e0cb2. The endpoint again declares requiredOperatorMethod: "chat.send" and uses the shared-secret scope resolver. The existing real trusted-proxy authorization case now rejects a reader with HTTP 403 before any provider/embedding work, permits a writer, and still rejects a writer-only model override. Negative control on the unfixed implementation returned HTTP 200 and executed both effects; the corrected full 43-test suite passes.

The identical isolated sessions.create command passed on clean main and the unchanged published candidate on the same lease. That does not prove the old timeout's cause; the creation-forwarding simplifications were withdrawn. Full worktree-creation coverage passes. Final correction proof: 221 tests across nine affected files, production and Gateway test types, strict lint on all 50 surviving touched/restored files, independent P0/P1 review, and both cycle checks at zero. The earlier complete run also passed all 27 dependent type graphs and all dead-export scans. The PR body retains the exact limitations and the full below-threshold coverage log.

The conflict-only rebase retains current main’s complete archive and session-resolution paths. Its exact head passed 306 tests across 13 files, production and Gateway-root/server types, strict touched-file lint, and both cycle checks. The earlier conflicted head never received a CI run. Hosted CI and security review must validate this exact head before landing; no security or authority exception is requested.

@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Evidence for the inherited-failure exception

Reviewed/tested PR head: 4062cde6201020b26dbce49376cca3682d2e0cb2. Exact-head CI: 37173313459. Five root failures remain; the aggregate gate reflects them. No failed check is being called green.

PR job / failure Independent main evidence
checks-fast-baseline-ratchets: check-test-mock-exports.mts exits with spawnSync git ENOBUFS The same command/error on scheduled main 301a040200d10e65813c434a57364c5eb79e7b97: job 111351985083. This PR does not change the ratchet or its Git/source-loading helpers.
checks-node-changed-compact-large-14-2: aggregate global preview lacks lastMessagePreview Same test, field, and payload on main job 111351986703, also reproduced in a clean main Linux checkout. The preview handler and enrichment producer are unchanged; resident preview enrichment is optional.
checks-node-compact-small-3: type-suppression inventory has 18 entries rather than 16 Same two src/plugin-sdk/plugin-config-runtime.test.ts negative type assertions on main job 111351986757, also reproduced locally on clean main. This PR does not alter these assertions or inventory tooling.
checks-node-changed-compact-small-4-1: presence expects [email protected] first but receives [email protected] Clean main 301a040… reproduced the identical email-order mismatch on repetition 3 of 20; the other 19 repetitions passed. Unchanged producers timestamp each connection and sort descending by timestamp; the unchanged assertion incorrectly pairs that result with insertion order. Both identities are present. No stability fix is claimed.
checks-node-changed-compact-small-5-2: catalog refresh observes one readAcpSessionMetaForEntries call rather than zero Twenty focused clean-main repetitions passed. Replaying the CI job's recorded 33-file selection, four-worker group, and Node 24.19.0 on clean main 301a040… reproduced the same one-call assertion. The baseline lease reached its hard TTL during later shard cases; the matching failure was captured, but a completed full-shard result is not claimed. The test, row-fact/ACP producer, and catalog invalidation source are unchanged by this PR; the reviewed inlining adds no read or await.

Baseline focused command: node scripts/run-vitest.mjs src/gateway/server-request-context.presence.test.ts src/gateway/server-methods/sessions-list-config.test.ts (20 separate diagnostic executions, no changed tests or retry behavior). The recorded-shard comparison used node --import tsx scripts/ci-run-node-test-shard.mts with the original job's decoded test-group configuration.

The exact candidate passed 306 focused tests, production and Gateway test typechecks, strict lint, both zero-cycle gates, and independent P0/P1 review. Its security-fast, OpenGrep, all Security High checks, and security-sensitive review passed. The earlier embeddings authority bug is fixed and has a failing-before/passing-after regression; no security, authority, or permission failure is admitted by this exception.

Under the explicit coordinator order, these inherited non-security failures are reported for the main CI owner rather than repaired in this lane. The squash submission is pinned to the live API head SHA above.

The review bot’s data-model prompt is a path-classification false positive: embeddings-http.ts only inlines provider-option construction and removes internal aliases; embeddings-provider-lifetime.ts inlines retention in the same in-memory retirement map. Neither changes stored vector metadata, schemas, formats, or migrations. The managed-image refactor retains the same SQL transitions, exact-record checks, transaction owner, and cleanup ordering. No data migration is introduced or required.

@steipete
steipete merged commit 917be1c into main Oct 4, 2026
181 of 188 checks passed
@steipete
steipete deleted the deslop/l349-gateway-root2-20261003 branch October 4, 2026 04:03
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
* refactor(gateway): deslop gateway

Remove single-use adapters and unused internal options, reuse canonical projections and types, and consolidate duplicate state and event assembly. Preserve configuration, wire shapes, storage contracts, and lifecycle authority. Keep the upstream retirement of full-array CLI history merging.

* refactor(gateway): retain concurrently maintained helpers

* refactor(gateway): retain security scanner admission contracts

* refactor(gateway): preserve captured row type boundary

* refactor(gateway): retain original session creation forwarding

* fix(gateway): restore embeddings admission and fixture ownership

* test(gateway): assert embedding wire options directly

* refactor(gateway): retain cleanup and error contracts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant