Skip to content

refactor(agents): deslop tool and auth orchestration - #164019

Merged
steipete merged 2 commits into
mainfrom
deslop/l330-simplify-agents-tools-auth-20261002
Oct 3, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/l330-simplify-agents-tools-auth-20261002

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Agent tool, command-compaction, and auth-profile flows retain forwarding layers, duplicate projections, and test-only production indirection after their underlying owners have already been consolidated.

User Impact

No user-visible change. Tool descriptions, parameter schemas, auth selection, persisted credentials, wire responses, and authority/lifecycle checks retain their existing contracts. No migration or operator action is required.

Why This Change Was Made

This maintainer-requested batch removes 644 net production lines. Full coverage was exhausted below the 1,000-line campaign target; the complete size-sorted coverage log is attached below. The remaining large modules implement active authority, persistence, cancellation, transport, and compatibility contracts.

  • Message schema assembly now uses one concrete group list for full and scoped schemas, removing the single-implementation builder injection and forwarding module.
  • CLI compaction prepares its context engine once and derives fallback decisions from the native outcome. Module spies replace its mutable production-only test dependency registry; existing assertions remain.
  • Session resolution removes a nested result envelope and one-caller forwarding context. Status tools use their visibility and model-selection owners directly, preserving authority checks around awaited reads.
  • Session history sanitization no longer wraps a single caller in a second result projection. Session send shares the accepted-response branch, and deferred archive state drops a never-populated revision field.
  • Computer target changes directly invalidate their frame. Raw and structured node commands share final dispatch while retaining their different lookup ordering, policy, timeout, and output contracts; unused node options are removed.
  • Media generation uses the canonical model parser and enum validator. Video setup and PDF capability selection drop single-use forwarding and duplicate branches; lazy media runtime types come from their owner.
  • Credential normalization shares its type/common-field construction; persisted SecretRef filtering removes redundant array/result casts. Auth SQLite store/state reads share cell routing, OAuth adoption reuses its identity owner, and SecretRef diagnostics no longer create an intermediate DTO.
  • Workshop patch preparation constructs the presentation and its budget from the same components without a single-use wrapper. Cron shorthand recovery merges indistinguishable private outcomes.

Fixes Found Along the Way

The session-model integration fixture started its 10-second RPC deadline before lazily loading the real mutation handler. A diagnostic reproduced a timeout and measured 17.2 seconds in handler preparation. Preload that concrete handler during collection; the actual Gateway path, deadline, and assertions remain unchanged.

The video-generation no-provider fixture cleared two manually maintained lists that omitted a supported provider key. An inherited key made the unchanged availability owner register the tool. Resolve the canonical provider auth variable names once and clear that same list in both fixture hooks, preserving ADC/rotation cleanup and every assertion.

Two added compaction cases caught a routing change in the intermediate refactor when harness metadata changed during engine preparation. Capture the initial native/context choice once, matching the original behavior; both cases failed before that correction.

Evidence

  • Focused proof: all 51 selected files / 1,214 unique tests have passing results across the final and reused unchanged runs. This covers auth persistence/OAuth/read authority, compaction, tool schemas/dispatch, session access/history/control, and media generation.
  • Compaction: all 39 cases passed; the two new preparation-time routing cases failed the intermediate refactor before the correction. The original standalone pnpm test src/agents/command/cli-compaction.test.ts --maxWorkers=1 run (37 cases) took 2,210.15 seconds wall time on the loaded host; the final expanded suite passed within the 39-file run (2,829.73 seconds), then all 39 cases passed again on the final source in a standalone wrapper run (400.90 seconds).
  • Gateway session-model integration: all 10 cases passed after moving cold handler loading outside the unchanged request deadline.
  • Video generation: all 46 cases passed with ZAI_API_KEY=synthetic-video-test-key; node scripts/run-vitest.mjs src/agents/tools/video-generate-tool.test.ts took 706.11 seconds wall time with one worker/project. The original fixture failed the no-provider assertion with an inherited provider key.
  • Message schemas: default plus 15,360 variants byte-identical to the base, including property order and own __proto__ behavior.
  • Independent Codex review: scoped-clean through P2 on the final source, including fixture repairs.
  • Both cycle checks passed with zero cycles. Final changed-file lint, core production types, and all three agent test-type graphs passed. Line-cap and max-lines ratchets passed without exceptions. Applied the two measured, maintainer-approved assertion-baseline reductions: persisted.ts 9 to 4 and video-generate-tool.ts 2 to 1. Both cycle scans also passed on the rebased tree (zero cycles), and the rebased assertion ratchet passed with 3,054 admitted files and 7,614 grandfathered assertions. No new assertion allowance is requested.
  • Remote limitation: Blacksmith Testbox source setup and the AWS fallback source sync both stalled beyond the allowed wait; both owned leases were stopped/released. Tests ran serially with nice -n 15 on this dedicated worktree under the explicitly authorized local fallback. No Linux repeated-run stability claim is made.
  • Rebased onto main 5e6794cf5913e0c646b924753440cfaf2d80cf17 without conflicts; both commits are patch-identical by git range-diff. Prior focused proof is retained for those unchanged inputs. Hosted exact-head CI run 37095112294 completed in 531 seconds wall time: 68 successful jobs, 22 skipped jobs, and the single inherited failing test job plus the aggregate gate described below. Security checks passed. No CI reruns or additional source pushes were used.

