feat(gateway): add LINE quick reply approvals - #35682
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused LINE UX improvement. Current main still has no LINE send_exec_approval or send_slash_confirm override (plugins/platforms/line/adapter.py:1079-1146), so the feature remains useful.
Problems
plugins/platforms/line/adapter.py:1139-1140emits/alwaysand/cancel, but neither is a registered command (hermes_cli/commands.py:64-255).should_bypass_active_session()only bypasses resolvable commands (hermes_cli/commands.py:388-408), so an active session queues these replies before the slash-confirm interceptor atgateway/run.py:9127-9153can resolve them.- The new direct-send path at
plugins/platforms/line/adapter.py:1197leaves a current slow-response_pending_buttonsentry live.LineAdapter.send()then caches the next normal response instead of delivering it (plugins/platforms/line/adapter.py:1095-1102). The new test fixture omits_pending_buttonsand_cache(tests/gateway/test_line_quick_reply.py:33-38), so it misses this interaction.
Suggested changes
- Make pending slash-confirm replies bypass active-session routing generically, including Always and Cancel, and test all three quick-reply choices during an active session.
- Define and test the slow-response-cache interaction so approval acknowledgement and final output remain deliverable.
Automated hermes-sweeper review.
| _text_message(text), | ||
| [ | ||
| (self._label("allow_once"), "/approve"), | ||
| (self._label("always_allow"), "/always"), |
There was a problem hiding this comment.
/always and /cancel are not registered slash commands on current main, so should_bypass_active_session() returns false. When the session is active, BasePlatformAdapter queues these replies before the runner's slash-confirm interceptor can see them; the Always and Cancel chips need a generic active-session dispatch path or a callback-based flow.
| if not self._client: | ||
| return SendResult(success=False, error="LINE adapter not connected") | ||
|
|
||
| token, used_reply = self._consume_reply_token(chat_id) |
There was a problem hiding this comment.
This direct path does not clear an existing LINE _pending_buttons slow-response cache entry. On current main, the acknowledgement/final response subsequently sent through send() is cached instead of delivered. Handle that state and add coverage with _pending_buttons plus _cache initialized.
What does this PR do?
Adds LINE quick-reply prompts for gateway approval flows, while keeping the actual decision payloads on the existing slash-command path.
LINE users now get quick replies for dangerous command approvals and destructive slash confirmations. The visible labels are localized through Hermes i18n (
display.language) with LINE-specific overrides viaLINE_LANGUAGE,LINE_LOCALE,extra.language, orextra.locale. The quick-reply message text remains stable (/approve,/approve session,/approve always,/deny,/always,/cancel) so the gateway's existing approval handlers continue to resolve the flow.This PR intentionally does not include the LINE media enum fix; that is split into #35681 to keep both PRs focused.
Related Issue
No issue filed.
Related prior PRs found during duplicate search:
This PR differs by using LINE Quick Reply message actions that feed the existing slash-command approval path, plus locale-aware labels and focused adapter tests.
Type of Change
Changes Made
plugins/platforms/line/adapter.pysend_exec_approval()support for dangerous command approvals.send_slash_confirm()support for destructive slash confirmations.plugins/platforms/line/plugin.yamlLINE_LANGUAGEandLINE_LOCALE.locales/*.yamlgateway.line_quick_reply.*labels across all locale catalogs.tests/gateway/test_line_quick_reply.pyHow to Test
python3 -m py_compile plugins/platforms/line/adapter.py tests/gateway/test_line_quick_reply.py agent/i18n.pygit diff --checkrg -l "line_quick_reply:" localesrg -l " deny:" localesrg -n "LINE_LANGUAGE|LINE_LOCALE" plugins/platforms/line/plugin.yamlscripts/run_tests.sh tests/gateway/test_line_quick_reply.pyscripts/run_tests.sh tests/gatewaypytest tests/ -qNote: Full
pytest tests/ -qwas not completed locally. Broader gateway coverage was attempted and has one unrelated local failure intests/gateway/test_shutdown_forensics.py::TestSpawnAsyncDiagnostic::test_spawns_subprocess_and_writes_output.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/A: updatedplugins/platforms/line/plugin.yamlsetup metadatacli-config.yaml.exampleif I added/changed config keys — or N/A: N/A, LINE plugin setup metadata is inplugin.yamlCONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A: N/AScreenshots / Logs
N/A. Local checks run on this branch: