Skip to content

refactor(reply): converge queued follow-up execution [AI-assisted] - #114599

Merged
steipete merged 40 commits into
mainfrom
codex/followup-runner-convergence
Jul 27, 2026
Merged

steipete merged 40 commits into
mainfrom
codex/followup-runner-convergence

Conversation

@steipete

@steipete steipete commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Queued follow-up turns had accumulated a second copy of the agent execution, fallback, terminal settlement, accounting, progress, and delivery logic. That duplicate path had drifted from foreground turns and made lifecycle races, session rotation, source visibility, and cross-channel delivery substantially harder to reason about and test.

Why This Change Was Made

This maintainer-requested redesign makes queued turns a thin adapter into the canonical agent-runner-* execution pipeline. Follow-up-specific ownership is now limited to admission, progress projection, final delivery decisions, and unconditional cleanup; foreground and queued turns share candidate execution, fallback settlement, and result accounting.

The refactor intentionally adds no config, environment, protocol, plugin SDK, SQLite schema, compatibility alias, fallback execution path, or durable pending-final marker. Local/non-routable queued items retain the latest-live-dispatcher contract.

The existing restart-loss window remains: execution and accounting can complete before the turn enters routeReply / sendDurableMessageBatch. This PR preserves the current durable transport contract and does not add a second pending-final marker; any stronger recovery contract should be a separate design and proof track.

User Impact

There is no intended user-visible behavior change. Queued turns now receive the same canonical runtime behavior as foreground turns while preserving room-event silence, message-tool-only privacy, one-shot stranded recovery, cross-channel non-misdelivery, queue restoration, session-generation fencing, progress ordering, and typing cleanup.

Evidence

  • Post-rebase focused proof: 11 files / 334 tests passed across follow-up admission, execution, delivery, runner, canonical execution, foreground finalization, and route delivery, followed by focused regressions for every review/CI fix.
  • Queue aggregate shared-state failures were isolated; each failing queue file passed alone.
  • Blacksmith Testbox changed gates repeatedly reached and passed formatting, repository guards, full typecheck, lint, and zero runtime import cycles on the implementation stack; final test-shape corrections are covered by exact-head PR CI.
  • Exact-head CI is green on c217e02c3f5: https://github.com/openclaw/openclaw/actions/runs/30286041559
  • Final branch autoreview and focused fixup reviews were run until no in-scope accepted/actionable findings remained. The remaining request for a durable post-execution resume record was rejected because the maintainer explicitly deferred that contract from this refactor.
  • followup-runner.ts is 177 lines of composition/cleanup, both max-lines entries are removed, production LOC is net -176, and test LOC is net -4,295.

AI-assisted: yes. The implementation and review loop were performed with Codex under maintainer direction.

@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete force-pushed the codex/followup-runner-convergence branch from 9c49543 to c5ba11e Compare July 27, 2026 13:57
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:54 PM ET / 18:54 UTC.

ClawSweeper review

What this changes

The PR refactors queued follow-up replies to use the shared agent-turn execution pipeline while retaining queued admission, delivery, and cleanup behavior.

Merge readiness

⛔ Blocked until real behavior proof is added - 6 items remain

The environment denied the required read-only inspection command before repository policy, PR diff, and current-main behavior could be verified, so no safe merge or close conclusion is possible.

Priority: P2
Reviewed head: 2a73a89da285cccfc1ac3848b61d0bbe94a580a0
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The proposed refactor has substantial stated validation, but it lacks inspectable after-fix real behavior proof and could not receive the required independent source review.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The supplied PR body reports tests and CI but no inspectable after-fix queued-follow-up transcript, runtime log, terminal output, recording, or linked artifact; add redacted real behavior proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The supplied PR body reports tests and CI but no inspectable after-fix queued-follow-up transcript, runtime log, terminal output, recording, or linked artifact; add redacted real behavior proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 2 items Inspection environment failure: The first required read-only command to read the repository AGENTS.md and selected skill instructions failed before producing repository content: bwrap loopback setup was not permitted.
Provided PR context: The provided context describes a 45-file queued-follow-up refactor that changes execution-result settlement, queued delivery, and lifecycle accounting; it also shows the PR is labeled maintainer and has incomplete checks.
Findings None None.
Security Needs attention Complete the source-level security review: The environment prevented inspection of the branch and matching maintainer notes, so no reliable supply-chain or sensitive-runtime assessment is possible yet.

How this fits together

Queued follow-up turns are delayed agent replies that enter through the reply queue, execute an agent turn, then project progress and deliver results to the originating channel. This PR changes the boundary between queued orchestration and the shared agent execution pipeline.

flowchart LR
  A[Queued follow-up] --> B[Admission and session fence]
  B --> C[Shared agent execution]
  C --> D[Accounting and terminal settlement]
  D --> E[Queued delivery decision]
  E --> F[Originating channel or dispatcher]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled queued-reply refactor wait for a completed independent review after the review environment is restored? Wait for restored review: Re-run the required source, history, proof, and maintainer-note review before any merge decision.

Why: The environment prevented the mandatory repository-policy and source inspection needed to assess a large runtime refactor safely.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The supplied PR body reports tests and CI but no inspectable after-fix queued-follow-up transcript, runtime log, terminal output, recording, or linked artifact; add redacted real behavior proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security concern: Complete the source-level security review - The environment prevented inspection of the branch and matching maintainer notes, so no reliable supply-chain or sensitive-runtime assessment is possible yet.
  • Resolve merge risk (P1) - The refactor changes queued execution, settlement, session fencing, and final delivery across a large surface; without inspecting current code, tests, matching maintainer notes, and exact-head proof, correctness and upgrade behavior cannot be established.
  • Resolve merge risk (P1) - The provided context still shows several exact-head checks in progress, so the final validation state is not yet known.
  • Complete next step (P2) - Mandatory read-only repository inspection was denied, so the large runtime refactor needs a human or restored-environment review rather than automated repair.

Findings

  • [low] Complete the source-level security review
Agent review details

Security

Needs attention: No concrete security defect is established, but the dedicated source-level security and supply-chain pass could not be completed because read-only inspection was blocked.

PR surface

Source -112, Tests -4248, Other -2. Total -4362 across 45 files.

View PR surface stats
Area Files Added Removed Net
Source 16 2098 2210 -112
Tests 27 3054 7302 -4248
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 3 -2
Total 45 5153 9515 -4362

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Complete source and behavior review (recommended)
    Keep the PR open until the queued delivery and session-settlement paths can be inspected and proven against the current head.
  2. Pause for manual maintainer review
    If the review environment remains unavailable, defer the runtime merge decision to a maintainer with direct source and test access.

Technical review

Best possible solution:

Re-run a full read-only review once repository reads work: inspect scoped policy, maintainer notes, current-main and branch paths, prior-review deltas, exact-head checks, and a redacted real queued-follow-up runtime transcript before deciding merge readiness.

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

Unclear: the supplied context describes focused tests and CI but no independently inspectable current-head real queued-follow-up transcript; the required repository review command could not run.

Is this the best way to solve the issue?

Unclear: the proposed convergence may be the right ownership direction, but current callers, siblings, tests, and maintainer decisions could not be independently inspected.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against e1e62f2a6e99.

Labels

Label justifications:

  • P2: This is a broad internal reply-runtime refactor with no reported confirmed user-facing outage in the supplied context.
  • merge-risk: 🚨 message-delivery: The PR changes the queued final-delivery decision and routing path for follow-up replies.
  • merge-risk: 🚨 session-state: The PR changes follow-up admission, generation fencing, session refresh, and terminal settlement.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The supplied PR body reports tests and CI but no inspectable after-fix queued-follow-up transcript, runtime log, terminal output, recording, or linked artifact; add redacted real behavior proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [low] Complete the source-level security review
    The environment prevented inspection of the branch and matching maintainer notes, so no reliable supply-chain or sensitive-runtime assessment is possible yet.
    Confidence: 0.99

What I checked:

  • Inspection environment failure: The first required read-only command to read the repository AGENTS.md and selected skill instructions failed before producing repository content: bwrap loopback setup was not permitted. (AGENTS.md)
  • Provided PR context: The provided context describes a 45-file queued-follow-up refactor that changes execution-result settlement, queued delivery, and lifecycle accounting; it also shows the PR is labeled maintainer and has incomplete checks. (src/auto-reply/reply/followup-runner.ts, 2a73a89da285)

Likely related people:

  • steipete: The supplied PR history attributes all listed queued-follow-up refactor and follow-up fixes to steipete, but independent current-main history could not be inspected. (role: recent area contributor; confidence: low; commits: 36aa3b610b36, 2a73a89da285; files: src/auto-reply/reply/followup-runner.ts, src/auto-reply/reply/agent-runner-execution.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted current-head queued-follow-up runtime transcript, terminal output, recording, or runtime log that shows the improved behavior.
  • Re-run the read-only review after repository inspection is available and exact-head checks complete.

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 (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-27T16:01:58.497Z sha 6d9b2668e456c1ce7a8512ad849cd2a0b2bc05ec :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T16:21:37.042Z sha 480fab9dd989134f8934848cf9a132f30d0606d3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T16:34:29.812Z sha 409321927705a280f72dc98d5c65b309bfca9cb0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T16:48:23.411Z sha c217e02c3f5abc31156382da0ab37c3ff31d7e37 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T17:05:17.330Z sha c217e02c3f5abc31156382da0ab37c3ff31d7e37 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T17:23:13.889Z sha ffa62cb027943055b1ebeda8b5c45670cdbb1de4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T18:09:39.157Z sha 0a91d2a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-27T18:25:28.243Z sha 5216d14 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels Jul 27, 2026
@steipete steipete self-assigned this Jul 27, 2026
@steipete
steipete force-pushed the codex/followup-runner-convergence branch 3 times, most recently from c9a5e24 to 497fa43 Compare July 27, 2026 18:02
@steipete
steipete deleted the codex/followup-runner-convergence branch July 27, 2026 19:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 28, 2026
…penclaw#114599)

* refactor(reply): converge queued follow-up execution

* fix(reply): preserve follow-up lifecycle invariants

* fix(reply): fence follow-up admission generation

* fix(reply): reconcile follow-up preflight state

* fix(reply): fence persisted follow-up generation

* fix(reply): defer follow-up compaction terminal notices

* style(reply): format follow-up admission

* fix(reply): normalize follow-up session metadata

* fix(reply): fence in-memory follow-up generation

* test(reply): satisfy follow-up lint contracts

* fix(reply): revalidate failed follow-up preflight

* fix(reply): reject deleted follow-up generation

* fix(reply): release restart-aborted operations

* test(reply): avoid unbound operation assertion

* fix(reply): refresh follow-up presentation state

* test(reply): use canonical plan update shape

* fix(reply): harden follow-up progress delivery

* fix(reply): synchronize recovered follow-up operation

* test(reply): mark partial operation fixture

* fix(reply): adopt owned preflight rotations

* docs(reply): clarify restart settlement guard

* test(reply): preserve terminal notice call count

* refactor(reply): remove retired follow-up exports

* test(reply): prove dispatcher-only follow-up routing

* chore(reply): remove stale delivery type import

* fix(reply): finalize follow-up cleanup and failure delivery

* fix(reply): prefer authoritative admission snapshot

* fix(reply): avoid replay on progress failure

* fix(reply): retain suppressed-mode terminal failures

* fix(reply): preserve follow-up session context

* fix(reply): preserve exclusive delivery and deleted state

* fix(reply): prevent post-start follow-up replay

* fix(reply): prioritize safe follow-up failure delivery

* fix(reply): signal follow-up execution after start

* fix(reply): harden follow-up settlement

* refactor(reply): keep session clear internal

* fix(reply): consume pre-run user aborts

* fix(reply): retain progress delivery failure

* fix(ci): register codex prewarm test shard

* test(reply): retain operation mock type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant