Skip to content

Revert "feat: human-in-the-loop support with AskUserQuestion"#896

Merged
Gkrumbach07 merged 1 commit intomainfrom
revert-871-feat/human-in-the-loop
Mar 12, 2026
Merged

Revert "feat: human-in-the-loop support with AskUserQuestion"#896
Gkrumbach07 merged 1 commit intomainfrom
revert-871-feat/human-in-the-loop

Conversation

@Gkrumbach07
Copy link
Contributor

Reverts #871

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d731a85-c126-45f0-a060-6b6f60071edd

📥 Commits

Reviewing files that changed from the base of the PR and between 538ccbd and 0b34243.

⛔ Files ignored due to path filters (1)
  • components/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (26)
  • .gitignore
  • Makefile
  • components/backend/handlers/sessions.go
  • components/backend/main.go
  • components/backend/types/agui.go
  • components/backend/types/session.go
  • components/backend/websocket/agui_proxy.go
  • components/backend/websocket/agui_store.go
  • components/backend/websocket/agui_store_test.go
  • components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx
  • components/frontend/src/components/agent-status-indicator.tsx
  • components/frontend/src/components/session-status-dot.tsx
  • components/frontend/src/components/session/MessagesTab.tsx
  • components/frontend/src/components/session/ask-user-question.tsx
  • components/frontend/src/components/ui/stream-message.tsx
  • components/frontend/src/components/ui/tool-message.tsx
  • components/frontend/src/components/workspace-sections/sessions-section.tsx
  • components/frontend/src/hooks/agui/types.ts
  • components/frontend/src/hooks/use-agent-status.ts
  • components/frontend/src/hooks/use-agui-stream.ts
  • components/frontend/src/services/queries/use-sessions.ts
  • components/frontend/src/types/agentic-session.ts
  • components/frontend/src/types/api/sessions.ts
  • components/runners/ambient-runner/ag_ui_claude_sdk/adapter.py
  • components/runners/ambient-runner/ambient_runner/bridges/claude/bridge.py
  • components/runners/ambient-runner/ambient_runner/platform/prompts.py

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


Walkthrough

This pull request removes agent status tracking and question-handling functionality throughout the codebase. Changes include elimination of agent status derivation, removal of UI components for status indicators, simplification of session status display to phase-only, and cleanup of related backend websocket logic, Python runner infrastructure, and type definitions across frontend and backend.

Changes

Cohort / File(s) Summary
Agent Status Removal (Backend)
components/backend/handlers/sessions.go, components/backend/types/agui.go, components/backend/types/session.go, components/backend/websocket/agui_store.go, components/backend/websocket/agui_store_test.go
Removed DeriveAgentStatusFromEvents function, enrichAgentStatus helper, agent status constants (Working, Idle, WaitingInput), AgentStatus field from AgenticSessionStatus struct, and all associated tests. Changed session name generation from UnixMilli() to Unix(). Removed 105 lines from agui_store.go related to status derivation logic.
Agent Status Removal (Frontend)
components/frontend/src/types/agentic-session.ts, components/frontend/src/types/api/sessions.ts, components/frontend/src/hooks/use-agent-status.ts, components/frontend/src/components/agent-status-indicator.tsx, components/frontend/src/components/session-status-dot.tsx
Removed exported types AgentStatus, StoredAgentStatus, AskUserQuestionOption/Item/Input, agentStatus field from AgenticSessionStatus, and entire useAgentStatus hook with deriveAgentStatusFromPhase helper. Deleted UI components AgentStatusIndicator and SessionStatusDot.
Ask User Question Removal (Frontend UI)
components/frontend/src/components/session/ask-user-question.tsx, components/frontend/src/components/ui/stream-message.tsx, components/frontend/src/components/ui/tool-message.tsx, components/frontend/src/components/session/MessagesTab.tsx
Deleted AskUserQuestionMessage component and all related rendering logic (363 lines). Removed isAskUserQuestionTool helper and AskUserQuestion-specific rendering paths. Removed onSubmitAnswer prop from MessagesTabProps and onSendToolAnswer callback support. Removed specialized AskUserQuestion formatting from generateToolSummary.
Session Display Simplification (Frontend)
components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx, components/frontend/src/components/workspace-sections/sessions-section.tsx
Replaced SessionStatusDot and AgentStatusIndicator with single Badge showing session phase via getPhaseColor. Removed AskUserQuestion response filtering and sendToolAnswer helper. Updated sessions list to use SessionPhaseBadge instead of separate status dot and agent status indicators.
Message Streaming API Changes (Frontend)
components/frontend/src/hooks/use-agui-stream.ts, components/frontend/src/hooks/agui/types.ts
Removed optional metadata parameter from sendMessage function signature. Removed spreading of metadata into userMessage object. Updated UseAGUIStreamReturn interface to reflect simpler function signature.
Session Query Changes (Frontend)
components/frontend/src/services/queries/use-sessions.ts
Removed smart refetchInterval function that computed polling intervals (2s, 5s, 15s) based on session statuses. Hook now relies on default polling behavior instead of status-aware tiered intervals.
Websocket Session ID Refactoring (Backend)
components/backend/websocket/agui_proxy.go
Replaced namespace-qualified session IDs (projectName/sessionName) with simple sessionName in mappings and persistence calls. Updated proxyRunnerStream and publishAndPersistErrorEvents function signatures to remove namespacedSessionID parameter. Removed isAskUserQuestionToolCall helper function. Updated all call sites to match new signatures.
Main Module Wiring (Backend)
components/backend/main.go
Removed assignment wiring websocket.DeriveAgentStatus into handlers.DeriveAgentStatusFromEvents during initialization.
Runner Halt Tracking Removal (Python)
components/runners/ambient-runner/ag_ui_claude_sdk/adapter.py, components/runners/ambient-runner/ambient_runner/bridges/claude/bridge.py
Removed ToolCallResultEvent emission, halted state tracking (_halted, _halted_tool_call_id fields), BUILTIN_FRONTEND_TOOLS constant, and per-thread halt tracking in ClaudeBridge (_halted_by_thread). Removed frontend tool halt detection and propagation logic.
Prompt Instructions Removal (Runner)
components/runners/ambient-runner/ambient_runner/platform/prompts.py
Removed HUMAN_INPUT_INSTRUCTIONS constant and its appending to build_workspace_context_prompt, eliminating human-in-the-loop instructions from generated workspace context.
Build Configuration
.gitignore, Makefile
Removed ignore rule for .claude/worktrees/ directory. Updated Makefile port-forward trap behavior to skip child process killing. Changed port-forward targets from $(NAMESPACE) to ambient-code with subshell execution and combined wait.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-871-feat/human-in-the-loop
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Gkrumbach07 Gkrumbach07 merged commit 373db39 into main Mar 12, 2026
18 of 20 checks passed
@Gkrumbach07 Gkrumbach07 deleted the revert-871-feat/human-in-the-loop branch March 12, 2026 16:56
Gkrumbach07 added a commit that referenced this pull request Mar 13, 2026
## Summary

- **AskUserQuestion UI**: Interactive question component with
single/multi-select options, freeform "Other" input, and multi-question
tabbed navigation
- **Agent status from event log**: Derive `agentStatus` at query time
from persisted AG-UI events instead of caching on the CR (eliminates
goroutine race conditions)
- **Frontend status indicators**: `SessionStatusDot` and
`AgentStatusIndicator` components for detail and table views,
`useAgentStatus` hook reads raw `PlatformMessage.toolCalls[]` format
- **TOOL_CALL_RESULT emission**: Adapter emits `TOOL_CALL_RESULT` on
next run for halted tool calls so the frontend transitions questions to
answered state
- **Session list refresh**: `refetchOnMount: 'always'` so navigating
back to the sessions page fetches fresh data immediately

Supersedes #871 (which was reverted in #896 due to a
namespace-qualification bug in the event store). This version removes
the namespace-qualification refactor entirely, keeping only the HITL
feature changes.

## Changes from #871

Removed:
- Namespace-qualified event store paths (caused chat-lost-on-refresh
bug)
- `.gitignore` worktrees entry
- `Makefile` port-forward cleanup
- `components/package-lock.json` deletion
- `UnixMilli` session timestamp change

Added:
- `refetchOnMount: 'always'` on session list query for immediate refresh
on navigation

## Test plan

- [ ] Create session, send prompt that triggers AskUserQuestion
- [ ] Verify question UI appears with options
- [ ] Submit answer, verify question transitions to answered state
- [ ] Verify agent resumes after answer
- [ ] Session table shows correct agent status
(working/idle/waiting_input)
- [ ] Detail page shows correct agent status
- [ ] Refresh page — verify chat history is preserved (no namespace bug)
- [ ] Navigate away from session detail and back to sessions list —
verify list refreshes immediately

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ambient Code Bot <bot@ambient-code.local>
Co-authored-by: ambient-code[bot] <ambient-code[bot]@users.noreply.github.com>
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.

1 participant