Repository navigation
feat: add Roo Code parser (closes #24) - #55
Abhishek022001 wants to merge 14 commits into
Conversation
EntelligenceAI PR SummaryAdds Roo Code session discovery from VS Code extension storage and parses both 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;
Review Scorecard
Issues found:
Safe to merge with a low blast radius; code quality rated Good (4/5): 1 significant finding in 1 file, the most severe in Need to merge before these are addressed? Anyone with write access can comment Evaluated against
Files requiring special attention
|
WalkthroughAdds 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. ChangesFiles
Documents Roo Code support, its VS Code storage locations, and the Files
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
Maps Roo Code API and UI tool aliases to the shared taxonomy. Classifies Files
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. |
|
hey @Abhishek022001 can you check the review comments? |
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.
|
| parsed_q = _safe_json(raw_text) | ||
| if isinstance(parsed_q, dict): | ||
| cand = parsed_q.get("question") | ||
| if cand is None: |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| "cache_read_tokens": cr_tokens, | ||
| "cache_write_5m_tokens": cw_tokens, | ||
| "cache_write_1h_tokens": 0, |
There was a problem hiding this comment.
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.
Summary