Skip to content

feat: add Roo Code parser (closes #24) - #55

Open
Abhishek022001 wants to merge 14 commits into
Entelligence-AI:mainfrom
Abhishek022001:feature
Open

Abhishek022001 wants to merge 14 commits into
Entelligence-AI:mainfrom
Abhishek022001:feature

Conversation

@Abhishek022001

Copy link
Copy Markdown

Summary

Adds support for Roo Code session discovery, ingestion, and timeline
visualization:
- Parser in `parsers/roo.py` handling `ui_messages.json` (paired
ask/say tool events, command exit code parsing, token and cost events,
code diff extraction) and `api_conversation_history.json` fallback.
- Mapped Roo Code tools across camelCase and snake_case variants
(`execute_command`, `read_file`, `replace_in_file`, `apply_diff`,
`list_files`, etc.) to canonical taxonomy verbs (`Bash`, `Read`,
`Write`, `Edit`, `LS`, `Grep`, `WebFetch`, `Task`).
- Auto-discovery in `discover.py` checking VS Code globalStorage
(`rooveterinaryinc.roo-cline`), with `AGENTPLAY_ROO_HOMES` environment
variable override.
- Indexer in `LocalSource` indexing task directories as well as direct
JSON transcripts.
- 3 minimal anonymized fixtures committed under
`python/tests/core/fixtures/roo/`.
- Updated supported agent tables in `README.md` and `install.md`.

Closes #24

## Test plan

- [x] `make check` passes:
  - `python -m pytest python/tests/core/test_roo_parser.py -v` (9/9
  passed)
  - `python -m pytest python/tests/core/ -v` (800/800 passed)
  - `python scripts/check_clean.py` (clean)
  - `cd viewer && pnpm run typecheck` (0 TypeScript errors)
  - `cd viewer && pnpm test` (354/354 passed)
  - Verified manual end-to-end ingestion and listing via `agentplay
  build --agents roo-code` and `agentplay list`.
- [x] No prompt text, model output, tool input/output, file contents
or command arguments can reach a map, a log line or the viewer
([redaction
contract](https://github.com/Entelligence-AI/agentplay/blob/main/docs/
format.md#redaction-contract)) — asserted by
`test_roo_builder_never_leaks_free_text`.
- [x] No new network calls or Python runtime dependencies — standard
library only.

@entelligence-ai-pr-reviews

entelligence-ai-pr-reviews Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

EntelligenceAI PR Summary

Adds Roo Code session discovery from VS Code extension storage and parses both ui_messages.json and API conversation history into session, turn, and tool spans for timeline visualization. The parser captures paired tool events, command failures, token usage, edit evidence, and source-cursor metadata; Roo tool names are mapped to canonical taxonomy categories, with discovery configuration and documentation updated.

flowchart TD
    classDef newBehavior fill:#dcfce7,stroke:#16a34a,color:#14532d;
    A["Roo Code task files"] --> B["Discover and index sessions"]
    B --> C["Detect Roo Code transcript"]
    C --> D["Parse UI messages or API history"]
    D --> E["Normalize tools and capture usage, status, and edits"]
    E --> F["Build spans for session timeline"]
    class A,B,C,D,E,F newBehavior;
Loading

🟢 Green = new or changed in this PR


Review Scorecard

Dimension Rating Basis
Code Quality ●●●●○ 4/5 — Good 1 major, 1 earlier finding(s) open — rated Good
Blast Radius Low changed symbols are referenced only within their own file(s); no high-impact surface touched, 9 file(s) / ~901 line(s) changed (size only — not a blast signal)
Merge Confidence ●●●●○ 4/5 — Mostly Safe equals code quality; blast radius is shown for context only
Test Coverage — unavailable dependencies failed to install
Security Scan No findings on changed lines SonarQube · Semgrep · TruffleHog on 2 changed files

Issues found:

  • Significant python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py — Propagate cache writes into the turn aggregate
  • Unresolved python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py — Fall back to text when question is empty (unresolved from an earlier review)
  • Unresolved python/tests/core/test_roo_parser.py — Assert that non-string fields are extracted from their wrappers (unresolved from an earlier review)

Safe to merge with a low blast radius; code quality rated Good (4/5): 1 significant finding in 1 file, the most severe in python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py (Propagate cache writes into the turn aggregate). 2 comments from earlier reviews are still open.

Need to merge before these are addressed? Anyone with write access can comment @entelligence /approve to approve it now. @entelligence help lists every command.

Evaluated against
  • 2/2 changed files reviewed
  • criteria: correctness, security & access control, robustness & error handling, concurrency & data integrity, repo conventions / steering docs
  • steering docs: none found in repo
  • PR checks: unit tests (unavailable) · security scan (SonarQube, Semgrep, TruffleHog on 2 changed files)
Files requiring special attention
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py

@entelligence-ai-pr-reviews

entelligence-ai-pr-reviews Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Walkthrough

Adds Roo Code as a supported coding agent, including home-directory discovery, transcript detection and parsing, local-source indexing, and shared tool classification. Documents Roo configuration, extends search/read metrics for the LS tool, and adds fixtures and tests for transcript formats, parsing behavior, source cursors, discovery, and tool aliases.

Changes

Files

  • README.md
  • install.md
  • python/src/agentplay/discover.py

Documents Roo Code support, its VS Code storage locations, and the AGENTPLAY_ROO_HOMES configuration variable. Registers Roo Code discovery with configurable home paths and VS Code global-storage defaults.

Files

  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/__init__.py
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/base.py
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py
  • python/src/agentplay/_core/ingestion/coding_agent/_sources/local/source.py

Adds Roo agent detection for JSON-array and line-delimited transcripts, including truncated input, and implements parsing for UI-message and API-history formats. Local ingestion indexes Roo task transcripts, routes sessions to the Roo parser, and emits session, turn, and tool spans with extracted content, usage, status, edit evidence, and source-cursor attributes.

Files

  • python/src/agentplay/_core/ingestion/coding_agent/tool_taxonomy.py
  • python/src/agentplay/_core/ingestion/coding_agent/metrics.py

Maps Roo Code API and UI tool aliases to the shared taxonomy. Classifies LS as a search tool and read operation for ordering-dependent metrics.

Files

  • python/tests/core/fixtures/roo/api_history.json
  • python/tests/core/fixtures/roo/failed_command.json
  • python/tests/core/fixtures/roo/read_and_edit.json
  • python/tests/core/test_roo_parser.py
  • python/tests/core/test_source_cursor_universal.py
  • python/tests/core/test_tool_taxonomy.py

Adds Roo transcript fixtures and tests for detection, parsing, tool outcomes, malformed and partial input, metrics, privacy-safe indexing, discovery, source cursors, and canonical tool aliases.

@adityajha2005

Copy link
Copy Markdown
Contributor

hey @Abhishek022001 can you check the review comments?

Comment thread python/tests/core/test_roo_parser.py Resolved
@entelligence-ai-pr-reviews

Copy link
Copy Markdown
Also noticed in code this push did not change at `a239f3d` (1, not blocking)

These lines were already in the PR at the last review, so they are listed here instead of opening new threads.

  • Count each Roo request lifecycle only once (python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py:214, MAJOR)

parsed_q = _safe_json(raw_text)
if isinstance(parsed_q, dict):
cand = parsed_q.get("question")
if cand is None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MAJOR CORRECTNESS Fall back to text when question is empty

When a response has question: "" and non-empty text, this keeps the empty question and drops the usable response; the same is None fallback is repeated for dict payloads at 427–430. Fall back when the question is empty, as the previous truthy fallback did.

Prompt to fix with AI

Copy this prompt into your AI coding assistant to fix this issue.

In python/src/agentplay/_core/ingestion/coding_agent/_sources/local/parsers/roo.py, update both question-selection branches at lines 410–438 so an empty-string question falls through to `text`, while preserving serialization of non-string values. Add a regression case with `question: ""` and non-empty `text`; currently the turn output is blank.

Comment on lines +473 to +476
assert "123" in out_val
assert '{"status": "success", "code": 0}' in out_val
assert '["option_a", "option_b"]' in out_val
assert '{"nested": true}' in out_val

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

NIT TEST Assert that non-string fields are extracted from their wrappers

These substring checks also pass if the parser emits the entire JSON envelope instead of extracting text or question—for example, {"text": 123} contains 123. That regression would leave wrapper JSON in the assistant output without failing this test.

Prompt to fix with AI

Copy this prompt into your AI coding assistant to fix this issue.

In python/tests/core/test_roo_parser.py:473–476, strengthen the assertions so they fail if output.value contains the full JSON wrapper instead of the extracted text/question values. Assert the expected extracted output or that the wrapper keys are absent.

Comment on lines +183 to +185
"cache_read_tokens": cr_tokens,
"cache_write_5m_tokens": cw_tokens,
"cache_write_1h_tokens": 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MAJOR CORRECTNESS Propagate cache writes into the turn aggregate

When a Roo request reports nonzero cacheWrites, this event records them, but the turn span still reports llm.token_count.cache_write as 0. session_model_usage() compares event totals with turn aggregates and raises ValueError, which propagates through build_session_metrics().

Prompt to fix with AI

Copy this prompt into your AI coding assistant to fix this issue.

Accumulate each request’s cache-write count into the Roo turn’s cache-write aggregate and expose that aggregate in the turn span, so its cache-write total matches the emitted cost events.

This branch has not been deployed

No deployments
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.

2 participants