feat(session): add match and except filters - #198
Merged
Merged
Conversation
git fetch origin master
git rebase origin/master
# after resolving the conflicts
git push --force-with-leaseThe |
Allow operators to restrict forwarded human messages per directed edge with /session filter after a watch or connect exists. Fixes #195 AI-Generated: true Generated-At: 2026-09-15T02:55:53Z
Re-read the stored edge under the lock before committing match/except, and treat a missing store update as a miss. AI-Generated: true Generated-At: 2026-09-15T03:55:12Z
Pass get_self_id through the session-bridge test manager so subject filters still rebuild after rebasing onto pair. AI-Generated: true Generated-At: 2026-09-15T04:04:31Z
BegoniaHe
force-pushed
the
feat/session-bridge-filter-195
branch
from
September 15, 2026 04:04
de312e4 to
e5948ac
Compare
|
✅ Conflicts resolved; removing the |
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
Add post-create
/session filterso each directed session-bridge edge caninclude or exclude human messages by authorization subject, source-session
AstrBot role, or portable text.
Related issue
Fixes #195
Behavior
matchandexceptstill forward every human message.subjectsrebuildSubject.imfrom the source route platform id, the source adapterself_id, andSenderSnapshot.id.rolesuse the sender's AstrBot role on the source session, notplatform_member_role. Lookup miss isguest.textconcatenatesPortablePartstring values and uses stdlibre.search. Invalid patterns are rejected at save time. Media-only bodies failmatch.textand do not tripexcept.text./session filter <rule_id>shows the filter;match/except/clearchange one edge.clearwithout a side equalsall. Pair edges can differ.Non-goals
/session watch,connect, orpairreregex engineRolefiltermethods (links/unlink/filterstay IM-only)Implementation notes
Evaluation lives in
session_bridge_filter.pyand runs inobserve()beforethe source header is added. Filters persist in the S1
match/exceptJSONcolumns. View and mutate scope match
links/unlink.Validation
make checkandmake test-blockingwere not run.Compatibility and risk
No schema change. Existing empty filters keep forwarding all human messages.
Role lookup adds a
session.readauthorize call only when a role filter is set.Checklist
docs/zh/anddocs/en/.docs/public/openapi.json, and tests change together when routes or schemas change.pyproject.toml,requirements.txt, anduv.locktogether.!and aBREAKING CHANGE:footer.Agent note
S3 of #192 / #195. Goal: post-create match/except filters on directed edges.
Touched
session_bridge_filter.py,session_bridge.py,session_bridge_state.py,/session filter, bilingual command docs, and session-bridge/command tests.Checks run: ruff format/check on the touched Python files; 117 focused pytest
tests passed. Residual risk: pair live-index still belongs to S2; this slice
persists pair-edge filters and evaluates live watch/connect grants. Tools:
OpenCode / grok-4.6.