Skip to content

refactor(agents): deslop agents - #163963

Merged
steipete merged 2 commits into
mainfrom
deslop/l331-simplify-agents-root-20261002
Oct 3, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/l331-simplify-agents-root-20261002

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The root agent runtime retains single-use adapters, duplicated state projections, and obsolete internal options that make the same behavior harder to follow. This is a maintainer-requested subsystem simplification batch.

User Impact

The refactors preserve configuration, persisted data, protocol shapes, tool descriptions, and prompt bytes. The included process-tool fix restores literal key input before cursor mode is known. July 2026 and newer upgrade shapes remain supported; only older in-process compatibility paths are retired.

Why This Change Was Made

The batch removes 1,037 net production lines from the root of src/agents without relocating code. Each simplification stays with its existing owner:

  • Inline single-use completion, prompt-section, cron-resolver, and cache-access adapters instead of maintaining duplicate option bags and callback contracts.
  • Keep only request identity and timestamps in the media duplicate-start cache; read live progress and status from the existing operation owner.
  • Reuse canonical trace fields, numeric coercers, approval payload types, runtime tool matchers, and subscription-state initialization.
  • Remove unused model-auth members and retired task activity callbacks, discarded bootstrap diagnostic prose, pre-July process-global migration shims, and unreachable compaction branches.
  • Use direct traversal for shell quoting, tool-loop evidence, and admitted recovery rows while preserving escape handling, ordering, authorization checks, and resource settlement.

Fixes Found Along the Way

process send-keys treated inherited object properties as cursor keys, so literal constructor and __proto__ inputs were rejected while cursor mode was unknown. Use own-property membership and retain the existing guard for actual cursor keys. Both new process-tool regressions fail on the original condition and pass with the fix.

Evidence

  • Independent Codex review: scoped-clean through P2.

  • 77 focused owner/sibling test files: 1,417 passed, three existing Windows-only cases skipped on macOS.

  • Separate bootstrap, process-delivery, and PTY encoding suites: 43 passed. Total: 80 files and 1,460 passing tests.

  • PTY negative control: both new cases fail on the original code with status: failed instead of running; the entire fixed delivery suite passes.

  • Runtime build, all 96 plugin bundles, CLI bootstrap import guard, and built plugin-load checks passed as test prerequisites. No generated files changed outside the lane.

  • Remote Testbox admission expired before checkout; the direct AWS broker also timed out. Validation used the explicitly authorized local fallback at nice -n 15, one command at a time.

  • Changed test cost (pnpm test <file> --maxWorkers=1): bootstrap budget 56.90s command wall time / 35.39s Vitest; process delivery 293.55s wall / 255.20s Vitest. The overloaded Mac's transform/import work dominates; new literal-key cases reuse the existing process fixture without new timers, process boots, or production seams. The delivery suite also protects Code Mode persistence/acknowledgment contracts.

  • Both mandatory import-cycle checkers report zero. Core TypeScript check passed.

  • Conflict-marker, line-cap growth, and max-lines suppression checks passed. The optional repository-wide assertion inventory was stopped after scoped proof; full ratchets remain part of hosted CI.

  • Initial hosted CI identified a parameter-reassignment lint error, two formatting misses, two stale test option fields, a shrink-only assertion baseline update, and the missing Knip entry for a retained upgrade barrel. The follow-up fixes all five; the July/September released runtime entry stays intact.

  • Repair-focused validation: all 79 tests pass across the patch parser, CLI-backend, and model-catalog recovery suites. Core lint, the messaging test-type graph, dependency/file analysis, and both cycle checks pass on the repair commit. The generic lint wrapper timed out preparing unrelated plugin-SDK declarations; the supported core-only lint route passed.

  • Exact-head hosted CI will gate squash auto-merge.

Inline single-use adapters, share canonical contracts, and remove obsolete
internal options and pre-July in-process compatibility. Preserve prompts,
authority fences, resource settlement, and current state contracts.

Fix process send-keys incorrectly treating inherited object properties as
cursor-mode-sensitive keys, with original-failing input-delivery regressions.
@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. This comment is informational because the PR author has repository Maintain or Admin access.

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

These security sensitive changes were made:

  • src/agents/auth-health.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/cron-creator-authority-context.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-availability.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-auth-runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/model-provider-auth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/tool-policy-match.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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

ClawSweeper review

What this changes

The PR simplifies agent-runtime adapters, caches, prompt assembly, and internal contracts, and fixes literal key input to interactive processes before cursor mode is known.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: the branch contains useful work still absent from current main, and no blocking introduced defect was identified. The earlier stored-data migration concern does not apply to the process-local caches inspected.

Priority: P2
Reviewed head: a09cf026b019b5160ccb0b42307c45c96dfc67d5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful owner-preserving cleanup with focused regression coverage and no blocking defect identified in the introduced diff.
Proof confidence 🌊 off-meta tidepool Not applicable: The captured maintainer-author context exempts this PR from ordinary contributor runtime proof. Reported focused tests are supplemental; the authority refactors preserve existing semantics, and the inspected caches introduce no stored-data contract change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The captured maintainer-author context exempts this PR from ordinary contributor runtime proof. Reported focused tests are supplemental; the authority refactors preserve existing semantics, and the inspected caches introduce no stored-data contract change.
Evidence reviewed 8 items Pinned introduction and clean checkout: Reviewed the introduced hunks from merge-base b379364 to the exact original head a09cf02, rather than endpoint drift. Raw head metadata records parent 70a2184. Initial and final status were clean.
The process-key repair is still necessary: Fetched main still checks cursor-sensitive keys with inherited-property membership. The branch replaces that condition with Object.hasOwn; the added process-tool cases assert literal constructor and proto bytes reach stdin while cursor mode is unknown. These are inspected regression tests, not reviewer-executed runtime proof.
Compatibility concern narrowed to process-local state: The context and fallback caches are globalThis objects and maps, and media request correlation is an in-memory map backed by the existing operation owner. The patch does not change their stored-data schema or serialized format. The reload-safe models-config.runtime.ts barrel remains present and gains an explicit Knip entry.
Findings None None.
Security None None.

