Repository navigation
[codex] Link heartbeat commitment questions to replies - #81382
Countermarch wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 5, 2026, 12:08 AM ET / 04:08 UTC. ClawSweeper reviewWhat this changesThe PR stores delivered inferred-commitment heartbeat questions for the next user turn and dismisses inferred follow-ups when later conversation evidence resolves them. Merge readiness⛔ Blocked until stronger real behavior proof is added - 10 items remain Close this stale PR as superseded: Pause for retirement confirmation. Priority: P3 Review scores
Verification
How this fits togetherInferred commitments formerly extracted follow-up ideas from a conversation and delivered them later through heartbeat. A subsequent user reply enters the active embedded agent runner, which assembles prompt context before the model responds. flowchart LR
A[Conversation turn] --> B[Inferred commitment extraction]
B --> C[Commitment feature gate]
C --> D[Heartbeat delivery]
D --> E[Session context]
E --> F[User-turn prompt]
F --> G[Agent response]
Decision needed
Why: Current docs and configuration intentionally disable the feature, so porting this PR would reintroduce user-facing behavior and retired persistence rather than repair an established active contract. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +358, Tests +242. Total +600 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Close this stale PR as superseded: Pause for retirement confirmation. Do not rebase or merge until an owner confirms that reviving inferred commitments is intended; otherwise close the obsolete branch. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes the branch defects: it modifies a removed prompt path and treats the durable sender’s suppressed result as delivered. No current-main runtime execution was performed because this is a read-only review. Is this the best way to solve the issue? No. Current main deliberately retires inferred commitments; reviving them requires explicit sponsorship and a new implementation on the active runner and storage owners, not a rebase of this branch. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9214e6381d49. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
Updated the stale PR branch with a no-code refresh commit: I also attempted the full branch update against current
Validation from the isolated merge checkout:
I could not push the full The previous real-behavior-proof limitation still stands: this update revalidated the branch and local merge path, but it does not add live Telegram/equivalent transport proof. |
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIFs showing the follow-up reply changes after pending question context is linked.
Motion-trimmed clips: |
|
I mined a local Redacted local evidence:
What is still missing before this should satisfy the June 30 ClawSweeper asks:
This local proof pack is redacted because the raw evidence contains private Telegram/session identifiers and private message text. The public-safe evidence above is the portion I would rely on for maintainer review. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Still active; please keep this PR open. The underlying heartbeat reply-linkage and stale inferred-follow-up problems remain relevant, and the redacted local evidence previously posted still supports both bug shapes. The remaining work is unchanged: repair/rebase onto the active runner path, serialize commitment dismissal writes under the store queue, preserve suppressed-send retry semantics, rerun the focused checks, and refresh the post-repair Telegram proof. I’m retaining the PR for that follow-through and am not claiming those repairs are complete yet. |
|
Closing this as superseded by the commitments retirement in #121479 ( OpenClaw deliberately removed inferred commitment extraction, persistence access, heartbeat delivery, the CLI, and the associated docs/tests. This branch targets deleted runner and commitment-store paths, so rebasing it would revive a retired product surface rather than repair current behavior. For explicit reminders, the supported path is a scheduled task/cron job. If inferred follow-up commitments are ever reconsidered, that needs a new product decision and a fresh implementation against the current embedded runner and canonical state owners rather than reopening this obsolete branch. Thank you for the substantial investigation and proof work here, @Countermarch. |




