Skip to content

fix: Claude Code stats not recording — stdout fallback + snake_case alias + doctor sandbox detection#55

Merged
fajarhide merged 1 commit intomainfrom
53-omni-stats-shows-no-data
Apr 10, 2026
Merged

fix: Claude Code stats not recording — stdout fallback + snake_case alias + doctor sandbox detection#55
fajarhide merged 1 commit intomainfrom
53-omni-stats-shows-no-data

Conversation

@fajarhide
Copy link
Copy Markdown
Owner

@fajarhide fajarhide commented Apr 10, 2026

PR Auto Describe

Summary

This PR improves omni's diagnostic tools, cross-tool hook compatibility, and filesystem sandbox detection. It upgrades the doctor command to catch Claude Code-style filesystem restrictions via real write tests, adds support for Claude Code's tool response format, and unifies hook field naming between camelCase and snake_case.

Key Changes

  • Enhanced omni doctor to validate actual filesystem/database write access instead of static permission checks, with actionable Claude Code sandbox warnings
  • Added cross-tool hook compatibility by supporting both camelCase and snake_case field names
  • Added support for Claude Code's stdout/stderr tool response format
  • Added a SQLite store writability test utility

Detailed Breakdown

  • src/cli/doctor.rs:
    • Rewrote the ~/.omni config dir check: Replaced simplistic metadata permission tests with a real write test (creates + cleans up a temporary .write_test file)
    • Added a new database writability scan using the new Store::test_write() method, with tailored warnings for Claude Code users
    • Preserved existing fix-mode directory creation logic
  • src/hooks/dispatcher.rs + src/hooks/session_start.rs: Added serde deserialization aliases to support both camelCase (e.g. hookEventName) and snake_case (e.g. hook_event_name) field names
  • src/hooks/post_tool.rs:
    • Extended ToolResponse struct to accept stdout and stderr fields
    • Created extract_tool_content() that prioritizes structured content fields (used by Cursor/Windsurf) then falls back to concatenated stdout/stderr (Claude Code format)
    • Replaced legacy content extraction logic with this new handler
    • Added 4 new test cases covering Claude Code payloads, mixed stdout/stderr, empty output, and structured content field precedence
  • src/store/sqlite.rs: Added test_write() helper that validates database writability by creating and dropping a temporary test table, handling poisoned mutexes gracefully

Notes

All omni doctor warnings now include specific instructions for Claude Code users: add ~/.omni to sandbox.filesystem.allowWrite in ~/.claude/settings.json to resolve sandboxed write blocks.

Breaking Changes

None. All changes are backwards-compatible, with existing tooling and workflows unaffected.

Last updated: 2026-04-10 04:09:00

@fajarhide fajarhide linked an issue Apr 10, 2026 that may be closed by this pull request
…lias + doctor sandbox detection

- post_tool: add stdout/stderr fallback for Claude Code tool_response format
  (Claude Code sends {stdout,stderr} instead of {content})
- dispatcher + session_start: accept both camelCase and snake_case field names
  via serde alias (hookEventName / hook_event_name)
- doctor: replace metadata-only check with actual write test to detect
  Claude Code sandbox restrictions on ~/.omni/
- sqlite: add Store::test_write() for DB write capability check
- Added 5 new tests for Claude Code payload format

Fixes #GH-issue: omni stats shows no data with Claude Code
@fajarhide fajarhide force-pushed the 53-omni-stats-shows-no-data branch from 96480e1 to 994d8c6 Compare April 10, 2026 04:08
@fajarhide fajarhide merged commit 2eea101 into main Apr 10, 2026
4 checks passed
@fajarhide fajarhide deleted the 53-omni-stats-shows-no-data branch May 5, 2026 23:15
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.

omni stats shows no data

1 participant