Skip to content

fix(agents): prevent false reminder warnings after compaction - #128581

Merged
steipete merged 1 commit into
mainfrom
codex/issue-43292
Aug 24, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-43292

Conversation

@steipete

@steipete steipete commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #43292

What Problem This Solves

Fixes an issue where users who successfully scheduled an isolated-session reminder would receive a contradictory "I did not schedule a reminder" warning when context compaction retried the same agent turn.

Why This Change Was Made

A successful cron addition is a committed, turn-wide side effect. Compaction can reset transient presentation state, but must preserve the recorded successful-add fact that the reminder guard consumes. The existing session-specific persisted-job check and unrelated-job isolation remain unchanged.

Maintainer scope decision: both concrete reproductions in #43292 require a successful current-turn cron add followed by compaction, and this change repairs both at the shared state owner. The issue's separate suggestion to match any prior isolated cron by agent ID is intentionally declined: an unrelated cron for the same agent would then suppress a truthful warning for another session, and there is no established persisted origin-session provenance contract. This preserves the issue review's existing recommendation to keep persisted-job matching session-specific while fixing and closing the actual reported same-turn bug.

User Impact

Successfully scheduled reminders no longer produce false unscheduled-reminder warnings after context compaction. Genuine unscheduled reminders and reminders belonging to unrelated sessions retain their existing safeguards.

Evidence

  • Strengthened the existing owner-boundary compaction regression to record a successful cron add, drain pending events, prove compaction actually retried, and verify the successful-add count remains 1.
  • Before the production fix, that regression fails with AssertionError: expected +0 to be 1; after the one-line deletion, it passes.
  • Four owner, cron-tool, compaction, and user-facing reminder test files passed: 364 tests.
  • Production type-check passed as part of the local changed-file gate.
  • The exact agent-owner test type shard passed: node scripts/run-tsgo.mjs -b test/tsconfig/tsconfig.core.test.agents-root.json --builders 1.
  • Focused lint passed for both changed files: node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts src/agents/embedded-agent-subscribe.ts.
  • The local changed-file gate passed 17 policy, formatting, and production-type checks, but its unrelated UI test shards hit existing missing @panzoom/panzoom/@types/pako dependencies and a pre-existing ui/src/pages/chat/route-loader.ts type error. Its optional dead-export scan was skipped with the documented OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1; this change adds no exports.
  • Independent source review and fresh Codex autoreview found no actionable issues.
  • ClawSweeper independently ran the owner suite twice with 88/88 tests passing each time. Its displayed live-verification failure is a reporter-only false negative: the harness searched standard Vitest output for an individual test title that the default reporter does not print; its own attached transcript shows both successful suite runs.
  • Exact-head hosted CI passed, including the required openclaw/ci-gate, all production and test type-check stripes, lint, policy guards, and relevant test shards.
  • Production diff: +0/-1; test diff: +7/-3.

@clawsweeper

clawsweeper Bot commented Aug 24, 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: XS maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 07:02
@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 Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 3:10 AM ET / 07:10 UTC.

ClawSweeper review

What this changes

The PR stops compaction retries from clearing successful cron-add evidence and strengthens the embedded-session regression test for that sequence.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review. The patch correctly preserves a successful cron-add fact through compaction, but the linked issue also describes a separate prior-turn isolated-session cron case that the unchanged session-key lookup does not cover.

Priority: P2
Reviewed head: 70c506c62485180952cee48328f6cd67ecdff0d3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a small owner-boundary repair with a credible focused regression test, pending the linked issue's scope decision.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body supplies a focused pre-/post-fix regression account.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body supplies a focused pre-/post-fix regression account.
Evidence reviewed 5 items Current-main defect: Current main clears the successful cron-add counter during compaction retry, even though the counter is later used as terminal delivery evidence.
Owner-to-consumer path: A completed cron add increments the subscription state; the runner carries that value into its result, and auto-reply suppresses the warning when it is positive.
Regression coverage: The PR test drains asynchronous events, confirms a successful cron add, triggers a retrying compaction event, and asserts the count remains one; the old current-main reset makes that assertion fail.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts

Result: FAIL (partial) — step 2 expect_output preserves successful cron evidence and liveness across compaction retries: expected terminal output was not visible within 30 seconds: "preserves successful cron evidence and liveness across compaction retries"

node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128581-DXFxUI/target$ node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.subscribe-embedded-agent-
session.subscribeembeddedagentsession.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts
[test] starting test/vitest/vitest.agents-core.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128581-DXFxUI/target

 ✓  agents-core  src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts (88 tests) 203ms

 Test Files  1 passed (1)
      Tests  88 passed (88)
   Start at  07:10:54
   Duration  9.01s (transform 7.04s, setup 683ms, import 7.89s, tests 203ms, environment 0ms)