How this fits together

The agent runtime turns configuration, conversation history, and model selections into prompts and executable tools. Its lifecycle owners coordinate authorization, process input, completion recovery, and returned results.

flowchart TD
  A[Configuration and conversation] --> B[Agent runtime preparation]
  B --> C[Prompt and model selection]
  B --> D[Current execution authority]
  C --> E[Model tool requests]
  D --> F[Tool execution and processes]
  E --> F
  F --> G[Results and completion recovery]
Loading

Before merge

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

Security

None.

PR surface

Source -1037, Tests -115, Other +2. Total -1150 across 56 files.

View PR surface stats
Area Files Added Removed Net
Source 46 706 1743 -1037
Tests 8 38 153 -115
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 3 1 +2
Total 56 747 1897 -1150

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/agents/context-runtime-state.ts, unknown-data-model-change: src/agents/context-runtime-state.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep runtime decisions with their existing owners, preserve released reload entrypoints, and retain the focused process-input repair.

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

Yes, from source: current main misclassifies inherited object-property names as cursor keys when mode is unknown. The branch includes focused process-entrypoint regressions; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. Own-property membership narrowly repairs key classification, and the inspected simplifications reuse existing owners without adding configuration or parallel implementations.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81987cd91a5a.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is useful bounded runtime cleanup with a limited process-input repair, without evidence of an urgent user-facing 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 captured maintainer-author context exempts this PR from ordinary contributor runtime proof. Reported focused tests are supplemental; the authority refactors preserve existing semantics, and the inspected caches introduce no stored-data contract change.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced hunks from merge-base b379364 to the exact original head a09cf02, rather than endpoint drift. Raw head metadata records parent 70a2184. Initial and final status were clean. (a09cf026b019)
  • The process-key repair is still necessary: Fetched main still checks cursor-sensitive keys with inherited-property membership. The branch replaces that condition with Object.hasOwn; the added process-tool cases assert literal constructor and proto bytes reach stdin while cursor mode is unknown. These are inspected regression tests, not reviewer-executed runtime proof. (src/agents/pty-keys.ts:134, 81987cd91a5a)
  • Compatibility concern narrowed to process-local state: The context and fallback caches are globalThis objects and maps, and media request correlation is an in-memory map backed by the existing operation owner. The patch does not change their stored-data schema or serialized format. The reload-safe models-config.runtime.ts barrel remains present and gains an explicit Knip entry. (src/agents/context-runtime-state.ts:11, a09cf026b019)
  • Latest-release state comparison: The successfully inspected v2026.9.8 context-runtime module already initializes generation and loadGeneration. The branch retains invalidation when newly introduced cache maps replace a released module's maps. This establishes relevant released-state context, without claiming an executed upgrade or verification of every older release. (src/agents/context-runtime-state.ts:12, fc23bc864e45)
  • Security and authority equivalence: Cron resolver inlining retains exact-run admission, unknown-origin restrictions, abort checks around awaited materialization, and the existing grant minting owner. Completion recovery retains exact source identity, provenance, admitted recovery-run matching, and current-session assertions. Runtime tool matching retains empty-list denial and independent restriction intersections; no material authorization expansion was identified. (src/agents/cron-creator-authority-context.ts:391, a09cf026b019)
  • Maintainer context and supplemental validation: The captured body describes maintainer-requested simplification, reports 1,460 passing focused tests and original-failing process-key controls, and documents subsequent validation repairs. The security guard identifies steipete as repository admin. These reports support review context; no tests, builds, or additional reviewer helpers were executed here. (a09cf026b019)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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 (1 earlier review cycle)
  • reviewed 2026-10-03T02:38:08.458Z sha 70a2184 :: blocked before merge. :: none

@steipete
steipete enabled auto-merge (squash) October 3, 2026 02:43
@steipete
steipete disabled auto-merge October 3, 2026 02:50
@steipete
steipete enabled auto-merge (squash) October 3, 2026 03:30
@steipete
steipete merged commit 4a0be71 into main Oct 3, 2026
159 of 161 checks passed
@steipete
steipete deleted the deslop/l331-simplify-agents-root-20261002 branch October 3, 2026 03:39
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
Remove redundant root-agent adapters, duplicated state projections, unused auth options, and pre-July process-global compatibility while retaining current prompts, authorization fences, and settlement ordering. Keep media status with its operation owner and reuse canonical contracts.

Fix process send-keys rejecting literal constructor and __proto__ input before cursor mode is known. Both regression cases fail on the original code and pass with the fix.

Validation: 1,460 passing tests across 80 files, three existing Windows-only skips on macOS; successful runtime build and core typecheck; both import-cycle checks report zero; independent Codex review clean through P2. Exact-head hosted CI gates this merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. 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