Skip to content

fix(pi): restrict state reporting to TUI sessions - #2159

Open
rhjoh wants to merge 1 commit into
herdrdev:masterfrom
rhjoh:fix/pi-integration-tui-only
Open

fix(pi): restrict state reporting to TUI sessions#2159
rhjoh wants to merge 1 commit into
herdrdev:masterfrom
rhjoh:fix/pi-integration-tui-only

Conversation

@rhjoh

@rhjoh rhjoh commented Aug 1, 2026

Copy link
Copy Markdown

Problem

Pi RPC mode reports hasUI as true because it exposes UI APIs over JSON. When an RPC process inherits a Herdr pane environment, the managed Pi extension therefore reports a headless process as the pane agent.

Reproduced with Pi 0.83.0: the original extension sent Herdr lifecycle requests from RPC mode. With this change it sends none, while TUI reporting continues normally.

Fix

Require ctx.mode to be tui before starting lifecycle reporting. This excludes RPC, JSON, and print sessions. Bump the managed Pi integration to version 8 so existing installations receive the updated extension.

Tests

  • just ci
  • regression coverage for RPC with hasUI set to true

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

coderabbitai Bot commented Aug 1, 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: 89ab40ee-2744-43b6-b61b-5e09a94872a9

📥 Commits

Reviewing files that changed from the base of the PR and between f73a9de and 42849b2.

📒 Files selected for processing (5)
  • src/integration/assets/herdr-agent-state.test.ts
  • src/integration/assets/pi/herdr-agent-state.ts
  • src/integration/mod.rs
  • src/integration/tests.rs
  • tests/cli/sessions.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • tests/cli/sessions.rs
  • src/integration/tests.rs
  • src/integration/mod.rs
  • src/integration/assets/pi/herdr-agent-state.ts
  • src/integration/assets/herdr-agent-state.test.ts

📝 Walkthrough

Walkthrough

The session_start handler now enables integration reporting only when ctx.mode is "tui". The Pi integration version is updated to 8. Tests cover TUI and RPC session behavior.

Changes

Session reporting

Layer / File(s) Summary
TUI reporting gate
src/integration/assets/pi/herdr-agent-state.ts, src/integration/mod.rs
The session-start handler uses ctx.mode === "tui" instead of ctx.hasUI === true. The Pi integration version changes from 7 to 8.
TUI reporting validation
src/integration/assets/herdr-agent-state.test.ts, src/integration/tests.rs, tests/cli/sessions.rs
Tests add TUI session contexts, verify that RPC sessions do not send socket requests, and expect the new mode condition and integration version.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately explains the Pi TUI reporting fix, affected modes, version bump, and regression tests.
Title check ✅ Passed The title clearly identifies the Pi integration change that restricts state reporting to TUI sessions.
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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c21f1c06-1d84-4c26-813c-c7e00f9f6706

📥 Commits

Reviewing files that changed from the base of the PR and between 26a7bc8 and 2098122.

📒 Files selected for processing (1)
  • src/integration/assets/pi/herdr-agent-state.ts

Comment thread src/integration/assets/pi/herdr-agent-state.ts
@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR restricts Pi lifecycle reporting to TUI sessions and increments the managed integration version so installed extensions receive the fix.

  • Replaces the hasUI check with an explicit mode === "tui" requirement.
  • Adds regression coverage proving RPC sessions emit no lifecycle requests.
  • Updates TUI fixtures, bundled-asset assertions, and integration-version expectations.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/integration/assets/pi/herdr-agent-state.ts Restricts lifecycle initialization to TUI mode and updates the managed extension version.
src/integration/assets/herdr-agent-state.test.ts Updates reporting fixtures with TUI mode and adds RPC-mode regression coverage.
src/integration/tests.rs Updates the bundled-asset assertion to match the new mode gate.
src/integration/mod.rs Bumps the Pi integration version so existing installations are recognized as outdated.
tests/cli/sessions.rs Updates the integration-status expectation for Pi version 8.

Reviews (3): Last reviewed commit: "fix(pi): restrict state reporting to tui..." | Re-trigger Greptile

Comment thread src/integration/assets/pi/herdr-agent-state.ts
Comment thread src/integration/assets/pi/herdr-agent-state.ts
@rhjoh
rhjoh force-pushed the fix/pi-integration-tui-only branch from 2098122 to f73a9de Compare August 1, 2026 15:33
@rhjoh rhjoh changed the title fix(pi): only report agent state for TUI sessions, not RPC fix(pi): restrict state reporting to TUI sessions Aug 1, 2026
@rhjoh
rhjoh force-pushed the fix/pi-integration-tui-only branch from f73a9de to 42849b2 Compare August 1, 2026 15:41
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.

2 participants