Skip to content

refactor(agents): trust maintenance-owned prepared facts - #175226

Merged
steipete merged 2 commits into
mainfrom
deslop/r02-24-maintenance-facts-20261015
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/r02-24-maintenance-facts-20261015

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Agent preparation reaches the maintenance coordinator through a forwarding wrapper, repeats already-proven context assertions, and copies/freezes owner-prepared data. Timeout recovery adds a separate nonce despite already holding the exact abandonment record.

What Changed

Use the canonical coordinator directly across every caller/test, preserving disposal and transcript-read ordering. Type context hooks through the public Agent member rather than a cast-only view. Reuse stable internal media/history/context values, keep the pre-order Responses invariant and effect-boundary currentness check, and use exact abandonment-record identity for timeout restoration.

Best-effort tradeoffs accepted

  • Stable internal media/history arrays and provider prompt context are no longer copied/frozen against hypothetical mutation after handoff. Their owners and nonmutating replay helpers retain the real lifetime contract; a violating internal caller is a programming error.
  • The duplicate post-order Responses assertion disappears; the existing pre-order invariant and nonmutating ordering transformation remain. This does not remove the underlying transcript repair or its coverage.
  • Per-mark timeout nonces are replaced by exact abandonment-record identity. The completion-loss fix from fix(runs): deliver subagent completions during recoverable timeouts #132704/[Bug]: subagent completions dropped during a parent run's recoverable timeout window #119143, recovering-timeout state, terminal-failure restoration, replacement-run protection and settlement remain. Arbitrary overlapping re-mark/restore on the same record is not a real caller sequence; same-session recovery is serialized.
  • A repeated currentness assertion immediately before the retained effect-boundary check is removed. Live authority is still checked after the awaited load and before execution.

Evidence

  • Serial suppression check on installed primary at source23's repaired head passed3/3 in one shard (121.30s), maxWorkers1 and task-isolated state. This is suppression-policy proof, not maintenance runtime proof; exact-head CI remains the broad gate.

  • Twenty-nine paths,11 production files:35 net production lines removed. The exact assertion ratchet shrinks7→5, and one obsolete closed-mock allowance is deleted after its factory becomes a real-module passthrough. All16 old wait-wrapper references migrated; no public SDK export/barrel was removed. Existing kept behavioral assertions remain.

  • Full production/test diff and owner/caller simplification inspected. Public Agent.transformContext and nonmutating replay contracts verified. Independent isolated P0-P2 review completed scoped-clean, confidence0.88, including final source verification.

  • Whitespace checks passed. Source-only checkout has no independent install; no local runtime/type pass claimed. Exact-head hosted CI owns broad proof under the shared-host budget. No schema, config/protocol values, dependencies, security/FIFO/settlement or Phase E change.

  • Original exact-head CI found the migrated overflow-compaction mock's changed closed-factory fingerprint. Repair preserves its mocked operation, passes through real exports, and deletes only the old allowance; fresh isolated P0-P2 review completed scoped-clean0.99 with final source verification. Separately, core test types report untouched config-health using declarations against its removed Disposable contract; this remains visible in observed main9a35d1a and is recorded separately, not waived as green.

@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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Oct 17, 2026
@steipete
steipete marked this pull request as ready for review October 17, 2026 06:18
@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:20:37.988043Z 8a13732 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

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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 calls the maintenance coordinator directly, uses the public Agent context-hook type, and removes redundant copies, assertions, and timeout nonces.

Example: A parent run times out while a child completion arrives during compaction recovery.

  • Before: Recovery uses a separate nonce to protect restoration of terminal timeout suppression.
  • After: Recovery uses the exact abandonment record, preserving retryable completion handling and protection against replacement runs.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Source review supports the simplification with no actionable findings, but supplied execution evidence does not exercise the changed runtime paths.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; its reported suppression-policy execution is not maintenance runtime proof, and no material authority-boundary change was found.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The maintainer has approved the direction and documented the accepted tradeoffs; the diff removes redundant ownership and checks without adding options or changing public contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authorized refactor removes redundant bookkeeping while preserving the existing maintenance, replay, and timeout-recovery contracts; no actionable introduced defect was found.

Priority: P3
Reviewed head: e4b82ef7ffab164dddefbf71295cc244c126379d

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No current-head CLI or Gateway execution of maintenance waiting, replay preparation, or timeout recovery was supplied; the reported suppression-policy run exercises a different contract.
Agent review details

How this fits together

CLI and embedded agent preparation wait for session maintenance before reading history; replay preparation supplies model context, and timeout recovery controls whether child completions wait or are suppressed.

flowchart LR
  A[CLI and embedded runs] --> B[Session maintenance coordinator]
  B --> C[Transcript read and replay]
  C --> D[Model request]
  D --> E[Timeout recovery]
  E --> F[Abandonment record]
  F --> G[Child completion handling]
Loading

Technical review

Best possible solution:

Retain the direct coordinator calls and simpler internal bookkeeping while preserving the existing replay, resource-lifetime, and timeout-recovery contracts.

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

This PR is a behavior-preserving refactor rather than a reported runtime bug; review used source and supplied evidence without executing target code.

Is this the best way to solve the issue?

The direct coordinator and public Agent type remove redundant paths, while the retained checks and nonmutating helpers preserve the relevant contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4a2c8498afcb.

Provenance checked

  • Maintenance wait wrapper keeps the original intent (c1df7aa: Deferred maintenance needed a foreground read checkpoint without sharing the foreground execution lane.)
  • Responses replay assertion keeps the original intent (e90fb67: Reject invalid tool-call/result replay after repairing poisoned message-tool history; the retained pre-order assertion still enforces that contract.)
  • Timeout recovery marker changes intended behavior with a stated reason (ffa8806: Retain child completions during recoverable timeouts and restore terminal suppression safely after failed recovery.)
  • CLI media and compaction-history copies changes intended behavior with a stated reason (fix: deliver requested image artifacts across agent runtimes #124910: Preserve explicitly outbound CLI media; compaction separately retained validated history for metrics through refactor(agents): split direct compaction pipeline #113880.)
  • Prepared provider prompt context changes intended behavior with a stated reason (06d4475: Keep prepared instructions authoritative across local and node execution; the PR explicitly accepts trusting internal consumers instead of shallow freezing.)
  • Maintenance currentness checks keeps the original intent (4bd8ee5: Revalidate live session authority after worker reads and before effects; the effect-boundary check remains.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • xingzhou: Raw commit ffa8806 adds src/agents/embedded-agent-runner/runs.ts:340 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ffa8806dfc8a; files: src/agents/embedded-agent-runner/runs.ts)

PR surface

Source -33, Tests -28, Other -1. Total -62 across 29 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 12 27 60 -33
Tests 15 83 111 -28
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 2 -1
Total 29 111 173 -62

Labels

Label changes:

  • add P3: This is internal cleanup with no intended user-visible behavior change or demonstrated urgent 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 cleanup with no intended user-visible behavior change or demonstrated urgent 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, 2:34 AM ET / 06:34 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Landing under the campaign's inherited-failure admin exception and rule10 exact-head fallback.

Reviewed and signed head: e4b82ef. Exact CI39010054871 completed. Fresh paginated enumeration with filter=all contains150checks:71success,73intentional skips,1neutral,2failures,3superseded metadata cancellations, zero pending. Dependency and security-sensitive legacy statuses are successful; the CI gate remains honestly red for the failure below.

Nonpassing check Evidence and disposition
117331015934 check-test-types-core-1 Only TS2741 at src/config/io.health-state-scope.test.ts71:23 and78:19: ConfigHealthStateStore lacks Symbol.dispose required by using. Identical diagnostics independently occur in unrelated update PR175187, exactba5ce2e206489c5226cfd28a022ea0d63d5745ed/job117329821765, and this PR's previous job117328915286. Neither cleanup diff modifies the health owner/test. Observed main9a35d1a97cff8263fa36dcacc3343da1d037d778 contains the using declarations while #175077 removed the Disposable return contract. This is inherited, not a maintenance regression.
117332280856 openclaw/ci-gate Aggregate derivative of the single inherited type failure above.
117330519078 auto-response CANCELLED Superseded metadata only; successful same-head replacement117330514261. No test suite omitted.
117330514932 PR context and evidence CANCELLED Superseded metadata only; successful same-head replacement117330518957.
117330513832 dispatch CANCELLED Superseded metadata only; successful same-head replacement117330519087.

The main-flakes inventory and last six completed scheduled runs were consulted, including39006528379/39002992814/38999305057/38995631641/38991549274/38988964265. The type defect is newer than their matching inventory; the independent unrelated-PR diagnostics and unchanged main owner/test provide the counterevidence. No unrelated runtime or E2E failure is included in this exception.

The original head's mock-export fingerprint defect was ours and was repaired: the overflow-compaction mock now passes through the real owner while preserving its mocked operation, and the obsolete exact allowance was deleted. That gate passes on the current head. No assertion, timeout, retry, skip, baseline expansion, suppression or protected tool was weakened.

Independent original P0-P2 review completed scoped-clean0.88; the exact two-file repair has fresh isolated scoped-clean0.99 review and final source verification. The current-head hosted maintainer review reports no findings; formal/inline reviews contain no outstanding finding. Hosted exact-head jobs provide the broad proof. Local suppression-policy proof passed3/3; no local maintenance CLI/Gateway E2E claim is made. Best-effort tradeoffs remain explicit in the PR body; Phase E, security/FIFO/settlement and data durability are untouched.

The native landing initializer twice failed managed-worktree allocation with OPENCLAW_STATE_LEASE_ABORTED after the bounded infrastructure budget; both operations/processes/locks were reconciled without any merge intent. Campaign rule10 therefore authorizes the direct squash API with the exact reviewed SHA guard. Native writer verified as steipete; commit author and committer verified as Peter Steinberger with a good signature. Merge success will be reported only after readback and squash ancestry verification.

@steipete
steipete merged commit 2841300 into main Oct 17, 2026
147 of 153 checks passed
@steipete
steipete deleted the deslop/r02-24-maintenance-facts-20261015 branch October 17, 2026 06:41
etzelm added a commit to etzelm/openclaw that referenced this pull request Oct 18, 2026
- prepare.ts: main's comment lines (openclaw#175226, openclaw#168244) kept; the history
  gate stays inline on replayableTarget(cliHistoryWriter) as on the
  branch, so the file does not grow past its line-cap count
- cli-runtime.test.ts: main's rewrite (openclaw#174630); the branch's it.for over
  assertCurrent and assertPrivateInputCurrent and its two private-input
  tests move into it, and createContext takes ClaudeCliExecuteContext
  overrides; cli-runtime.test-harness.ts and
  cli-runtime.private-input.test.ts deleted (the split only kept the old
  file under the line cap)
- history-boundary.test.ts: branch fixture import plus main's
  prepareCliHistoryCompactionBoundary import (openclaw#175090)
- docs/.generated config baseline regenerated with pnpm config:docs:gen
- cli-backends.md: main's opaque-login paragraphs (openclaw#174457) now name the
  attestNativeLogin opt-in
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…5226)

* refactor(agents): consolidate maintenance facts and ownership

* test(agents): preserve maintenance mock exports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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