Inherited-main CI qualification

At exact PR head ac11cdb39d619bf369413c298b70f823af554b16, checks-node-changed-compact-small-18 fails only src/gateway/mcp-http.runtime.test.ts:323:53: McpLoopbackToolCache > refreshes cached bound tools when node matching preferences change, with expected [] to deeply equal [ 'exec' ]. The aggregate CI gate follows that failure; all other selected CI jobs passed or were skipped.

Independent pre-existence is established by main's scheduled run 37094503398, head 5e6794cf5913e0c646b924753440cfaf2d80cf17 (this PR's exact base): checks-node-compact-large-21 reports the same full test name, assertion, and line at 03:52:40 UTC, before this PR's CI run. Main commit dd90d99aac4052787d3e7811d88b114ff7e118ba removed the legacy client-ID tie-breaker while this fixture still expects it.

The failed test, MCP runtime, node-exec availability owner, and shared node matching/parsing modules are byte-identical to the main base. There is a shared-module overlap: this PR changes later resolveAgentNodeId/resolveAgentNode exports in nodes-utils.ts, but the imports and actual listNodes/resolveNodeIdFromList functions invoked by this case are byte-identical; the changed exports are not called on the failing path. Tool construction is mocked in this test. This is function-level causal attribution, not a claim that every transitively imported file is unchanged.

The maintainer-authorized inherited-failure route is pinned to the exact reviewed head above. The main fixture repair remains with the main-CI coordinator; this PR does not restore the retired migration behavior, weaken the assertion, or add retries.

Review disposition: unchanged persisted data

ClawSweeper's path-based data-model warning is not a schema change. In auth-profiles/sqlite.ts, the diff only factors the existing store/state inspection and read branches into private helpers with the same target literals, database routing, JSON reader, and unreadable-row result. No write path, table/schema definition, migration, schema version, or serializer is changed; sqlite-json.ts, the auth types/constants, and src/state/** are unchanged. The removed session-status-visibility.ts was an in-process forwarding helper, and config/assertion-safety-baseline.txt is a static-analysis allowance file. Existing passing SQLite-store tests cover reading existing databases, shared-state ownership, external schema changes, and SecretRef plaintext exclusion. No data migration is introduced or needed.

Coverage: every production file over 200 lines, sorted by baseline size

l330 agent tools, command and auth coverage

Baseline: 6ef6fc44055eed417c96bcc2f0010ad4cab4c604. All 314 production TypeScript files in the three assigned subtrees were read, largest first, with scoped instructions, relevant history and main callers. Every production file over 200 baseline lines is listed below, globally sorted by size. Three files owned by concurrent l314 were read and excluded from edits.

