Skip to content

refactor(agents): trust prepared runtime facts - #175258

Merged
steipete merged 2 commits into
mainfrom
deslop/r02-25-agent-prepared-facts-20261015
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/r02-25-agent-prepared-facts-20261015

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Prepared agent paths repeat typed-boundary checks, use cast-based optional registry probes instead of the actual owner, duplicate tool lookup paths, and keep bookkeeping for repeated diagnostic events.

What Changed

Use canonical ModelRegistry metadata ownership, typed AgentSession events and existing result/type owners. Resolve ToolSearch entries at its shared scheduled-call owner. Preserve catalog ordering, account visibility, authScope/new main logic, transcript authority, login/lease checks and all execution effects. Migrate two adjacent fixtures without weakening assertions; shrink only the two exact assertion allowances retired by the cut.

Best-effort tradeoffs accepted

  • MCP preparation counters are already removed on main by refactor(agents): simplify completed-run bookkeeping #174838. Both MCP production and preparation tests are byte-identical to main, retaining the newer sequential acknowledged/uncertain-settlement coverage; no MCP deletion credit is claimed.
  • Commentary diagnostics no longer hash/deduplicate repeated completed events. A duplicate producer event may produce a duplicate diagnostic; functional delivery and bounded diagnostic ownership are unchanged.
  • Model-catalog catch/log-once bookkeeping disappears; the original error still propagates to its owner. No failure is swallowed.
  • Internally prepared ownership/results/media values are trusted without another copy or type probe. External parsers, branch owners, transcript admission and current authority remain. Violating the typed internal contract is a programming error, not a supported input mode.

Evidence

  • Qualified earlier serial suppression-policy check on installed primary passed3/3 (121.30s). The latest task-isolated maxWorkers1 attempt on unchanged installed inputs exhausted its300s outer preparation budget without an assertion result (exit124/worker143); no passing latest run, product regression or inherited-failure result is claimed. No timeout, retry, skip or suppression changed. This is not runtime proof for this source-only packet; exact-head CI remains the broad gate.

  • Refreshed branch has20 paths including the exact assertion baseline:79 net production lines removed against main9a35d1a97cff8263fa36dcacc3343da1d037d778. MCP and session-runtime-ownership cuts are already absorbed and receive no duplicate credit. Baseline model.registry-resolution3→2; attempt-queue-message1→row removed. admitted-run-context.ts is deliberately untouched.

  • Full diff, including whitespace-insensitive inspection of the catalog try/catch removal, and complete simplification/caller inspection passed. Fresh full refreshed-packet isolated P0-P2 review completed scoped-clean0.94 with final source verification. Conflict-only MCP resolution retains main byte-for-byte; normal signed rebase completed at83b7d349c012b51e2586ec174a299e73de204a4c. Typed fixture changes retain existing behavioral assertions.

  • Source-only checkout has no independent install; no local runtime/type pass claimed. Exact-head CI supplies broad proof under shared-host limits. No schema/config/protocol value or shape, dependency, Phase E, security/FIFO/settlement change.

Exact-head CI repair

  • Initial83b7 head CI39011411159 failed PDF orchestration job117334848803: synthetic registry objects omitted the newly required getProviderMetadataOwners method. Repair97f642e4ac7e9ceab40d0a546cce42071a340dbd adds that method returning undefined at the shared PDF fixture owner and the independently reachable startup-static alias fixture. Existing behavioral assertions remain unchanged; no production fallback or new mock allowance. Fresh isolated two-file P0-P2 review scoped-clean0.99 with final source verification; normal signed hook formatting passed2files221ms. Production delta remains79 removed.
  • Local runtime replay is unqualified: installed primary fs-safe0.26.6 differs from head/base0.26.7; source worktree has no independent install. Shared dependencies are not reinstalled or relinked. New exact-head hosted CI must prove the fixture repair; the prior failure is not called inherited or passing.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 17, 2026
@steipete
steipete marked this pull request as ready for review October 17, 2026 06:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T06:54:48.489705Z 83b7d34 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current signed head97f642e4ac7e9ceab40d0a546cce42071a340dbd fixes the initial PDF fixture defect at the shared registry helper and independently reachable startup-static alias fixture. Existing assertions remain unchanged. Fresh isolated two-file review completed scoped-clean through P2; body/proof limitations are current. Initial failed CI39011411159 is not called inherited or passing; new exact-head CI is the gate.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR removes redundant internal checks and diagnostic bookkeeping while consolidating prepared model and tool lookups.

Example: A harness emits the same completed commentary item twice.

  • Before: The diagnostic subscriber hashes the item and emits one diagnostic event.
  • After: Both events may produce diagnostics, an explicitly accepted best-effort tradeoff.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Source inspection supports the refactor and fixture repair; confidence remains limited by incomplete exact-head CI and the absence of changed-path runtime evidence.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored exemption applies: the body accurately reports source review and CI limitations without claiming a runtime pass, and the patch does not materially change an authority chain.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated internal checks and parallel lookup plumbing increase runtime maintenance cost without adding supported behavior.
Reason: The maintainer-authored direction removes redundant machinery within existing owners and explicitly accepts the limited diagnostic behavior changes.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open. The pinned change is coherent, and source review found no actionable introduced defect; exact-head CI remains incomplete.

Priority: P3
Reviewed head: 97f642e4ac7e9ceab40d0a546cce42071a340dbd

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No changed-path runtime demonstration is supplied; this maintainer-authored PR is outside the ordinary contributor proof gate.
Agent review details

How this fits together

Agent runtime owners prepare model metadata, tool catalogs, session events, and transcript state; downstream execution and diagnostics consume those facts.

flowchart TD
  A[Prepared runtime facts] --> B[Model resolution]
  A --> C[Tool Search runtime]
  D[Session event owner] --> E[Steering lifecycle]
  C --> F[Scheduled tool execution]
  D --> G[Commentary diagnostics]
Loading

Technical review

Best possible solution:

Retain the simplified existing owners and complete the exact-head CI gate before landing.

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

This is a maintainer-directed refactor rather than a reported product bug; source inspection verifies the changed contracts, and no target code was executed.

Is this the best way to solve the issue?

The change follows existing ownership boundaries, preserves production authority checks, and replaces optional registry probing with the concrete registry contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 32223e38543f.

Provenance checked

  • Registry metadata ownership keeps the original intent (a67ad03: Prepared startup work captured provider metadata ownership while bounding multi-agent startup; current production callers already supply the concrete session registry.)
  • Commentary deduplication changes intended behavior with a stated reason (904f9c0: Completed-commentary tracing suppressed replay duplicates using bounded hashes; this PR explicitly accepts duplicate diagnostics while retaining capture policy and content bounds.)
  • Code Mode branch replay keeps the original intent (5a4ece7: Session store/load replays the selected transcript branch across replies and restarts; the remaining leaf-existence check and navigation owner preserve that contract.)
  • Generated catalog repair keeps the original intent (eb8a6a8: Doctor completes partial numeric costs while preserving supplied prices and valid sibling models; the canonical record helper preserves those decisions.)
  • Tool Search call variants keeps the original intent (050475b: Tool Search internals were split by ownership; the shared call helper retains exact-ID versus visible-name lookup and scheduled execution.)
  • Catalog preparation changes intended behavior with a stated reason (06f5f73: Lifecycle-owned model discovery centralizes prepared catalogs; removal of warning-once state preserves original error propagation and catalog composition.)
  • Local service rejection normalization changes intended behavior with a stated reason (2148b7c: Runtime simplification consolidated rejection conversion; this PR deliberately trusts internal promises while retaining abort handling, service cleanup, and credential checks.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Pinned introduction reviewed: Reviewed the merge-base-to-head hunks, including the whitespace-insensitive catalog diff; catalog construction changes only by removing catch-and-rethrow warning bookkeeping. (src/agents/model-catalog.ts:291, 97f642e4ac7e)
  • Registry owner and fixture repair: Production callers already use the session-owned ModelRegistry, whose getProviderMetadataOwners method returns its captured metadata generation; the PDF and startup fixtures now provide that method without changing behavioral assertions. (src/agents/tools/pdf-tool.test-support.ts:77, 97f642e4ac7e)
  • Transcript invariant retained: Replay still checks current ownership, unchanged leaf identity, and leaf existence after opening the transcript; getBranch includes that existing leaf before reversing the path, making the removed final-element check redundant. (src/agents/code-mode-session-store.ts:220, 97f642e4ac7e)
  • Persisted repair equivalence: asOptionalRecord delegates directly to isRecord; the rewritten repair loop preserves removal decisions, cost completion, counters, retained values, and serialization. (src/agents/plugin-model-catalog-repair.ts:50, 97f642e4ac7e)
  • Accepted maintainer tradeoffs: The full PR body explicitly accepts duplicate commentary diagnostics, removal of catalog log-once bookkeeping, and trusting typed internal values; the re-review request identifies the exact fixture-repair head and keeps CI as the gate. (97f642e4ac7e)
  • Current merge and CI state: GitHub reports mergeable=true. The paginated exact-head check read reported no failed checks, with checks still running and openclaw/ci-gate pending; this is not a completed CI pass. (97f642e4ac7e)

PR surface

Source -79, Tests +11, Other -1. Total -69 across 22 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 13 241 320 -79
Tests 8 21 10 +11
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 2 -1
Total 22 263 332 -69

Labels

Label changes:

  • add P3: This is internal simplification with accepted diagnostic tradeoffs and no established urgent user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal simplification with accepted diagnostic tradeoffs and no established urgent user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 17, 2026, 3:13 AM ET / 07:13 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact reviewed head97f642e4ac7e9ceab40d0a546cce42071a340dbd, CI39012413808 GREEN.

Fresh paginated filter=all census:143 checks,79success/60intentional-skips/1neutral/3superseded metadata cancellations; zero failed or pending check. Latest dependency-review, security-sensitive-review and ci-gate statuses are all SUCCESS. No product suite was cancelled or excused.

Cancelled metadata check Successful same-head replacement
auto-response117337590682 117337554784
PR context and evidence117337554980 117337590420
dispatch117337554376 117337590699

The initial83b7 head's PDF orchestration failure117334848803 was ours: a synthetic registry omitted the concrete metadata-owner method. The shared PDF fixture and independently reachable startup-static alias fixture now implement the method returning undefined, preserving prior empty-metadata behavior and all behavioral assertions. New exact-head CI passes; the old failure is not called inherited. No production fallback, mock allowance, suppression, timeout/retry/skip or assertion weakening.

Full refreshed production packet had isolated P0-P2 scoped-clean0.94 review; the exact two-fixture repair has fresh scoped-clean0.99 review and final source verification. Current-head maintainer review6231089215 reports no findings or before-merge action. Formal and inline reviews have no outstanding finding. Normal signed commit/hook formatting passed; Peter author/committer with good signature and native writersteipete verified. Live head/MERGEABLE is rechecked immediately before submission.

Production reduction79 net lines;22 total paths include test/support and exact shrink-only assertion baseline. Already-main MCP and ownership cuts receive no duplicate credit. Typed runtime owners replace optional probes; diagnostic dedup/warn-once removal keeps propagation and explicitly accepts duplicate diagnostics. Security, FIFO, transcript durability, write settlement and Phase E remain intact. Local runtime replay is not claimed with mismatched installed dependencies; latest isolated suppression attempt exhausted300s preparation without assertions, earlier qualified3/3 remains prior-input evidence. Hosted exact-head gates now supply passing broad proof.

Native initialization previously failed twice on bounded managed-capacity allocation with OPENCLAW_STATE_LEASE_ABORTED, owned processes drained and exact operation locks recovered, with no merge intent ever submitted. Coordinator rule10 authorizes the exact-SHA-guarded squash API fallback after this evidence comment. This replaces broken allocation, not review or CI. No CI rerun, green-only source push or proactive rebase.

@steipete
steipete merged commit 7dcd9a3 into main Oct 17, 2026
143 of 146 checks passed
@steipete
steipete deleted the deslop/r02-25-agent-prepared-facts-20261015 branch October 17, 2026 07:18
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
* refactor(agents): trust prepared runtime facts

* test(agents): complete prepared model registry fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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