Repository navigation
ADFA-6268 | Add read_app_logs and read_ide_logs agent tools - #113
Conversation
…6268) Read-only tools over IdeLogService, capped at 8000 chars and anchored on the first crash or error. run_app points the agent at read_app_logs; min_ide_version is now 26.40.
Daniel-ADFA
left a comment
There was a problem hiding this comment.
Reviewed at d85ceda.
CRITICAL
- AndroidManifest.xml:41 - min_ide_version 26.40 predates IdeLogService; the agent chat fails on that host
IMPORTANT
- LogWindowCalculator.kt:12 - AgentLoop keeps only the first 4000 chars of the 8000-char window
- LogWindowCalculator.kt:25 - anchors on the oldest crash/error, not the newest
- ReadLogsHandler.kt:8 - libs/plugin-api.jar and plugin-api-latest lack the log API, so AI-Core does not compile
- ReadLogsHandler.kt:136 - a second consecutive read ends the run as completed
NITPICK - 1 inline, not listed
No prior review rounds. The repo has no written approve/request-changes rule (CLAUDE.md, plugin-review skill), so the default grading applied; two findings cite the plugin-review RUBRIC (6.1 compatibility, 6.3 build reproducibility).
Daniel-ADFA
left a comment
There was a problem hiding this comment.
Requesting changes for the CRITICAL and four IMPORTANT findings in the review above: keep AI-Core working on 26.39/26.40 hosts without IdeLogService, refresh libs/ so it compiles, size the log window to the agent loop's 4000-char cap, anchor on the newest crash, and stop a repeated log read from ending the run.
- Keep min_ide_version 26.39; register log tools only when the host has IdeLogService - Size the log window to AgentLoop's tool-output cap - Anchor on the newest crash / newest error run instead of the oldest - Don't treat a repeated log read as the run completing - Share OutputWindow and the truncation marker between build and log handlers
Daniel-ADFA
left a comment
There was a problem hiding this comment.
Re-review at 54b818b.
IMPORTANT
- LogWindowCalculator.kt:24 - an earlier run's crash still wins the anchor
- ReadLogsHandler.kt:139 - the empty-log text prescribes run_app when the log sender is off
- RunAppHandler.kt:99 - the run_app hint names a tool 26.39/26.40 never register
- ToolCallProgressGuard.kt:73 -
anyexempts batches that also write or build - LogWindowCalculator.kt:25 (existing thread) -
min_level=errorstill anchors at line 0 - ReadLogsHandler.kt:8 (existing thread) - libs/plugin-api.jar still lacks the log API
MINOR
- ToolCallProgressGuard.kt:122 - maxConsecutiveRepeats KDoc no longer matches
- ReadLogsHandler.kt:136 (existing thread) - the live-read exemption misses mis-named calls (plausible)
- PR description (below) - states the old floor, cap and anchor
Previous round, checked against the code at 54b818b:
- CRITICAL AndroidManifest.xml:41 - fixed: floor 26.39,
LogToolHandlersbuilt only whenClass.forNamefindsIdeLogService. - IMPORTANT LogWindowCalculator.kt:12 - fixed:
MAX_OUTPUT_CHARSisDEFAULT_TOOL_OUTPUT_CHAR_LIMIT - 100. - IMPORTANT LogWindowCalculator.kt:25 - partly fixed; reopened for
min_level=error. - IMPORTANT ReadLogsHandler.kt:8 - not fixed yet (plan agreed); reopened.
- IMPORTANT ReadLogsHandler.kt:136 - fixed for exact names; the remainder reopened as MINOR.
- NITPICK LogWindowCalculator.kt:14 - fixed:
OutputWindow.kt.
Findings without a diff anchor:
MINOR: The PR description still says the output is capped at 8,000 characters, that the slice anchors at the first crash or error, and that plugin.min_ide_version is bumped to 26.40. The code now caps at 3,900, anchors on the newest, and keeps 26.39. QA testing against the description will check the wrong limits and the wrong compatibility floor. Update those three lines.
Heads-up: #114 removes AgentLoop.DEFAULT_TOOL_OUTPUT_CHAR_LIMIT (the cap moves to ToolResultsPrompt.DEFAULT_CHAR_LIMIT), so whichever of the two merges second needs a one-line change in LogWindowCalculator.
The repo has no written approve/request-changes rule (CLAUDE.md, plugin-review skill), so the default grading applied.
Daniel-ADFA
left a comment
There was a problem hiding this comment.
Requesting changes for the IMPORTANT findings in the re-review above: anchor on the newest run (an earlier crash still wins, and min_level=error still anchors at line 0), add the run_app hint only when the log tools are registered, exempt only batches that are all live reads, word the empty-log text without prescribing run_app, and refresh libs/ so AI-Core compiles.
Anchor on the newer of crash/error run, tail all-ERROR reads, exempt only all-log-read batches, gate the run_app hint. Refs: ADFA-6268
Daniel-ADFA
left a comment
There was a problem hiding this comment.
Approving, with one condition before merge: the libs refresh in the existing ReadLogsHandler.kt:8 thread, which I've reopened. The two new comments don't block.
IMPORTANT
- ReadLogsHandler.kt:8 (existing thread, reopened) -
libs/plugin-api.jarstill has no log API
MINOR
- LogWindowCalculator.kt:27 - a later ERROR line drops the crash even when both fit
NITPICK - 1 inline, not listed
Round 2 re-check at 61bb72c:
- Batch exemption: fixed,
calls.allat ToolCallProgressGuard.kt:74. - Earlier crash winning the anchor: fixed, the newer anchor wins (LogWindowCalculator.kt:24-27). The new MINOR is its flip side, and its fix keeps this.
- Empty-log text: fixed, ReadLogsHandler.kt:139 no longer mentions run_app.
- run_app hint on old hosts: fixed, gated on
hasLogToolsfromhostHasLogApi()(BuiltInToolHandlers.kt:33). maxConsecutiveRepeatsKDoc: fixed, ToolCallProgressGuard.kt:10.- All-ERROR read keeping the oldest lines: fixed,
newestErrorRunStartreturns null and the window falls back totail(LogWindowCalculator.kt:103). - libs refresh: still open, see the thread.
- Name normalization in the exemption: not fixed; the reason given (native tool calls return the declared names) holds for a MINOR, so not re-raised.
The addons CLAUDE.md has no written approve/request-changes rule.
Description
This PR enables the AI agent to independently fetch and diagnose runtime crashes and IDE errors without requiring the user to manually copy and paste log lines.
read_app_logsandread_ide_logsread-only tools to the AI agent.LogWindowCalculatorto cap the output at 3,900 characters (AgentLoop.DEFAULT_TOOL_OUTPUT_CHAR_LIMIT - 100). The slice starts at the newer of the newest crash or the newest run of error lines; when it cannot reach the end, half the budget keeps the newest lines. A read with no error, or only errors, keeps the newest lines.plugin.min_ide_versionstays at26.39. The log tools are registered only when the host hasIdeLogService, so older hosts keep the agent chat working without them.Details
run_appsuccess message tells the agent to callread_app_logsif the app crashes or misbehaves, only on hosts where the log tools are registered.Demo
https://drive.google.com/file/d/1u-lB33uulRhBYw7N9-oAcjnyZVhOf8kD/view?usp=sharing
Ticket
ADFA-6268
Parent: ADFA-6266
Observation
All tools are registered in
Executor.ktandBuiltInToolHandlers.kt.