Base lines Production file Coverage and disposition
1791 src/agents/auth-profiles/store.ts READ — eliminate duplicate external OAuth persistence decision and unused private agentDir field; retain transaction/publication/rollback ownership.
1268 src/agents/auth-profiles/oauth-manager.ts READ — claim/settlement/peer recovery is required by documented single-use refresh, validator, cancellation, and durable observation contracts.
947 src/agents/auth-profiles/usage.ts READ — WHAM claims/reprobes and profile-generation checks prevent quota observations crossing credential replacement; distinct cooldown/block policies are intentional.
918 src/agents/tools/web-fetch.ts READ — distinct direct-fetch/provider fallback, SSRF, cancellation, content budgets and spill contracts; no sound further simplification found.
887 src/agents/command/attempt-execution.ts READ: retained separate CLI and embedded adapters because admission, auth forwarding, transcript recovery, tool grants, and settlement differ; common run arguments already share one builder with invocation-time session reads.
835 src/agents/auth-profiles/persisted.ts READ — share credential type/common field/expiry construction and replace flatMap plus type assertions with typed credential filtering.
807 src/agents/command/delivery.ts READ: source suppression, fresh route recovery, exact-route dedupe, media normalization, restart custody, and durable send projection have distinct contracts; no sound large consolidation identified.
777 src/agents/tools/session-status-tool.ts READ: Inlined single-caller visibility adapter and active-model selection option bag; preserved pre/post-await authority and session-generation checks.
763 src/agents/auth-profiles/runtime-snapshots.ts READ — per-owner revisions, materialization invalidation, and clone boundaries implement documented snapshot/rollback isolation.
752 src/agents/tools/sessions-send-tool.ts READ: Unified duplicate immediate/pending acceptance response path. Remaining complexity owns distinct notify, steer, resume, followup, exact-incarnation, and completion obligations.
746 src/agents/tools/gateway.ts READ — local/remote transport, signed identity and approval replay branches enforce different authority contracts; removing them would change supported dispatch/recovery behavior.
739 src/agents/tools/message-tool-execution.ts READ — single message owner already joins account authorization, scheduled settlement, source completion and idempotency; each branch has an independent delivery contract.
733 src/agents/command/cli-compaction.ts READ / CHANGED: prepare the shared context engine and auto-compaction guard once; derive fallback/clear-binding decisions from native outcome instead of parallel booleans; remove mutable test-only dependency registry and duplicate settings contract in favor of direct canonical imports; inline three one-use predicates.
729 src/agents/tools/sessions-tool.ts READ: Removed never-populated lifecycle revision field and unreachable comparison from deferred archive identity. Restricted-control selected revision remains enforced by its native target guard.
721 src/agents/tools/cron-tool.ts READ: management/self/creator grants and mixed-version dispatch enforce distinct current contracts; schema/description text is unchanged.
714 src/agents/command/post-run.ts READ: retained ordered transcript persistence, pending-final custody, maintenance, delivery, claim cleanup, and terminal publication; their error and authority boundaries are observable.
709 src/agents/auth-profiles/profiles.ts READ — canonical owner removals, CAS receipts, logout catalog scrubbing, and inherited health handling protect distinct ownership contracts.
704 src/agents/tools/ask-user-tool.ts READ: reservation, registration, delivery, answer claims and cancellation have distinct ownership and asynchronous race contracts; polling bridges separate JS realms.
703 src/agents/tools/computer-tool-node.ts READ — replaced single-use general state setter with direct target transition and frame invalidation; retained frame/provider/button/cleanup fences.
697 src/agents/tools/sessions-list-tool.ts READ: Pagination, sparse visibility filtering, private metadata projection, transcript read ownership and byte caps are independent externally tested contracts; no sound larger cut.
690 src/agents/tools/sessions-spawn-visible.ts READ: Local/cloud creation differ in admission and recovery; inherited model, sandbox, worktree and source-authority checks are real boundaries. No safe consolidation found.
682 src/agents/auth-profiles/session-override.ts READ — forward the typed clear request directly; preserve strict user pins, person-linked pins, and automatic rotation CAS.
674 src/agents/auth-profiles/runtime-read.ts READ — inline synchronous forwarding entry at exported runtime projection; retain sync SDK/async worker split and captured-source cleanup.
668 src/agents/command/session.ts READ: deterministic cross-store session-id selection, retired fixed-store ownership, implicit rollover, and pinned model lifecycle remain active documented contracts; legacy names do not make their current data paths removable.
667 src/agents/tools/gateway-caller-context.ts READ — inheritance precedence and sparse identity fields preserve same-run narrowing and distinct-run ownership; no further safe simplification without changing authority semantics.
667 src/agents/command/model-selection.ts READ: retained locked/user/automatic/operator/channel selection provenance; primary thinking hydration deliberately merges one route while fallback hydration consumes another prepared catalog.
662 src/agents/tools/pdf-tool.ts READ — removed the native-PDF predicate forwarding wrapper and calls the capability owner directly.
661 src/agents/tools/sessions-spawn-tool.ts READ: Model-facing schemas dominate size; runtime-specific inheritance and collector gates are required. No schema/description changes allowed.
660 src/agents/tools/web-fetch-visibility.ts READ — malformed HTML, optional closing tags and foreign-content scope rules are substantive visibility boundaries; retained.
660 src/agents/command/run-embedded-attempt.ts READ: retained real fallback and live-model-switch retry ownership, media side-effect fences, user transcript admission, and per-candidate accounting.
640 src/agents/tools/image-tool.ts READ — replaced locally redeclared web-media runtime function signatures with a Pick of the canonical module type; preserved lazy loading.
632 src/agents/tools/media-tool-shared.ts READ — removed a parser injection whose three callers pass aliases of the identical parser; removed the reference timeout knob no caller sets.
618 src/agents/tools/system-agent-tool.ts READ: typed operation translation and approval/proposal/native-host handoff are real privilege boundaries; simple switch remains clearer than a generalized descriptor system.
611 src/agents/tools/media-generate-background-shared.ts READ — admission fencing, keepalive, transient delivery retries and terminal settlement each protect distinct lifecycle contracts; retained.
584 src/agents/tools/sessions-search-tool.ts READ: Cross-agent batching and ordered alias matching preserve authorization and deterministic result order; hit sanitization and output caps are required.
583 src/agents/command/attempt-execution.helpers.ts READ: Claude orphaned trailing-tool probe has a real CLI prepare caller at src/agents/cli-runner/prepare.ts; file validation, bounded scanning, grace retry, prompt budgets, and ACP streaming state each guard external or model-facing contracts.
581 src/agents/tools/video-generate-tool.ts READ — inlined two single-caller registration helpers, replaced duplicate object validation/type cast with canonical isRecord, removed redundant parser argument.
578 src/agents/auth-profiles/oauth.ts READ — remove enum pass-through lookup and single-constant profile wrapper; preserve provider plugin unavailable and retired native login gates.
568 src/agents/tools/skill-workshop-tool.ts READ: live read hashes, exact-span grants, mutation budgets and proposal transitions protect different operations; no sound larger cut found.
566 src/agents/auth-profiles/store-read.ts READ — generator is shared policy for synchronous SDK and async captured-worker reads; replacing it with duplicate runners would add policy owners.
560 src/agents/tools/sessions-history-tool.ts READ: Inlined one-use text sanitizer result envelope into message sanitizer, retaining redaction, UTF-16 truncation and all outcome flags.
541 src/agents/tools/mobile-ui-tool.ts READ — parse, confirmation, snapshot invalidation and queued dispatch enforce separate wire/lifecycle contracts; general queue helper adds capacity semantics this owner does not need.
536 src/agents/auth-profiles/oauth-refresh-failure.ts READ — cleanup provenance, classified recovery, bounded diagnostics, and secret redaction are separate required contracts.
529 src/agents/tools/message-tool-schema.ts READ — consolidated full/scoped assembly into one concrete schema group list; removed unused injected builder interface/map and duplicated full group enumeration. Schema strings/actions preserved.
505 src/agents/tools/image-generate-tool.ts READ — routes aspect-ratio validation through its existing canonical enum parser and removes redundant parser argument. Schema and error bytes unchanged.
494 src/agents/tools/sessions-resolution.ts READ: Inlined key/session-ID lookup into its sole caller, eliminating duplicated context type and nested Result envelope; retained mixed-version resolver compatibility introduced after July 2026.
487 src/agents/tools/in-process-gateway.ts READ — request/positional frontends share canonical bound dispatcher; remaining differences preserve creation custody and committed-write settlement.
485 src/agents/auth-profiles/sqlite.ts READ — share store/state raw cell inspection and read dispatch; preserve admitted-connection reads versus read-only inspection.
480 src/agents/tools/cron-tool-canonicalize.ts READ: merged indistinguishable private recovery outcomes and removed repetitive commentary; canonical precedence, unsafe-path rejection and conflict forwarding retained.
476 src/agents/tools/common.ts READ: parameter readers preserve distinct coercion/error contracts and many are public SDK exports; result and progress helpers already have canonical owners.
473 src/agents/tools/model-config.helpers.ts READ: concurrent l314 ownership; skipped all edits. Existing credential/model/lazy loader responsibilities retained.
472 src/agents/command/prepare.ts READ: validations precede execution and preserve CLI errors; plugin metadata and skills loading are lazy; worktree lease has explicit release on failed preparation.
472 src/agents/auth-profiles/oauth-refresh-peers.ts READ — excluded from edits: l314 already changed this file.
469 src/agents/tools/cron-tool-creator-cap.ts READ: inherited/default/explicit tool cap distinctions and current-job patch admission are documented authority contracts.
468 src/agents/tools/computer-tool-request.ts READ — existing required-string descriptor map already collapses parallel paths; per-action validation differs in error text, parameter presence and wire representation.
465 src/agents/tools/cron-tool-schema.ts READ: one shared job schema already serves create/update; conditional management, self and trigger projections preserve exact model-facing bytes.
451 src/agents/tools/subagents-tool.ts READ: Wait preparation has accepted-read custody and event ordering; cancellation retains original run registration ownership. No safe lifecycle cuts. Unused callerPolicySessionKey option noted to lead; caller is outside partition.
451 src/agents/command/acp-lifecycle.ts READ: tracker bounds, duplicate terminal replay suppression, cancellation/timeout classification, redaction, and diagnostic projection are required; no policy or state layer without a real responsibility found.
437 src/agents/auth-profiles/upsert-with-lock.ts READ — OAuth admission observations, exact rollback ownership, and lock-specific rejection preserve re-authentication/concurrent refresh contracts.
425 src/agents/tools/nodes-tool-media.ts READ — image batch validation/projection already shared; camera/video/screen transport and output format contracts differ.
424 src/agents/tools/sessions-send-tool.delivery.ts READ: Steering, transcript custody, Cron parent fallback and accepted-run reconciliation have distinct contracts. No duplicate owner to remove.
416 src/agents/tools/transcripts-tool.ts READ: durable capture/summary ownership and source authorization must survive awaits; import/status/summary preserve distinct store and visibility behavior.
416 src/agents/tools/message-tool-discovery.ts READ — now calls concrete schema owner directly; remaining contextual discovery/account and lazy plugin fallback logic is required.
416 src/agents/auth-profiles/runtime-snapshot-owner.ts READ — captured source metadata and owner-specific materialization prevent cross-root secrets or inherited credentials becoming local.
405 src/agents/tools/web-search-provider-common.ts READ — helpers are public SDK contracts used by distinct providers; date formats and secret/error behavior differ intentionally.
405 src/agents/tools/secrets-tool.ts READ: secret-only human entry, masked answer marker, current-policy read and cancellation custody are necessary security contracts.
399 src/agents/auth-profiles/oauth-refresh-fence.ts READ — serialized storage and manager storage are distinct maintained adapters; the former owns generic provider-keyed stores and native-section settlement.
393 src/agents/auth-profiles/order.ts READ — explicit store/config order, AWS config-only routes, pending settlement, and model-scoped cooldowns are documented selection semantics.
391 src/agents/tools/web-fetch-utils.ts READ — bounded HTML rendering already uses the canonical scanner; attribute grammar intentionally differs from visibility parsing.
391 src/agents/tools/dashboard-tool.ts READ: scoped board RPCs, transient client commands and durable preferences have separate owners; schema and projection validation remains necessary.
391 src/agents/auth-profiles/usage-state.ts READ — expiry and scope rules distinguish global state, requested model state, and display hints; no safe consolidation of differing cases.
387 src/agents/auth-profiles/legacy-source-diagnostic.ts READ — current JSON-to-SQLite migration refusal is a documented supported contract; provider-scoped refusal cannot be removed as pre-July compatibility.
376 src/agents/tools/media-generate-background.ts READ — existing shared preflight owns duplicate checks, resource transfer and detached admission; removing phases would lose ordering/cleanup guarantees.
371 src/agents/auth-profiles/external-cli-sync.ts READ — excluded from edits: l314 already changed this file.
368 src/agents/command/acp-execution.ts READ: ACP has different turn admission, elicitation, event forwarding, transcript persistence and final cancellation boundaries from embedded/CLI execution.
367 src/agents/tools/sessions-access.ts READ: Read ceilings, scoped grants, tree ownership and audit receipts are distinct authorization obligations; no policy changed.
354 src/agents/tools/web-search-output.ts READ — closed output branches preserve external-provider compatibility and security budgets; no sound further simplification found.
352 src/agents/tools/agents-wait-tool.ts READ: Event subscription before worker read, abort settlement, completion ordering and required waits are necessary; no timeout/ownership changes.
332 src/agents/tools/image-tool.model-execution.ts READ — selected-provider loading, single/multi-image transport and operator authority are distinct contracts; retained.
326 src/agents/tools/video-generate-tool.execution.ts READ — ordered save/URL fallback and metadata probing differ from buffer-only image/music persistence; shared persistence is already canonical.
324 src/agents/tools/computer-tool.ts READ — screenshot/observation result helpers shared; queue, schema mutation and after-action failures have distinct ownership requirements.
314 src/agents/tools/pdf-tool.model-config.ts READ — unified explicit PDF/image config selection and removed a Google-specific branch subsumed by general native-PDF selection.
313 src/agents/command/transcript-persistence.ts READ: CLI and ACP already share canonical text-turn persistence; their usage availability and stop-reason projections intentionally differ.
313 src/agents/command/session-store.ts READ: snapshot merge, exact lifecycle writer checks, snooze clearing, compaction counts and current-context invalidation preserve durable ownership and usage contracts.
310 src/agents/tools/nodes-tool.ts READ — removed four unused option fields for former message routing; model-facing schema and all action branches remain intact.
304 src/agents/tools/sessions-send-followup.ts READ: Original acceptance survives lost ACK; continuation ownership, steering adoption and reconciliation cannot be collapsed without weakening custody.
297 src/agents/tools/music-generate-tool.ts READ — removed identical parser injection; lyrics/format/duration and async result details remain music-specific.
294 src/agents/tools/embedded-gateway-stub.ts READ — routes to existing session/history owners; scope/projection freshness, paging and transport budget checks retain standalone Gateway parity.
293 src/agents/auth-profiles/external-auth.ts READ — plugin overlays and CLI overlays have different authoritative scope and persistence contracts; binding factory is owned by plugin runtime context.
290 src/agents/command/types.ts READ: trusted versus external ingress distinction is a public SDK/security boundary; comments identify authority, routing and persistence ownership, so types were preserved.
290 src/agents/command/session-preparation.ts READ: existing helper owns snapshot refresh; separate snapshot and interaction writes preserve order and independently gated effects.
284 src/agents/tools/message-tool-visible-content.ts READ — distinct text/URL/control sanitization preserves shadow-field suppression and eager error behavior; no sound merger with generic text helpers.
281 src/agents/tools/media-generate-background-completion.ts READ — live source checks, exact transcript targeting, pending/permanent/ambiguous delivery distinctions are required.
261 src/agents/tools/terminal-tool.ts READ: admitted run, exact terminal owner and one-shot approval must all be rechecked before PTY writes; read-only actions already use direct manager calls.
260 src/agents/tools/web-shared.ts READ — bounded byte reads, charset sniffing and expiry honor public web SDK behavior; retained.
260 src/agents/auth-profiles/sqlite-json.ts READ — distinct agent-table and shared-KV schemas require typed queries; no schema or admission change is in scope.
253 src/agents/tools/computer-tool-result.ts READ — metadata/image paths already shared; frame byte identity and native/image coordinate projection have independent contracts.
250 src/agents/tools/image-tool.helpers.ts READ — reasoning-only signatures are used by media-understanding retry handling, model aliases resolve real configured providers; not dead exports.
248 src/agents/tools/computer-tool-bindings.ts READ — attached/session/Gateway/paired-node transports have distinct custody and live authority; binding adapter is the common owner.
247 src/agents/auth-profiles/inline-usage.ts READ — committed receipt survives publication/cleanup failure; simplifying separate cleanup outcomes would change retry/settlement semantics.
245 src/agents/tools/pdf-native-providers.ts READ — common guarded transport is already canonical; Anthropic and Google wire protocols necessarily differ.
245 src/agents/auth-profiles/shared-store-bootstrap.ts READ — fresh-store relocation and migration backup inspection retain current shared-store ownership and Linux lock-safety contracts.
241 src/agents/auth-profiles/mutation-lineage.ts READ — bounded unknown floors preserve conservative rollback fences after eviction; profile and state mutation tokens have different semantics.
240 src/agents/auth-profiles/sqlite-read.ts READ — remove single-field captured-context DTO and repeated captured-error branch already checked by assertCurrent; retain owner revocation and cleanup.
239 src/agents/tools/sessions-send-tool.a2a.ts READ: Captured self-delivery and requester continuation intentionally differ; delivery errors and suppression tokens are observed contracts.
236 src/agents/tools/plugins-tool.ts READ: mutation publication/refresh outcomes and bounded complete capability reviews preserve visible operation semantics.
235 src/agents/tools/nodes-tool-commands.ts READ — raw invoke and structured command actions now share final node dispatch; preserve raw lookup timing, policy denials, timeout omissions, session metadata and response projection.
231 src/agents/tools/sessions-tool-schema.ts READ: Schema variants encode different authority surfaces; all descriptions and parameters remain identical.
230 src/agents/tools/manifest-capability-availability.ts READ: shared metadata eligibility owner already serves media capabilities; profile bindings and plugin/env signals cannot replace one another.
230 src/agents/tools/gateway-tool.ts READ — config path traversal contract differs from shared CLI path parsers; owner-checked update routing and config/schema errors remain required.
228 src/agents/tools/music-generate-tool.execution.ts READ — minimum timeout, lyrics sanitization and duration projection are observable provider contracts.
225 src/agents/command/shared-types.ts READ: contracts are shared with actual embedded/CLI runtime callers; no alternate single-use registry or dead option identified.
222 src/agents/tools/image-generate-tool.execution.ts READ — removed the dedicated aspect-ratio normalizer; retained resolution normalizer because upper/lowercase Unicode semantics differ.
216 src/agents/tools/message-tool-source-policy.ts READ — source-only account/conversation/thread/visible-content enforcement protects distinct boundaries; no further safe removal.
215 src/agents/tools/sessions-send-followup-custody.ts READ: Observation and admitted parent share two-party lifetime; role/profile/session revocation checks retained.
215 src/agents/tools/computer-tool-schema.ts READ — output must remain byte-identical and conditional descriptions reflect advertised capabilities; retained exact cleanup-gated action surface.
214 src/agents/tools/session-status-model.ts READ: Inlined one-use model-selection adapter, removed reset/set wrapper union, reused configured default once; canonical visibility and auth-profile preservation remain owners.
212 src/agents/auth-profiles/runtime-external-profile-references.ts READ — removal and merge/prune differ intentionally for explicit empty external lookup, inline usage, and inherited local profile metadata.
211 src/agents/tools/media-generate-tool-actions-shared.ts READ — provider catalog and task-action owners serve all generation tools; model capability overrides and async lookup semantics are live.
207 src/agents/tools/message-tool-schema-scoping.ts READ — DELETED: only one implementation injected builders; concrete assembly now lives with actual message schema owner.
207 src/agents/auth-profiles/types.ts READ — credential, public store, and private runtime ownership types preserve SDK/private metadata boundary.
206 src/agents/command/lifecycle.ts READ: finishing and terminal events have different settlement authority, and error projections intentionally distinguish diagnostic, display and post-turn paths.
205 src/agents/tools/cron-tool-write.ts READ: current-job CAS, bounded conflict retry and fresh creator capture preserve concurrency and authorization; no speculative layer removed.
202 src/agents/auth-profiles/path-resolve.ts READ — process-stable shared owner, async admission recheck, and stable lock hashing are current persisted coordination contracts.
201 src/agents/tools/sessions-tool-patch.ts READ: Batch item failures, original index mapping and response budget are necessary; mutation parsing already consolidated by field kind.
201 src/agents/tools/cron-tool-output-schema.ts READ: canonical wire schemas are reused; compact/full and version-compatible responses remain externally supported.
201 src/agents/command/maintenance.ts READ: preflight preparation retains foreground custody while followup creates system-owned maintenance without foreground callbacks; they cannot be combined.
201 src/agents/command/delivery-result.ts READ: projection omits false/empty internal facts and preserves result status distinctions; switch cases match durable transport outcomes and preserve JSON fields.

Remove single-use schema builders, forwarding projections, redundant auth
normalization, and compaction's mutable production test-dependency registry.
Keep tool schemas, auth semantics, and lifecycle authority unchanged.

Capture compaction routing before awaited preparation. Isolate inherited
provider keys in the video fixture and preload the session mutation handler
outside the integration fixture's RPC deadline.
@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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: ac11cdb39d619bf369413c298b70f823af554b16
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/oauth-shared.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/persisted.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/policy.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/profile-usage-stats.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/runtime-read.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/session-override.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/sqlite-read.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/sqlite.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store.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.

@clawsweeper

clawsweeper Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 12:05 AM ET / 04:05 UTC.

ClawSweeper review

What this changes

The PR simplifies agent tool assembly, session operations, compaction, and credential handling by removing forwarding layers and moving test controls out of production code.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/agents/auth-profiles/sqlite.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this is useful maintainer-requested cleanup that current main still lacks. The introduced changes preserve the inspected contracts, and no concrete blocking regression was found.

Priority: P3
Reviewed head: ac11cdb39d619bf369413c298b70f823af554b16

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent cleanup with meaningful regression coverage and no identified blocking correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor is exempt from ordinary contributor proof requirements and does not materially change authority. Reported tests and schema comparisons are supplemental; this review executed no runtime proof. No stored-data contract changes were identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal refactor is exempt from ordinary contributor proof requirements and does not materially change authority. Reported tests and schema comparisons are supplemental; this review executed no runtime proof. No stored-data contract changes were identified.
Evidence reviewed 9 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. Raw test-merge records confirm the pinned main parent followed by the exact PR head; its result changes the introduced paths without removing the supplied base-only work.
Cleanup remains necessary on main: Pinned current main still contains the mutable CLI compaction dependency registry, repeated guard bookkeeping, and injected message-schema builder map removed by this branch. No merged replacement was supplied or established.
Credential and storage contracts: Credential normalization retains the existing valid-type fields and expiry handling. Persistence still excludes personal profiles and strips resolved key/token literals when SecretRefs exist; SQLite consolidation retains store/state routing without changing schemas or serialized formats.
Findings None None.
Security None None.

How this fits together

Agent orchestration turns model tool requests and session state into Gateway operations, compaction, and provider requests. Auth-profile owners supply credentials while session and dispatch owners enforce access and lifecycle checks.

flowchart TD
  A[Model tool requests] --> B[Tool schemas and validation]
  B --> C[Session and dispatch owners]
  D[Session state] --> C
  E[Auth profile owners] --> F[Provider and compaction execution]
  C --> F
  C --> G[Gateway operations and tool results]
  F --> G
Loading

Before merge

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

Security

None.

PR surface

Source -644, Tests +78, Other 0. Total -566 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 38 649 1293 -644
Tests 4 204 126 +78
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 43 855 1421 -566

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: config/assertion-safety-baseline.txt, serialized state: src/agents/tools/session-status-visibility.ts, unknown-data-model-change: src/agents/auth-profiles/sqlite.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the simpler orchestration with canonical owners preserving schema bytes, credential filtering, compaction routing, and lifecycle checks.

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

Not applicable: this PR proposes behavior-preserving cleanup rather than a reported product bug; the added cases protect preparation-time routing.

Is this the best way to solve the issue?

Yes: consolidating orchestration at existing owners and removing production-only test controls is a maintainable approach; no concrete introduced defect was identified in the inspected changes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 60bdc8fa5780.

Labels

Label changes:

  • add P3: This is internal simplification with preserved user-facing contracts and no identified urgent product defect.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is internal simplification with preserved user-facing contracts and no identified urgent product defect.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. Raw test-merge records confirm the pinned main parent followed by the exact PR head; its result changes the introduced paths without removing the supplied base-only work. (787dbc8169ee)
  • Cleanup remains necessary on main: Pinned current main still contains the mutable CLI compaction dependency registry, repeated guard bookkeeping, and injected message-schema builder map removed by this branch. No merged replacement was supplied or established. (src/agents/command/cli-compaction.ts:132, 60bdc8fa5780)
  • Credential and storage contracts: Credential normalization retains the existing valid-type fields and expiry handling. Persistence still excludes personal profiles and strips resolved key/token literals when SecretRefs exist; SQLite consolidation retains store/state routing without changing schemas or serialized formats. (src/agents/auth-profiles/persisted.ts:729, ac11cdb39d61)
  • Session authority preservation: The inlined visibility check retains current operator authority before and after the awaited describe request, compares the selected session identity, and continues through scoped session access. The diff does not materially expand authorization. (src/agents/tools/session-status-tool.ts:544, ac11cdb39d61)
  • Node dispatch invariants: Raw invocation retains its early node lookup, reserved-command and file-transfer denials, timeout handling, session metadata, and raw response. Structured actions retain their lookup ordering and payload projection through the same final dispatch owner. (src/agents/tools/nodes-tool-commands.ts:168, ac11cdb39d61)
  • Compaction regression coverage: The route is captured before awaited engine preparation. The two added cases cover harness metadata changing in either direction during preparation; existing fallback, lock, successor, and cleanup assertions remain. These tests were inspected, not executed by this review. (src/agents/command/cli-compaction.test.ts:731, ac11cdb39d61)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason O'Neal: 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.

@steipete
steipete merged commit 2dff1c3 into main Oct 3, 2026
151 of 154 checks passed
@steipete
steipete deleted the deslop/l330-simplify-agents-tools-auth-20261002 branch October 3, 2026 04:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Simplify agent tool, auth-profile, and command-compaction orchestration through their existing owners. Remove single-use schema builders and forwarding layers, redundant projections and normalization, and compaction's mutable production test-dependency registry.

Preserve model-facing schemas and descriptions, auth selection and persistence, response shapes, and authority/lifecycle fencing. Capture compaction routing before asynchronous preparation. Repair video fixture provider-environment isolation and session mutation fixture cold-import timing without weakening assertions or deadlines.

Net production reduction: 644 lines. Complete subtree coverage and validation evidence are recorded in the PR.

Exact-head CI 37095112294 completed with one inherited failure in the unchanged MCP node-matching fixture. Main schedule 37094503398 at the exact PR base reports the identical assertion; source and function-level attribution are recorded in the PR. Other selected CI and security checks passed. Landed through the maintainer-authorized inherited-main exception.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant