[Bug]: Cline PreToolUse maps to sticky Input needed (false/inverted after upstream #7446)
Bug
Cline TUI sessions can show Summary → Activity as Input needed for ordinary tool use, or remain sticky after the user already approved. AO installs Cline PreToolUse as permission-request, and StandardDeriveActivityState maps that to sticky waiting_input.
Related: parent family bug #6280 (Copilot / Cline / Kiro). Copilot will be fixed separately via observe-hooks . This issue tracks Cline-only follow-up.
Code-path confidence: High on current main (hook install + mapping). No separate live TUI recording attached here; behavior follows from the same path called out in #6280.
Reproduction
- Start a Cline TUI session and run a tool (interactive approval or auto-approve).
- Observe Activity when AO’s
PreToolUsewrapper runs (ao hooks cline permission-request). - After Approve (interactive) or while tools run under auto-approve, check whether Activity is Input needed and stays until
TaskComplete/TaskCancel(stop) or the nextUserPromptSubmit.
Expected: Input needed only while a human decision is actually pending; clear when work resumes after approval.
Actual: Every managed PreToolUse enters sticky waiting_input. After upstream cline/cline#7446 (merged 2025-11-13), when approval is required PreToolUse runs after Approve — so the AO mapping is inverted for that path. With auto-approve, PreToolUse still fires with no human prompt → ordinary false positive. #7446 fixed Cline’s hook UX; it does not break Cline, but it makes AO’s mapping worse for interactive sessions.
Root cause
backend/internal/adapters/agent/cline/hooks.go—PreToolUse→permission-request.backend/internal/adapters/agent/activitystate/activitystate.go—permission-request→waiting_input(sticky;NeedsInput).- AO does not install a Cline post-tool clear for this path; clear is mainly
TaskComplete/TaskCancel→stopor nextUserPromptSubmit. - Terminal detector exists (
DetectTerminalActivity) but deliberately ignores the approval fixture (tool_approval.txt), so it does not recover genuine approval UI today. - Copilot-style (
notification.permission_prompt/ typedpermissionRequest) does not transfer: Cline’s hook contract is cancel-oriented, not Copilot’s ask/allow + typed permission notification shape.
Fix direction
- Stop mapping
PreToolUse→permission-request/waiting_input(treat as active / tool-use). - Restore real Input needed ,teach the terminal detector to recognize approval chrome, and/or use ACP Chat approval events if/when Cline Chat is available (#5604).
- Remap-only without (2) would hide pending approvals in TUI until observation exists - same tradeoff as closed AO PR #2594 for the family.