Skip to content

fix(scanner): include OpenClaw auto-archived subagent transcripts in scan#342

Merged
junhoyeo merged 1 commit into
junhoyeo:mainfrom
baanish:fix/openclaw-deleted-jsonl-scan
Mar 19, 2026
Merged

fix(scanner): include OpenClaw auto-archived subagent transcripts in scan#342
junhoyeo merged 1 commit into
junhoyeo:mainfrom
baanish:fix/openclaw-deleted-jsonl-scan

Conversation

@baanish

@baanish baanish commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • match OpenClaw's auto-archived subagent transcripts (<uuid>.jsonl.deleted.<ts>) via a dedicated *.jsonl* scan pattern

Why

OpenClaw renames completed subagent transcripts from <uuid>.jsonl to <uuid>.jsonl.deleted.<timestamp>, which falls outside the *.jsonl glob. These files stay on disk with full usage data but are invisible to tokscale's scanner.

Rather than broadening the shared *.jsonl arm (which would affect every JSONL-based client), this adds an OpenClaw-specific *.jsonl* pattern.

Diff scope

  • add a *.jsonl* pattern arm in scan_directory that matches both .jsonl and .jsonl.deleted.*
  • set OpenClaw's client pattern to *.jsonl* in clients.rs
  • fix parse_openclaw_transcript to use split_once(".jsonl") instead of file_stem(), which incorrectly extracts uuid.jsonl.deleted as the session ID for archived transcripts

Test proof

  • cargo fmt --all --check
    • passed
  • cargo test -p tokscale-core
    • 377 passed, 0 failed, 1 ignored
  • cargo clippy -p tokscale-core --all-features -- -D warnings
    • passed

Verification-pack proof

Not applicable — scanner behavior change only.

Migration notes

Not applicable — no schema or data migration.

Rollback plan

  • if merged with a merge commit: git revert <merge_commit_sha>
  • if merged as a squash commit: git revert <squash_commit_sha>
  • no DB downgrade required

Known residual risks

  • if OpenClaw introduces additional suffixed variants beyond .deleted, the contains(".jsonl.deleted.") check would need updating

Related


Summary by cubic

Include OpenClaw’s auto-archived subagent transcripts in scans by matching <uuid>.jsonl.deleted.<ts> files. Adds an OpenClaw-specific *.jsonl* pattern and fixes session ID parsing to attribute archived transcripts correctly.

  • Bug Fixes
    • Scanner: add *.jsonl* arm to match .jsonl and .jsonl.deleted.*, used only for OpenClaw.
    • Clients: set OpenClaw pattern to *.jsonl* under .openclaw/agents.
    • Parsing: use split_once(".jsonl") in parse_openclaw_transcript to extract the UUID instead of file_stem().

Written for commit 6795d0d. Summary will update on new commits.

…scan

OpenClaw renames completed subagent transcripts from <uuid>.jsonl to
<uuid>.jsonl.deleted.<timestamp>. These files were missed by the *.jsonl
glob. Add a *.jsonl* pattern for OpenClaw and fix session ID extraction
to handle the suffixed filenames.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vercel

vercel Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

@baanish is attempting to deploy a commit to the Inevitable Team on Vercel.

A member of the Team first needs to authorize it.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 3 files


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

@junhoyeo junhoyeo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM — clean, well-scoped fix. Pattern matching is properly constrained to OpenClaw only, session ID parsing fix is correct. Ship it.

@junhoyeo
junhoyeo merged commit f0810ff into junhoyeo:main Mar 19, 2026
3 of 4 checks passed
junhoyeo added a commit that referenced this pull request Mar 24, 2026
The #342 audit found the scanner and parser implementation working, but
not protected by regression coverage for auto-archived transcript
filenames. Add focused tests for `.jsonl.deleted.<timestamp>` files so
OpenClaw subagent archives stay scanned and preserve stable session IDs.

Constraint: Worker-2 scope is limited to the OpenClaw scanner audit for merge #342
Rejected: Broader scanner/parser refactor | audit only needed targeted regression coverage
Confidence: high
Scope-risk: narrow
Directive: Keep archived OpenClaw filenames covered whenever scan patterns or session-id parsing change
Tested: rustfmt --edition 2021 --check crates/tokscale-core/src/scanner.rs crates/tokscale-core/src/sessions/openclaw.rs
Tested: cargo check -p tokscale-core
Tested: cargo test -p tokscale-core openclaw -- --nocapture
Tested: cargo test -p tokscale-core test_scan_all_clients_openclaw -- --nocapture
Not-tested: cargo clippy -p tokscale-core --lib --tests -- -D warnings (fails on pre-existing out-of-scope issues in pricing/lookup.rs, sessions/kilo.rs, and message_cache.rs)
crhan pushed a commit to crhan/tokscale that referenced this pull request Mar 26, 2026
The junhoyeo#342 audit found the scanner and parser implementation working, but
not protected by regression coverage for auto-archived transcript
filenames. Add focused tests for `.jsonl.deleted.<timestamp>` files so
OpenClaw subagent archives stay scanned and preserve stable session IDs.

Constraint: Worker-2 scope is limited to the OpenClaw scanner audit for merge junhoyeo#342
Rejected: Broader scanner/parser refactor | audit only needed targeted regression coverage
Confidence: high
Scope-risk: narrow
Directive: Keep archived OpenClaw filenames covered whenever scan patterns or session-id parsing change
Tested: rustfmt --edition 2021 --check crates/tokscale-core/src/scanner.rs crates/tokscale-core/src/sessions/openclaw.rs
Tested: cargo check -p tokscale-core
Tested: cargo test -p tokscale-core openclaw -- --nocapture
Tested: cargo test -p tokscale-core test_scan_all_clients_openclaw -- --nocapture
Not-tested: cargo clippy -p tokscale-core --lib --tests -- -D warnings (fails on pre-existing out-of-scope issues in pricing/lookup.rs, sessions/kilo.rs, and message_cache.rs)
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.

OpenClaw: auto-archived subagent transcripts not included in scan

2 participants