Skip to content

fix(commitments): make dismissal atomic and truthful - #117591

Merged
steipete merged 2 commits into
mainfrom
codex/qa409-commitments-atomic-truth-owner
Aug 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa409-commitments-atomic-truth-owner

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators dismissing missing or already-terminal follow-up commitments were told every requested dismissal succeeded even when SQLite changed nothing. Commitment filters, database paths, and identifiers could also place terminal control sequences into human-readable CLI output.

Why This Change Was Made

The existing synchronous SQLite transaction now returns exactly the active commitment IDs it actually transitioned, preserving normalized first-seen request order. The CLI uses that authoritative result for truthful complete and partial outcomes, rejects unsuccessful requests, and sanitizes every affected human-readable value without changing successful JSON output, heartbeat behavior, storage schema, or SQL boundaries.

User Impact

Operators receive accurate dismissal results, clear explanations and nonzero exits for missing or already-terminal commitments, deterministic duplicate-free batches, and safe terminal output. Concurrent CLI processes cannot both claim ownership of the same dismissal; machine-readable successful responses continue to preserve the original raw IDs.

Evidence

  • 84 focused tests pass across the commitment store, CLI commands, heartbeat delivery and cron-monitor paths, and registered Commander dispatch.
  • A registered CLI against an isolated real SQLite database verifies missing, terminal, mixed, duplicate, hostile-control-character, and raw-JSON cases.
  • Two independent operating-system processes simultaneously raced for the same SQLite row: exactly one returned a successful dismissal; the other returned a truthful structured failure with exit code 1.
  • The production JSON-routing wrapper and registered CLI were exercised with separate real stdout and stderr pseudo-terminals: failure stdout remained valid escape-free JSON while terminal-reset bytes were emitted only on stderr.
  • Forced-color terminal proof preserved intentional theme ANSI while removing injected OSC, BEL, CSI, and newline controls.
  • Type-aware lint and type checking, formatting validation, and genuine TruffleHog 3.96 scanning passed with zero detected secrets.
  • Five independent hostile reviews found no P0–P3 issues, and formal gpt-5.6-sol high-reasoning autoreview returned zero findings with 0.98 confidence.

Directly inspectable production evidence from the registered Commander path, an isolated real SQLite database, and two independent operating-system processes:

{
  "listHumanSanitized": true,
  "listJsonRawPreserved": true,
  "nonexistentDismissTruthful": true,
  "terminalDismissTruthful": true,
  "mixedDismissTruthful": true,
  "dismissHumanSanitized": true,
  "dismissJsonRawPreserved": true,
  "missingDismissJsonTruthful": true,
  "richThemeAnsiPreserved": true,
  "independentProcessRace": [
    { "label": "A", "code": 0, "json": { "dismissed": ["cm_real_os_process_race"] } },
    { "label": "B", "code": 1, "json": { "dismissed": [], "notDismissed": ["cm_real_os_process_race"] } }
  ]
}

The production JSON-routing wrapper also passed against independent real stdout/stderr pseudo-terminals: failure stdout contained valid escape-free JSON and terminal reset bytes appeared only on stderr. The complete public evidence is available in #117591 (comment).

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 19:23
@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. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 4:28 PM ET / 20:28 UTC.

ClawSweeper review

What this changes

The branch makes commitment dismissal return only the active records SQLite actually changes, reports skipped IDs and a nonzero exit for partial failures, sanitizes affected human terminal output, and documents the JSON result contract.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer handling. The prior documentation finding is resolved, and the current patch correctly makes the CLI report the IDs actually transitioned by SQLite; no new actionable patch defect was found. The protected maintainer label also requires explicit maintainer handling rather than automated cleanup.

Priority: P2
Reviewed head: 1c3b0b3a29e400328160ed66010231fa8d63ad3b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong direct behavior evidence and a focused owner-boundary repair support a normal mergeable-quality rating; the remaining compatibility consideration is documented and intentional.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied PR body and linked contributor evidence describe after-fix registered-CLI runs against an isolated real SQLite store, including a two-process race and separated stdout/stderr terminal proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied PR body and linked contributor evidence describe after-fix registered-CLI runs against an isolated real SQLite store, including a two-process race and separated stdout/stderr terminal proof.
Evidence reviewed 8 items Current-main defect: Current main awaits the transition but always prints the normalized requested IDs as dismissed, while the store selects only active rows; missing or terminal records can therefore be reported as successful without a database change.
Canonical owner-boundary repair: The branch returns IDs from the same shared immediate SQLite write transaction that filters active rows and applies updates, preserving normalized request order rather than making the CLI infer success.
Previous review finding addressed: The follow-up commit documents complete and partial JSON dismissal results, including notDismissed and exit status 1 when one or more requested IDs remain unchanged.
Findings None None.
Security None None.

How this fits together

Commitments are scheduled follow-up records held in OpenClaw’s shared SQLite state database. The commitments CLI submits requested IDs to that store, then renders the authoritative outcome for terminal users or JSON-consuming scripts.

flowchart LR
  A[Operator dismissal request] --> B[Commitments CLI]
  B --> C[Normalize unique IDs]
  C --> D[Immediate SQLite write transaction]
  D --> E[Actually transitioned IDs]
  E --> F[Human or JSON result]
  F --> G[Script exit status]
Loading

Before merge

  • Resolve merge risk (P1) - The intentionally changed partial-dismissal contract returns notDismissed and exit status 1, so main-branch scripts that assumed every dismissal invocation succeeded must handle that explicit result.
  • Complete next step (P2) - The PR is active, has no discrete repair finding, and carries the protected maintainer label, so normal maintainer/check gating should decide landing.
Agent review details

Security

None.

PR surface

Source +26, Tests +153, Docs +26. Total +205 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 47 21 +26
Tests 2 153 0 +153
Docs 1 26 0 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 226 21 +205

Review metrics

Metric Value Why it matters
Dismissal CLI contract 1 changed command result contract Partial dismissal now reports notDismissed and exits 1, which makes the operational outcome explicit to scripts.

Merge-risk options

Maintainer options:

  1. Keep the documented result contract (recommended)
    Retain the partial-failure JSON result and status 1 because it prevents scripts and operators from treating unchanged commitments as dismissed.

Technical review

Best possible solution:

Merge the documented authoritative-result design after ordinary required-check and maintainer gates, keeping successful JSON raw while making partial and no-op dismissals explicit failures.

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

Yes — current main always reports normalized input IDs as dismissed after calling a store function that only updates active rows. The branch adds focused regressions for missing, inactive, duplicate, and competing requests.

Is this the best way to solve the issue?

Yes — returning the transaction’s authoritative IDs repairs the state owner rather than reconstructing success downstream, and the added CLI documentation makes the new observable contract explicit.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied PR body and linked contributor evidence describe after-fix registered-CLI runs against an isolated real SQLite store, including a two-process race and separated stdout/stderr terminal proof.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This fixes misleading operational output for a bounded CLI command without evidence of a release-blocking outage.
  • merge-risk: 🚨 compatibility: Consumers of the main-only command must handle a truthful partial-result shape and nonzero exit where they previously saw unconditional success.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied PR body and linked contributor evidence describe after-fix registered-CLI runs against an isolated real SQLite store, including a two-process race and separated stdout/stderr terminal proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied PR body and linked contributor evidence describe after-fix registered-CLI runs against an isolated real SQLite store, including a two-process race and separated stdout/stderr terminal proof.

Evidence

What I checked:

  • Current-main defect: Current main awaits the transition but always prints the normalized requested IDs as dismissed, while the store selects only active rows; missing or terminal records can therefore be reported as successful without a database change. (src/commands/commitments.ts:155, 6c9cb8e04d4d)
  • Canonical owner-boundary repair: The branch returns IDs from the same shared immediate SQLite write transaction that filters active rows and applies updates, preserving normalized request order rather than making the CLI infer success. (src/commitments/store.ts:408, 1c3b0b3a29e4)
  • Previous review finding addressed: The follow-up commit documents complete and partial JSON dismissal results, including notDismissed and exit status 1 when one or more requested IDs remain unchanged. Public docs: docs/cli/commitments.md. (docs/cli/commitments.md:89, 1c3b0b3a29e4)
  • Focused regression coverage: Branch tests cover ordered active-row results, missing and terminal IDs, duplicate normalization, competing transitions, partial JSON failure, and safe human rendering while successful JSON preserves raw IDs. (src/commitments/store.test.ts:292, 1c3b0b3a29e4)
  • Terminal safety contract: The patch uses the existing sanitizer for human-facing values; it strips ANSI/control sequences and escapes line controls while JSON remains intentionally raw. (packages/terminal-core/src/safe-text.ts:7, 6c9cb8e04d4d)
  • Feature provenance: Current-main blame shows the original commitments command and status transition entered this codebase together in commit 951f130; the PR repairs that existing behavior rather than adding a parallel path. (src/commands/commitments.ts:141, 951f13023d7f)

Likely related people:

  • Dallin Romney: The current-main commitment store and CLI dismissal implementation both trace to the same original feature commit. (role: introduced current commitment behavior; confidence: high; commits: 951f13023d7f; files: src/commitments/store.ts, src/commands/commitments.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-01T19:28:43.423Z sha d6370a9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T20:06:36.363Z sha d6370a9 :: needs changes before merge. :: [P2] Document the changed partial-dismissal CLI contract

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Directly inspectable production behavior

The reviewed commit was exercised through the production registered Commander path against an isolated real SQLite store. Human output was sanitized without altering raw JSON, nonexistent and terminal commitments were truthfully reported, and a real two-process race admitted exactly one successful dismissal:

{
  "listHumanSanitized": true,
  "listJsonRawPreserved": true,
  "invalidStatusSanitized": true,
  "nonexistentDismissTruthful": true,
  "terminalDismissTruthful": true,
  "mixedDismissTruthful": true,
  "dismissHumanSanitized": true,
  "dismissJsonRawPreserved": true,
  "skippedDismissSanitized": true,
  "missingDismissJsonTruthful": true,
  "richThemeAnsiPreserved": true,
  "independentProcessRace": [
    { "label": "A", "code": 0, "json": { "dismissed": ["cm_real_os_process_race"] } },
    { "label": "B", "code": 1, "json": { "dismissed": [], "notDismissed": ["cm_real_os_process_race"] } }
  ]
}

The actual production JSON-routing wrapper was additionally verified with separate real stdout/stderr PTYs: failure JSON stayed parseable and ANSI-free on stdout while the terminal reset went to stderr. Four focused owner/caller shards passed all 84 tests.

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed 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. labels Aug 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 1, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 1, 2026
@steipete
steipete merged commit d0b362f into main Aug 1, 2026
195 of 205 checks passed
@steipete
steipete deleted the codex/qa409-commitments-atomic-truth-owner branch August 1, 2026 20:54
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* fix(commitments): report atomic dismissals truthfully

* docs(commitments): explain dismissal JSON results

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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