Skip to content

fix(openclaw): restore 2026.9 transcripts and instruction delivery - #794

Merged
NiveditJain merged 3 commits into
feat/audit-secret-leak-scannerfrom
fix/openclaw-2026-9-sqlite
Sep 12, 2026
Merged

fix(openclaw): restore 2026.9 transcripts and instruction delivery#794
NiveditJain merged 3 commits into
feat/audit-secret-leak-scannerfrom
fix/openclaw-2026-9-sqlite

Conversation

@chhhee10

@chhhee10 chhhee10 commented Sep 11, 2026

Copy link
Copy Markdown
Member

What changed

OpenClaw 2026.9.2 moved live transcripts from per-session JSONL files to a per-agent SQLite database. That caused both cloud ingestion and the local FailproofAI dashboard to stop seeing current OpenClaw sessions. This PR also restores model-visible instruct() behavior for OpenClaw PreToolUse policies.

Cloud collection / failproofaid

  • discovers agents/<agentId>/agent/openclaw-agent.sqlite for every OpenClaw profile
  • incrementally collects each session’s ordered transcript_events
  • resets cursor and transform state when OpenClaw rewrites a transcript generation
  • emits events compatible with the legacy JSONL collector so server-side deduplication remains stable
  • dynamically discovers new profiles without requiring a daemon restart

FailproofAI local dashboard

  • restores OpenClaw sessions in the Projects page
  • reads SQLite-backed sessions in the session viewer using the existing OpenClaw message/tool parser
  • keeps different OpenClaw profiles in separate projects by (agentId, channel)
  • uses local when OpenClaw has no channel metadata
  • merges SQLite sessions with legacy JSONL sessions without showing duplicate rows
  • exports SQLite event_json records as downloadable JSONL
  • honors OPENCLAW_STATE_DIR before OPENCLAW_HOME

OpenClaw instruct() enforcement

  • keeps existing organization policies and PreToolUse matchers unchanged
  • preserves OpenClaw's existing execBash canonicalization
  • emits a distinct permission: "instruct" verdict from the policy evaluator
  • delivers the instruction through OpenClaw's model-visible blockReason
  • temporarily interrupts only the first matching tool attempt
  • allows retries from the same OpenClaw run and policy for five minutes, preventing an advisory instruction from becoming an infinite block loop
  • keeps real deny() verdicts permanently blocking
  • clears retry state when the OpenClaw session ends

The temporary rejection is only the transport used to put the instruction in the model's context. Guardrail activity remains classified as instruct, and transcript/session ingestion is unchanged.

Backward compatibility

Both transcript formats are supported at the same time:

  • older OpenClaw versions continue using agents/<agentId>/sessions/<sessionId>.jsonl
  • OpenClaw 2026.9.2+ uses agents/<agentId>/agent/openclaw-agent.sqlite
  • when both stores contain the same (agentId, sessionId), SQLite wins because it is the live copy

Existing cloud policies do not need source changes. After release, machines only need to upgrade FailproofAI, run failproofai update, and restart each relevant OpenClaw gateway/profile so the packaged plugin is reloaded.

Release

Prepared as stable 1.0.4, including package/Cargo versions and CHANGELOG entries.

npm install -g failproofai@latest
failproofai update
openclaw gateway restart

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace
  • focused local-dashboard suite: 36 passed
  • OpenClaw policy/evaluator/canonicalization/integration suite: 270 passed
  • exact Zaum Invoice policy regression: matching Finance escalation returns instruct; unrelated Slack sends remain allowed
  • bunx tsc --noEmit
  • bun run lint — 0 errors; 4 existing <img> warnings
  • bun run test:e2e — 333 passed
  • clean stable tarball installed in oven/bun:latest; packaged CLI returned permission: "instruct" and packaged retry bridge interrupted once then allowed retry
  • full unit suite: 5,128 passed, 11 skipped; 7 unrelated local-only failures because this checkout's skip-worktree .codex/hooks.json is absent
  • read-only smoke test against a real OpenClaw 2026.9.2 database: two SQLite sessions discovered in the local Projects adapter, and one 48-record transcript rendered as 21 dashboard entries

Stack note

This PR currently targets #789 because the SQLite-reader hardening it uses lives on that branch. It can be retargeted to main after #789 merges.

Hermes review

Field Value
Status Approved
Reviewed commit f190591028c3ea866f5dd4d12d1c2a1c28205b44
Policy revision 1d8f31d926828f3bae215c58f5b35baa44acbff0
Model gpt-5.6-terra
Duration 509s
Updated 2026-09-11T21:50:07.307834705+00:00

Summary

One correctness issue found: ambiguous OpenClaw project slugs can make a valid agent/channel project inaccessible. Focused TypeScript tests and type checking pass in clean containers.

Changes

  • Adds SQLite-backed OpenClaw transcript collection alongside legacy JSONL.
  • Adds dashboard discovery, viewing, and export for SQLite sessions.
  • Adds OpenClaw PreToolUse instruct delivery with retry gating.

Validation

  • Passed docker run --rm -v /review/input/workspace:/src:ro -w /tmp oven/bun:latest sh -c 'cp -a /src workspace && cd workspace && bun install --frozen-lockfile >/dev/null && bunx vitest run __tests__/hooks/openclaw-instruct-retry-gate.test.ts __tests__/hooks/openclaw-invoice-instruct.test.ts __tests__/lib/openclaw-projects.test.ts __tests__/lib/openclaw-sessions.test.ts __tests__/lib/download-session.test.ts' — Focused OpenClaw policy, project, session, and download tests passed in an isolated clean install. (23s)
  • Passed docker run --rm -v /review/input/workspace:/src:ro -w /tmp oven/bun:latest sh -c 'cp -a /src workspace && cd workspace && bun install --frozen-lockfile >/dev/null && bunx tsc --noEmit' — TypeScript type check passed in an isolated clean install. (22s)
  • Skipped docker run --rm --network=none -v /review/input/workspace:/src:ro -w /tmp rust:1.97-bookworm sh -c 'cp -a /src workspace && cd workspace && RUSTUP_TOOLCHAIN=1.97.1-x86_64-unknown-linux-gnu cargo test --offline -p fpai-collect --test openclaw_source' — The isolated Rust container has no cached crates.io dependencies; fetching is unavailable under no-network validation isolation. (1s)

Findings

No blocking findings.

1 advisory finding
  • Medium/High Project slugs collide for valid agent/channel pairs — openClawProjectName builds openclaw-${agentId}-${channel}. The code explicitly permits hyphens in both values. Thus main-bot/telegram and main/bot-telegram both produce openclaw-main-bot-telegram. getOpenClawProjects emits both folders, but the [name] route resolves by that name and getOpenClawSessionsByEncodedName selects the first matching split, so one project's sessions cannot be opened. (lib/openclaw-projects.ts:141)

Open questions

None.

Policy overrides

None.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks @chhhee10 for your contribution to Failproof AI! 🙌

We'd love to discuss your PR and welcome you to our community.

Discord: https://discord.befailproof.ai/
Reddit: https://www.reddit.com/r/failproofai/

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ca49e77f-723d-4997-ba92-64ccf3450269

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hermes-exosphere

Copy link
Copy Markdown
Contributor

Hermes

Status Reviewing
Verdict Not reviewed yet
Head 9a4f12c94da4
Rounds 0 of 5

No summary yet.

What this changes

No component map for this revision.

Rounds

No review has finished on this pull request yet.

Findings

Nothing raised yet.


@hermes-exosphere help lists every command. This comment is maintained in place — I rewrite it after each review rather than posting a new one.

@hermes-exosphere

hermes-exosphere commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Hermes

Status Reviewed
Verdict Approved
Head f190591028c3
Rounds 0 of 5

One correctness issue found: ambiguous OpenClaw project slugs can make a valid agent/channel project inaccessible. Focused TypeScript tests and type checking pass in clean containers.

What this changes

flowchart LR
    n0OpenClawSQLitecollector["+ OpenClaw SQLite collector"]
    n1Collectortaskregistration["~ Collector task registration"]
    n2OpenClawpolicybridge["~ OpenClaw policy bridge"]
    n3DashboardSQLitereader["+ Dashboard SQLite reader"]
    n4OpenClawsessionbrowser["~ OpenClaw session browser"]
    n0OpenClawSQLitecollector -- "cursor state and batches" --> n1Collectortaskregistration
    n1Collectortaskregistration -- "roots and collection settings" --> n0OpenClawSQLitecollector
    n2OpenClawpolicybridge -- "instruct verdict and retry scope" --> n2OpenClawpolicybridge
    n3DashboardSQLitereader -- "sessions and event JSON" --> n4OpenClawsessionbrowser
Loading

Rounds

Round Reviewed Commits in this round Verdict
0 9a4f12c94da4 9a4f12c94da4 Approved
0 f52f11bc3f16 f52f11bc3f16 Approved
0 f190591028c3 f190591028c3 Approved

Findings

Open

  • F1 Project slugs collide for valid agent/channel pairs (lib/openclaw-projects.ts) — round 1

@hermes-exosphere help lists every command. This comment is maintained in place — I rewrite it after each review rather than posting a new one.

@hermes-exosphere hermes-exosphere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes found no blocking issues in this revision.

@hermes-exosphere hermes-exosphere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes found no blocking issues in this revision.

@hermes-exosphere hermes-exosphere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes found no blocking issues in this revision.

@chhhee10 chhhee10 changed the title fix(openclaw): restore transcripts after SQLite migration fix(openclaw): restore 2026.9 transcripts and instruction delivery Sep 11, 2026

@hermes-exosphere hermes-exosphere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes found no blocking issues in this revision.

1 advisory finding
  • Medium/High Project slugs collide for valid agent/channel pairs — openClawProjectName builds openclaw-${agentId}-${channel}. The code explicitly permits hyphens in both values. Thus main-bot/telegram and main/bot-telegram both produce openclaw-main-bot-telegram. getOpenClawProjects emits both folders, but the [name] route resolves by that name and getOpenClawSessionsByEncodedName selects the first matching split, so one project's sessions cannot be opened. (lib/openclaw-projects.ts:141)

@NiveditJain
NiveditJain merged commit 05423cf into feat/audit-secret-leak-scanner Sep 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants