#21596: Feat/chatloop
app: web-ui
size: M
## Summary
Describe the problem and fix in 2–5 bullets:
- Problem:
- Why it matters:
- What changed:
- What did NOT change (scope boundary):
## Change Type (select all)
- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [ ] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #
- Related #
## User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write `None`.
## Security Impact (required)
- New permissions/capabilities? (`Yes/No`)
- Secrets/tokens handling changed? (`Yes/No`)
- New/changed network calls? (`Yes/No`)
- Command/tool execution surface changed? (`Yes/No`)
- Data access scope changed? (`Yes/No`)
- If any `Yes`, explain risk + mitigation:
## Repro + Verification
### Environment
- OS:
- Runtime/container:
- Model/provider:
- Integration/channel (if any):
- Relevant config (redacted):
### Steps
1.
2.
3.
### Expected
-
### Actual
-
## Evidence
Attach at least one:
- [ ] Failing test/log before + passing after
- [ ] Trace/log snippets
- [ ] Screenshot/recording
- [ ] Perf numbers (if relevant)
## Human Verification (required)
What you personally verified (not just CI), and how:
- Verified scenarios:
- Edge cases checked:
- What you did **not** verify:
## Compatibility / Migration
- Backward compatible? (`Yes/No`)
- Config/env changes? (`Yes/No`)
- Migration needed? (`Yes/No`)
- If yes, exact upgrade steps:
## Failure Recovery (if this breaks)
- How to disable/revert this change quickly:
- Files/config to restore:
- Known bad symptoms reviewers should watch for:
## Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write `None`.
- Risk:
- Mitigation:
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds a new "Chat (loop)" tab that implements a dual-input UI workflow: Claude's response auto-fills a secondary textarea, which can be edited and sent to GPT-5.2 via a sub-session, with the GPT response then populating the main input field.
**Key changes:**
- New `/chatloop` route and tab with dual-textarea UI
- `sendChatLoop()` function creates a `LOOP_SESSION_KEY` sub-session with `LOOP_MODEL` (`openai/gpt-5.2`) override
- Uses polling (`chat.history` every 1s for up to 60s) to wait for GPT-5.2 response
- Auto-fills loop draft with last assistant message when in chatloop tab
- CSS transitions for expanding/collapsing textareas on focus
**Issues found:**
- Polling logic may miss responses if the same text is returned twice consecutively
- `sessions.patch` error handling assumes auto-creation but the RPC doesn't create sessions
- Tab-switching doesn't trigger draft filling (only happens if already on chatloop when message arrives)
- Sustained polling load with no exponential backoff
- Unused `loadChatLoopSystemPrompt()` function
- Korean placeholder text mixed with English UI
<h3>Confidence Score: 3/5</h3>
- This PR adds a new experimental feature with several logical issues that could cause silent failures or unexpected behavior in production.
- Score reflects multiple functional bugs (polling logic, error handling, tab-switching) and performance concerns (sustained polling load). The feature works for the happy path but has edge cases that will cause silent failures. Not critical since it's an additive feature, but needs fixes before widespread use.
- Pay close attention to `ui/src/ui/app-gateway.ts` - contains the polling logic, error handling, and session management bugs that need to be addressed.
<sub>Last reviewed commit: c146f54</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#13548: feat(control-ui): Add quote reply and send message to session features
by Annaxiebot · 2026-02-10
77.1%
#22798: feat(webchat): ChatGPT-style multi-chat threads with generated titles
by opnsec · 2026-02-21
77.0%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
76.2%
#14309: fix(ui): resolve chat event session key mismatch
by justonlyforyou · 2026-02-11
76.2%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
75.3%
#6521: fix: addressed style issue for chat compose and thread on mobile
by spencer-rafada · 2026-02-01
74.6%
#7127: fix(webchat): add regenerate flag to prevent context leak on response…
by craihub · 2026-02-02
74.5%
#7528: feat: Adds slash command suggestions to chat
by JohnnyD1776 · 2026-02-02
74.1%
#9218: Fix Control UI chat resync on gaps and terminal events
by figitaki · 2026-02-05
74.1%
#20347: fix(webchat): resolve streaming scroll race condition
by ndaemy · 2026-02-18
73.3%