feat(kanban): per-call subscribe API with atomic notification subscription - #29913
Closed
crayfish-ai wants to merge 1 commit into
Closed
feat(kanban): per-call subscribe API with atomic notification subscription#29913crayfish-ai wants to merge 1 commit into
crayfish-ai wants to merge 1 commit into
Conversation
…scription Adds a subscribe= parameter to create_task() that creates a notification subscription inside the same write transaction as the task row. Key design decisions: - DB-layer subscribe param on create_task() — atomic with task creation - Session context is resolved at call sites via get_session_env() (task-local contextvars, not process-global os.environ) - Tool handler resolves from gateway session context; CLI from explicit --subscribe-* flags - notifier_profile is forwarded to support the gateway notifier watcher - _add_notify_sub_inner() is the write_txn-safe helper for internal use Unlike prior approaches, this does NOT rely on ambient environment variable fallback inside the DB layer — every subscription must be explicitly requested by the caller.
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
Adds a subscribe= parameter to create_task() that creates a notification subscription inside the same write transaction as the task row, and wires it to the tool handler via gateway.session_context.get_session_env() and to the CLI via explicit --subscribe-* flags.
Changes (143 lines, 3 files)
kanban_db.py (+76/-1)
_resolve_subscribe_dict()helper: normalises a caller-supplied subscribe dictcreate_task(..., subscribe=...)parameter for per-call notification subscription_add_notify_sub_inner()helper designed to run inside an existing write_txntools/kanban_tools.py (+24)
gateway.session_context.get_session_env()(task-local contextvars, safe for concurrent gateway sessions)kanban.py (+44)
_build_subscribe_from_args()helper--subscribe-platform,--subscribe-chat-id,--subscribe-thread-id,--subscribe-user-idCLI flagsKey differences from prior approaches
--subscribe-*flagsTest Results