fix(cli,web,agent): cover reaction + filter cleanup gaps (#562)#568
Open
axisrow wants to merge 3 commits into
Open
fix(cli,web,agent): cover reaction + filter cleanup gaps (#562)#568axisrow wants to merge 3 commits into
axisrow wants to merge 3 commits into
Conversation
- dialogs react: add --yes confirm in CLI, /dialogs/react web endpoint via TelegramCommandDispatcher, send_reaction agent tool with require_confirmation - filter purge: require interactive confirmation in CLI (--yes to skip) - filter reset: add --pks selective mode in CLI and /filter/reset-selected in web with new ChannelAnalyzer.reset_filters_for_pks helper - filter hard-delete: add /filter/hard-delete-all web endpoint to mirror CLI - update parity table and TELEGRAM_ACTION_INVENTORY for send_reaction - update affected tests to pass yes=True Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR closes parity and safety gaps around Telegram reactions and filter cleanup by adding confirmation gates, web/agent entrypoints, and selective filter reset support.
Changes:
- Adds CLI confirmation for
dialogs reactandfilter purge, plus selectivefilter reset --pks. - Adds web endpoints/buttons for reaction, selective reset, and dev-mode hard-delete all.
- Adds agent
send_reactiontool and updates action inventory/parity docs.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/cli/commands/dialogs.py |
Adds confirmation before sending reactions. |
src/cli/commands/filter.py |
Adds purge confirmation and selective filter reset handling. |
src/cli/parser_domains/dialogs.py |
Adds --yes/-y to dialogs react. |
src/cli/parser_domains/filter.py |
Adds reset --pks and purge --yes. |
src/filters/analyzer.py |
Adds selective filter reset by channel PK. |
src/web/routes/dialogs.py |
Adds POST /dialogs/react command enqueue route. |
src/web/dialogs/forms.py |
Adds reaction form model. |
src/web/routes/filter.py |
Adds filter hard-delete-all and reset-selected endpoints. |
src/web/templates/filter_manage.html |
Adds web buttons/forms and selection syncing for new filter actions. |
src/services/telegram_command_dispatcher.py |
Adds dispatcher handler for dialogs.react. |
src/services/telegram_action_inventory.py |
Marks reaction as covered by web and agent surfaces. |
src/agent/tools/messaging_write.py |
Adds agent send_reaction tool. |
src/agent/tools/messaging_schemas.py |
Adds reaction tool schema. |
src/agent/tools/permissions.py |
Adds reaction tool to write permissions and UI grouping. |
docs/reference/parity.md |
Documents reaction parity across CLI/web/agent. |
tests/test_cli.py |
Updates purge tests to skip new confirmation. |
tests/test_cli_filter.py |
Updates filter purge tests for --yes. |
tests/test_cli_commands_edge_cases.py |
Updates edge-case purge tests for --yes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| analyzer = ChannelAnalyzer(db) | ||
| count = await analyzer.reset_filters_for_pks(pks) | ||
| return RedirectResponse( | ||
| url=f"/channels/filter/manage?msg=filter_reset_selected&count={count}", |
- reset_filters_for_pks: single bulk UPDATE in repo instead of N+1 per-pk loop - _handle_dialogs_react: drop echoed message_id/emoji from payload to match sibling dispatcher handlers Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Closes the trust-boundary gap Codex flagged in PR #568 adversarial review: on installs with a saved per-phone ACL, any tool missing from the JSON (notably newly-introduced WRITE/DELETE actions like send_reaction) implicitly received permission for every phone. - _default_permissions(for_missing_in_saved=True): READ keeps default True, WRITE/DELETE default False. Used by load_tool_permissions, load_tool_permissions_all_phones, load_tool_permissions_union and the save-side seeding for unsaved accounts. - require_phone_permission: branch on ToolCategory. READ keeps the legacy permissive fallbacks (no allowed_phones / phone not in perms → allow). WRITE/DELETE require an explicit per-phone grant once any ACL exists, route through PermissionGate when available, or return a text error pointing to the settings page. Legacy flat ACL is handled symmetrically: known-True allows, READ falls through, WRITE/DELETE without an entry deny. - Clean installs without saved ACL keep the existing permissive behaviour (all tools enabled). - Update three tests that previously locked in the bypass and add coverage: per-phone missing WRITE/DELETE → False; union missing WRITE/DELETE → False; legacy flat missing WRITE → deny; regression test for send_reaction blocked on restrictive legacy ACL. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the gaps audited in #562 across reaction action and filter cleanup commands.
dialogs reactnow requires confirmation (--yesto skip); new web endpointPOST /dialogs/reactrouted through the existingTelegramCommandDispatcher; new agent toolsend_reactionwith standardrequire_confirmationgate.--yesto skip). Web already shows the affected set via checkboxes.--pksin CLI and a/filter/reset-selectedendpoint + "Сбросить выбранные" button in web. NewChannelAnalyzer.reset_filters_for_pkskeeps the analyzer API additive./filter/hard-delete-allendpoint + red "Удалить все из БД" button (dev-mode only) so web matches the CLI capability.TELEGRAM_ACTION_INVENTORY(send_reactionnow listsweb_command+agent_tool) and the parity table.Test plan
ruff check src/ tests/ conftest.pypytest tests/test_telegram_action_contract.py -v(4 passed)pytest tests/ -m "not aiosqlite_serial" -n auto(6947 passed, 2 skipped)pytest tests/ -m aiosqlite_serial(821 passed)python -m src.main dialogs react @chan 123 👍shows confirm promptpython -m src.main filter purgeshows confirm promptpython -m src.main filter reset --pks 1,2resets only listed channels/channels/filter/manageshows new "Сбросить выбранные" + "Удалить все из БД" buttons🤖 Generated with Claude Code