Summary
This PR fixes the architectural gap where inferred commitment heartbeats can ask open-ended questions from a proactive heartbeat session, while the user's later answer lands in the target conversation without durable context tying it back to that question.
It now covers both failure modes from the reports:
Root Cause
Heartbeat commitment delivery can happen in an isolated heartbeat run. The visible proactive question is transcript-only delivery state, and replay intentionally filters
openclaw/delivery-mirrorassistant messages before model calls. That means a later user response can be replayed without the assistant question that prompted it unless the transport provides reply metadata.A second gap existed upstream: extraction could infer an open-loop follow-up before later turns completed and verified the work, but there was no pre-delivery resolution pass against existing pending commitments.
Approach
SessionHeartbeatPendingQuestion/heartbeatPendingQuestionsto session state.trigger: "user"prompt builds.resolvedentries for existing pending commitments closed by the latest exchange.existingPendingdedupe keys and confidence threshold.ClawSweeper / Review Notes
This is intentionally architectural, not wording-only. It avoids depending on Telegram reply context, gives the next ordinary user turn a durable resolution path, and prevents stale inferred commitments from reaching heartbeat delivery when later verified completion has already closed the loop.
The PR branch was fast-forwarded with the resolution-pass commit on top of the existing pending-question fix.
Current PR head:
b329e57e77fbed0b103cefe726a973797dd8d6cc.Real behavior proof
Behavior or issue addressed: Durable pending-question linkage for proactive commitment questions. A delivered heartbeat question is persisted on the target session with source metadata, then drained into the next user-turn prompt context exactly once.
Real environment tested: Local OpenClaw source checkout
/Users/jeeves/openclaw, branchcodex/commitment-pending-question-context, headb329e57e77, Node v26.0.0 withtsx, disposable temp session store under/tmp/openclaw-pending-question-proof-REDACTED/sessions.json. No Telegram/network send and no live user session data were used for this proof.Exact steps or command run after this patch:
OPENCLAW_CONFIG_PATH=/tmp/openclaw-proof-missing-config.jsonto avoid reading the live installed config.sessions.jsonentry foragent:main:telegram:user-155462274.src/config/sessions/pending-question-context.tsvianode --import tsx.enqueueHeartbeatPendingQuestion(...)with redacted May 9-style commitment/source metadata.drainHeartbeatPendingQuestionContext(...)for the same session and read the store again.Evidence after fix:
{ "enqueued": true, "queuedText": "Want me to check your Mega Millions ticket from last night?", "queuedCommitmentIds": ["cm_demo"], "queuedSourceMessageIds": ["14517"], "contextIncludesQuestion": true, "contextMentionsInternalSuppression": true, "queueAfterDrain": null, "tempSessionStore": "/tmp/openclaw-pending-question-proof-REDACTED/sessions.json" }Observed result after fix: The enqueue path returned
true, the pending question persisted with the source message id, the drained context included the original proactive question plus the instruction to hide internal heartbeat/commitment machinery, and the subsequent store read showedqueueAfterDrain: null, proving one-shot drainage for the next user turn.What was not tested: This proof did not send a real Telegram message or inspect a real lottery ticket image. Physical transport delivery remains covered by the existing heartbeat outbound path; this PR targets the missing durable reply-linkage layer after successful delivery.
Behavior or issue addressed: Inferred commitments are resolved before delivery when later same-session evidence shows the loop is already complete, matching the Gmail reauth false-positive pattern.
Real environment tested: Local OpenClaw source checkout
/Users/jeeves/openclaw, branchcodex/commitment-pending-question-context, headb329e57e77, Node v26.0.0 withtsx, disposable commitment store underOPENCLAW_STATE_DIR=$(mktemp -d). No live installed commitment store and no Gmail account credentials were read.Exact steps or command run after this patch:
OPENCLAW_STATE_DIRto a disposable temp directory.cm_mp4j2jsy_9a9a2f424eand dedupe keygmail-reauth:[email protected].persistCommitmentExtractionResult(...)fromsrc/commitments/extraction.tsvianode --import tsx.resolvedentry for the same dedupe key.Evidence after fix:
{ "proof": "resolved pending inferred Gmail reauth commitment before delivery", "createdCount": 0, "finalCommitments": [ { "id": "cm_mp4j2jsy_9a9a2f424e", "dedupeKey": "gmail-reauth:[email protected]", "status": "dismissed", "dismissedAtMs": 1778752800000, "suggestedText": "Did the gog Gmail reauth go through for [email protected]?" } ] }Observed result after fix: The pending inferred follow-up was dismissed before delivery, and
createdCount: 0proves the repeated same-key candidate was not recreated in the same extraction pass.What was not tested: This proof did not run a live Gmail OAuth flow. It exercises the OpenClaw commitment extraction/persistence path that decides whether an already-completed inferred follow-up remains eligible for heartbeat delivery.
Validation
CI=true pnpm test src/commitments/extraction.test.ts src/commitments/runtime.test.ts src/infra/heartbeat-runner.commitments.test.ts src/agents/pi-embedded-runner/run/attempt.prompt-helpers.test.tsCI=true pnpm check:changed