[test] passed 1 Vitest shard in 12.97s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128581-DXFxUI/target$ node scripts/run-vitest.mjs src/agents/embedded-agent-subscribe.subscribe-embedded-agent-
session.subscribeembeddedagentsession.test.ts
[test] starting test/vitest/vitest.agents-core.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128581-DXFxUI/target

 ✓  agents-core  src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts (88 tests) 153ms

 Test Files  1 passed (1)
      Tests  88 passed (88)
   Start at  07:11:07
   Duration  3.64s (transform 2.04s, setup 263ms, import 3.07s, tests 153ms, environment 0ms)

[test] passed 1 Vitest shard in 7.25s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128581-DXFxUI/target$




















Assertions:

  • FAIL expect_output: preserves successful cron evidence and liveness across compaction retries

How this fits together

Embedded agent subscriptions collect tool outcomes while a turn runs; compaction resets transient presentation state before a retry. The final agent-run result passes successful cron evidence to the auto-reply reminder guard, which decides whether to append a warning to the user reply.

flowchart LR
  A[Successful cron tool event] --> B[Embedded agent subscription]
  B --> C[Compaction retry]
  C --> D[Reset presentation state]
  B --> E[Successful cron evidence]
  E --> F[Agent run result]
  F --> G[Reminder warning decision]
  G --> H[User reply]
Loading

Decision needed

Question Recommendation
Should this PR close #43292, or should that issue remain open for its prior isolated-session cron matching requirement? Keep the linked issue open: Treat this as the focused compaction fix and retain the prior isolated-session cron behavior as separately tracked work.

Why: The code fixes the compaction-reset path, but the issue also requests behavior outside this diff; only maintainers can decide whether that broader behavior remains required.

Before merge

  • Resolve merge risk (P2) - The unchanged session-key-only fallback leaves the linked issue's prior isolated-session cron scenario unresolved; the PR's closing syntax could retire that remaining work without an explicit scope decision.
  • Complete next step (P2) - A maintainer must decide whether the linked issue's remaining prior isolated-session cron scope should stay open; no mechanical repair is currently required on this PR.
Agent review details

Security

None.

PR surface

Source -1, Tests +4. Total +3 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 1 -1
Tests 1 7 3 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 7 4 +3

Review metrics

Metric Value Why it matters
Production versus test delta production -1; tests +7/-3 The fix removes a reset at the state owner while adding a focused compaction-order regression check.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the owner-boundary counter preservation as a scoped repair only if maintainers keep the prior isolated-session cron lookup question open, or explicitly decide that it is out of scope before the linked issue closes.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the owner-boundary counter preservation as a scoped repair only if maintainers keep the prior isolated-session cron lookup question open, or explicitly decide that it is out of scope before the linked issue closes.

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

Yes—source inspection gives a high-confidence path: create a successful cron add, deliver its pending event, then emit a retrying compaction event. Current main clears the count at that point; the PR regression directly observes the intended retained value.

Is this the best way to solve the issue?

Yes for the stated compaction defect: preserving the fact at the subscription owner is better than adding a downstream reminder-guard exception. It does not, however, settle the separate prior isolated-session cron lookup behavior in the linked issue.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The bug can append a contradictory reminder warning to a user reply but does not lose the scheduled cron job or make the runtime unavailable.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body supplies a focused pre-/post-fix regression account.

Label justifications:

  • P2: The bug can append a contradictory reminder warning to a user reply but does not lose the scheduled cron job or make the runtime unavailable.
  • 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: This is a maintainer-authored PR, so the external-contributor proof gate does not apply; its body supplies a focused pre-/post-fix regression account.

Evidence

What I checked:

Likely related people:

  • steipete: History and shortlog show sustained work across embedded subscription, tool-completion, and reminder-guard paths, including recent merged agent-session work. (role: recent area contributor; confidence: high; commits: 353b4b891615, 70c506c62485; files: src/agents/embedded-agent-subscribe.ts, src/agents/embedded-agent-subscribe.handlers.tools.completion.ts)
  • dongdong: History attributes the reminder-guard false-positive fix to this contributor, making them relevant to the remaining prior-cron lookup scope. (role: reminder-guard contributor; confidence: medium; commits: 54be942e6b77; files: src/auto-reply/reply/agent-runner-reminder-guard.ts)

Rank-up moves

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

  • Resolve whether the linked issue should remain open for prior isolated-session cron matching before allowing its closing syntax to take effect.

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 92a0749 into main Aug 24, 2026
311 checks passed
@steipete
steipete deleted the codex/issue-43292 branch August 24, 2026 07:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

[Bug]: Unscheduled reminder guard fires for isolated-session crons + counter lost during compaction

1 participant