Skip to content

feat: add TUI feedback prompt after deep investigation#104

Merged
jacoblee-io merged 2 commits intomainfrom
feat/tui-investigation-feedback
Mar 13, 2026
Merged

feat: add TUI feedback prompt after deep investigation#104
jacoblee-io merged 2 commits intomainfrom
feat/tui-investigation-feedback

Conversation

@LikiosSedo
Copy link
Collaborator

Summary

  • Add keyboard-based feedback UI (Thanks! Rate: 1-👍 2-👎 3-❌) to the TUI status bar after deep_search completes in DP mode
  • Extract showFeedbackIfNeeded() as an independent function, triggered on both auto-exit (conclusion done) and manual exit (Ctrl+I / /dp)
  • Pass memoryRef to the deep investigation extension so TUI can directly call updateInvestigationFeedback()

Details

The web UI already has investigation feedback via RPC + InvestigationCard. This PR adds the equivalent for TUI users:

  1. tool_result(deep_search) captures investigationId and sets deepSearchRan flag
  2. When DP mode exits (auto or manual), showFeedbackIfNeeded() shows the feedback hint
  3. User presses 1/2/3 to record confirmed/corrected/rejected → writes to memory DB
  4. Auto-cleanup after 60s timeout or when next message is sent

Test plan

  • Run deep investigation in TUI (/dp + question), verify feedback prompt appears after conclusion
  • Press 1/2/3, verify "Feedback recorded" notification
  • Verify feedback persists in memory DB (investigations table)
  • Verify prompt auto-clears after 60s timeout
  • Verify no feedback shown when deep_search was skipped (triage-only)

Show "Thanks! Rate: 1-👍 2-👎 3-❌" in the status bar after deep_search
runs and investigation concludes. Keyboard input records feedback
(confirmed/corrected/rejected) to the memory DB via the existing
updateInvestigationFeedback API. Auto-cleans up after 60s timeout or
when a new message is sent.
Copy link
Collaborator

@jacoblee-io jacoblee-io left a comment

Choose a reason for hiding this comment

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

Review

Clean, well-scoped PR. Reuses existing infrastructure (MemoryRef, updateInvestigationFeedback, FEEDBACK_SIGNALS) without introducing unnecessary abstractions. Cleanup is thorough (60s timeout + agent_start + unsubscribe).

Issues

1. No feedback prompt for non-DP deep_search runs in TUI

If a TUI user runs deep_search as a standalone tool (without /dp), disableDpMode never fires and feedback is never shown. The web UI has its own feedback path via InvestigationCard, but TUI users in this flow get nothing. Consider hooking feedback into tool_result directly (guarded by !checklist to avoid double-prompting), or document this as intentional.

2. feedbackCleanup not cleared on session_start — potential leak

If the session restarts while the feedback prompt is active, the stale feedbackCleanup closure (holding a setTimeout handle and onTerminalInput subscription) survives into the new session. Consider adding to the existing session_start handler:

// in session_start handler, before state reset
feedbackCleanup?.();

Both are minor — the core logic is solid.

1. Show feedback prompt for standalone deep_search (no DP mode) by
   triggering showFeedbackIfNeeded in tool_result when !checklist.
2. Clean up stale feedback state (timer, input listener) on
   session_start to prevent leaks across session restarts.
Copy link
Collaborator

@jacoblee-io jacoblee-io left a comment

Choose a reason for hiding this comment

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

Both items addressed in af27353. LGTM.

  • session_start now cleans up stale feedback state
  • Standalone deep_search (no DP mode) shows feedback via tool_result handler with !checklist guard

@jacoblee-io jacoblee-io merged commit cb30093 into main Mar 13, 2026
3 checks passed
@jacoblee-io jacoblee-io deleted the feat/tui-investigation-feedback branch March 13, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants