Skip to content

fix: add positive idle detection for kiro-cli prompt - #2301

Open
smileynet wants to merge 1 commit into
herdrdev:masterfrom
smileynet:fix/kiro-idle-detection
Open

fix: add positive idle detection for kiro-cli prompt#2301
smileynet wants to merge 1 commit into
herdrdev:masterfrom
smileynet:fix/kiro-idle-detection

Conversation

@smileynet

Copy link
Copy Markdown

Summary

  • Kiro's idle prompt is now positively detected (instead of falling back to a generic heuristic)
  • not guards prevent false idle when working indicators are in the same screen region
  • Regression tests cover idle, working, overlap, stale scrollback, and blocked precedence

Root cause

Currently there is no positive confirmation for idle state in the kiro manifest, only a fallback rule that is susceptible to false negatives due to text in scrollback.

Evidence

Captured via herdr agent read <pane> --source detection --format text against kiro-cli 2.13.x on Windows. Verified with herdr agent explain <pane> --json.

State transitions confirmed through the local-override hot-reload loop: idle → working → blocked → idle. No false positives from stale scrollback, short terminals, or narrow panes.

Idle:

\\ ext
ask a question or describe a task ↵
/copy to clipboard
\\

Working:

\\ ext
Kiro is working · Type to steer · Ctrl+S to queue
\\

Design

  • Priority 200 overrides stale working text in scrollback.
  • Region 5 handles line wrapping in narrow panes.
  • not guards prevent false idle when positive working indicators are in the same region.

Validation

  • cargo test --bin herdr kiro (9 passed)
  • Live pane verification via the local-override hot-reload loop
  • State transitions confirmed: idle → working → blocked → idle

Notes

  • website/agent-detection/kiro.toml synced with src/detect/manifests/kiro.toml in this PR.
  • Discussion Kiro CLI: idle detection rules + integration proposal #982 proposed matching the prompt character via regex. This rule matches footer text instead to avoid false positives from appearing in output.

refs discussion #982

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: da771c83-ee33-485c-8535-2253dc1baa9d

📥 Commits

Reviewing files that changed from the base of the PR and between 1997b88 and cfc71ec.

📒 Files selected for processing (3)
  • src/detect/manifest/tests.rs
  • src/detect/manifests/kiro.toml
  • website/agent-detection/kiro.toml

📝 Walkthrough

Walkthrough

This PR adds a new prompt_idle detection rule to the Kiro manifest in both src/detect/manifests/kiro.toml and website/agent-detection/kiro.toml, bumps manifest versions and timestamps, and adds a test verifying idle, working, and blocked state precedence.

Changes

Kiro Prompt Idle Detection

Layer / File(s) Summary
prompt_idle rule and manifest version updates
src/detect/manifests/kiro.toml, website/agent-detection/kiro.toml
Both manifest files get a new prompt_idle rule that marks Kiro idle when prompt/clipboard text appears near the bottom of recent output, unless working or cancellation markers are present. Manifest version and updated_at timestamp change from the June 2026 release to 2026.08.01.1.
Test coverage for idle/working/blocked precedence
src/detect/manifest/tests.rs
A new test verifies Kiro idle footer detection, working markers and spinners, and precedence rules for overlapping or stale idle/working evidence, and approval-dialog blocking precedence.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the addition of positive idle detection for the Kiro CLI prompt.
Description check ✅ Passed The description directly explains the Kiro idle detection change, guards, regression tests, validation, and manifest synchronization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 4, 2026
@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds positive Kiro idle-prompt detection while preserving working and blocked precedence.

  • Adds a priority-200 idle rule based on the prompt and clipboard footer.
  • Vetoes idle detection when live working indicators overlap the footer region.
  • Synchronizes the bundled and website manifests with a version bump.
  • Adds regression coverage for idle, working, overlap, stale scrollback, and blocked states.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The synchronized manifests satisfy the repository’s update contract, and the new tests cover the rule’s idle, working, overlap, stale-scrollback, and blocked-state behavior.

Important Files Changed

Filename Overview
src/detect/manifests/kiro.toml Adds a versioned positive idle rule whose priority and localized vetoes preserve blocked and live-working precedence.
website/agent-detection/kiro.toml Keeps the remotely published Kiro manifest byte-aligned with the bundled manifest and its bumped version.
src/detect/manifest/tests.rs Adds focused regression cases covering the new rule and its principal precedence interactions.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Screen[Kiro terminal screen] --> Blocked{Approval rule matches?}
  Blocked -->|Yes| B[Blocked]
  Blocked -->|No| Prompt{Prompt anchors in bottom 5 non-empty lines?}
  Prompt -->|No| Working{Working marker or spinner matches?}
  Prompt -->|Yes| Veto{Working indicator in prompt region?}
  Veto -->|No| Idle[Idle]
  Veto -->|Yes| Working
  Working -->|Yes| W[Working]
  Working -->|No| U[Unknown]
Loading

Reviews (1): Last reviewed commit: "fix: add positive idle detection for kir..." | Re-trigger Greptile

@ogulcancelik

Copy link
Copy Markdown
Collaborator

@smileynet could you remove tests? i'm slowly trying to remove integration tests as they do not have meaningful purpose for fast changing patterns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants