Repository navigation
feat(gateway): system change history RPC and Ask OpenClaw recent-changes panel - #111286
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 4:56 AM ET / 08:56 UTC. Summary PR surface: Source +1228, Tests +791, Docs +14, Other +95. Total +2128 across 21 files. Reproducibility: yes. from source: insert records from the two scopes around a producer-clock rollback, and separately place many filtered records after an eligible record to reproduce incorrect ordering and repeated scan work. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Use the shared Do we have a high-confidence way to reproduce the issue? Yes, from source: insert records from the two scopes around a producer-clock rollback, and separately place many filtered records after an eligible record to reproduce incorrect ordering and repeated scan work. Is this the best way to solve the issue? No. The panel/RPC concept is plausible, but ordering by producer timestamps and not the shared insertion sequence fails the stated history contract; the cursor must also retain the raw scan frontier. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c26d3cfbd049. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1228, Tests +791, Docs +14, Other +95. Total +2128 across 21 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (1 earlier review cycle)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e389099b4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (command === "config") { | ||
| return "cli" as const; | ||
| } | ||
| return "unknown" as const; |
There was a problem hiding this comment.
Classify all CLI mutation commands as CLI
For first-party CLI mutations outside openclaw config, such as hooks enable and agents bind, the callers in src/cli/hooks-cli.ts:455 and src/commands/agents.commands.bind.ts:261 omit auditOrigin, so command is hooks or agents and this classifier falls through to unknown. The new panel therefore misattributes normal user-initiated CLI changes; recognize other OpenClaw CLI commands as cli while continuing to prefer explicit origins.
Useful? React with 👍 / 👎.
| function isWithinCollapseWindow(operationAt: number, configAt: number): boolean { | ||
| const delay = operationAt - configAt; | ||
| return delay >= 0 && delay <= COLLAPSE_MAX_DELAY_MS; |
There was a problem hiding this comment.
Collapse matching writes across clock rollback
When the wall clock steps backward between the config-write audit and the later operation audit, this directional subtraction is negative, so identical system-agent hash transitions are not collapsed and appear as duplicate changes. The write occurs inside the operation before appendSystemAgentAuditEntry (src/system-agent/operations-execution-helpers.ts:266-269), so causal insertion order remains valid even if payload timestamps regress; the collapse test should tolerate rollback within the intended 60-second window.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1cae48550
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function compareCandidates(left: ChangeCandidate, right: ChangeCandidate): number { | ||
| // History is insertion-ordered; display time may differ if a producer's clock skewed. | ||
| if (left.recordedAt !== right.recordedAt) { | ||
| return right.recordedAt - left.recordedAt; |
There was a problem hiding this comment.
Order merged journals by a genuine insertion clock
When either producer's wall clock rolls back, this does not provide the claimed insertion ordering: appendConfigAuditRecord* stores Date.parse(record.ts) as created_at (src/config/io.audit.ts:681-684), and appendSystemAgentAuditEntry likewise stores its payload timestamp (src/system-agent/audit.ts:44-48), so recordedAt is just another producer timestamp. Consequently, a later operation from one scope can be placed behind an earlier config write from the other scope, and page boundaries can present “newest first” history out of order. Fresh evidence beyond the existing collapse-window comment is that the ordering comparator itself consumes those timestamp-derived created_at values rather than an insertion-order field.
Useful? React with 👍 / 👎.
| return { | ||
| entries, | ||
| exhausted, | ||
| nextBeforeSequence: entries.at(-1)?.sequence ?? beforeSequence, | ||
| }; |
There was a problem hiding this comment.
Advance filtered scans to the actual raw-row frontier
When a capped scan finds at least one eligible row and then scans filtered rows, this returns the last eligible sequence instead of the final raw sequence assigned to beforeSequence. For example, one visible write followed by 999 observations consumes the full 1,000-row budget, but the next cursor starts immediately below the visible write and rereads all 999 observations. Sparse eligible rows can therefore make successive Load more requests repeatedly perform synchronous SQLite/JSON work that this frontier-tracking logic is intended to avoid; use the actual scanned frontier once all buffered eligible entries have been consumed.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…ges panel (openclaw#111286) * feat(gateway): system change history RPC and Ask OpenClaw recent-changes panel * test(gateway): fix journal fixtures, split custodian page tests, refresh docs map * chore: quiet lint on journal reader tests and custodian harness
…ges panel (openclaw#111286) * feat(gateway): system change history RPC and Ask OpenClaw recent-changes panel * test(gateway): fix journal fixtures, split custodian page tests, refresh docs map * chore: quiet lint on journal reader tests and custodian harness
Related: #110896
What Problem This Solves
The config change journal (#111147) records every config mutation — but nothing reads it. Operators still cannot see "what changed on my system, when, by whom" anywhere in the product.
Why This Change Was Made
Phase 3 of #110896:
openclaw.changes.list(additive gateway method,operator.admin, Swift/Kotlin protocol clients regenerated): merges thesystem-agent-auditandconfig-auditjournals newest-first into typedSystemChangeEntryrows (operation/config-write/external-edit, closed source union incl. argv-classified legacy writes). System-agent operations collapse with their matching config write (same hash transition within a 60s window) so one change shows once, enriched with its paths.nextCursorresume cheaply. Ordering is canonical store-insertion order; payload timestamps are display-only (skewed producer clocks cannot break the page contract).latest({limit, beforeSequence})bounded newest-first reads on the shared audit record store (no full-scope loads).docs/cli/openclaw.md(what is recorded, bounds, path-only privacy).User Impact
Ask OpenClaw now answers the most common ops mystery visually: who changed the config and when — including hand edits made while the gateway was offline, marked invalid when they broke validation.
Evidence
node scripts/run-vitest.mjs src/gateway/server-methods/system-changes.test.ts— 10 tests pass (merge/collapse/skip, argv classification, newest-first with suppression markers + causal window, clock-rollback ordering, frozen heads across pages, bounded-scan regression with counting store).node scripts/run-vitest.mjs ui/src/pages/custodian— 38 tests pass (gating, panel, cards, expansion, short-page Load more, refresh-on-reopen).node scripts/run-vitest.mjs src/infra/sqlite-audit-record-store.test.ts— 7 pass (latest()bounds).pnpm protocol:gen+:swift+:kotlin+pnpm protocol:check— clean;pnpm ui:i18n:baselinerun (en.ts only).