Repository navigation
feat(context): direct O&M messages + episodic history for notify judgment and staff/customer chat - #204
Merged
Conversation
…cess to O&M messages and episodic history Grid-analysis chat only reached O&M Telegram chat via an on-demand, staff-only tool the model had to think to call -- a real conversation showed alarm data surfacing first and the actual (O&M-reported) root cause only after being asked to check for it. Notify's alert-judgment prompt already direct-fetched O&M messages but had no episodic distillation at all, and runs as a single-shot LLM call with no tool access, so a tool-based fix was never on the table there. Adds shared grid_context_feeds.py, reused by both flows: O&M messages (staff-only, matching the existing chronology tool's visible_to_customer=False) and episodic distillation (safe for customer scope too, reusing EpisodicProvider's own access gate) are now fetched directly and bounded by count/char caps rather than the knowledge-module system's shared token budget, which isn't wired into the notify flow at all. Bumps O&M per-message truncation from 500 to 1000 chars in both flows -- free-text field reports read worse cut off at 500 than bot-rendered prior-alert content does, which keeps the original cap. Extends providers_episodic.py with reusable anchor-resolution/fetch functions (resolve_episodic_anchor, fetch_distillation_summary, fetch_episodic_summary) so neither new call site needs a KnowledgeModule just to reach the same distillation EpisodicProvider already serves. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
2 tasks done
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
chat_orchestrator/orchestrator/services/grid_context_feeds.py, shared by both flows: O&M messages (staff-only, matchingcustomer_get_grid_chat_chronology's ownvisible_to_customer=False) and episodic distillation (safe for customer scope too — reusesEpisodicProvider's own access gate) are now fetched directly and bounded by count/char caps, bypassing the knowledge-module system's shared token budget, which isn't wired into the notify flow at all.providers_episodic.pygets reusableresolve_episodic_anchor/fetch_distillation_summary/fetch_episodic_summaryfunctions so neither new call site needs aKnowledgeModulejust to reach the same distillationEpisodicProvideralready serves —EpisodicProvider.resolve()itself now delegates tofetch_episodic_summary, same behavior, less duplication.staff.system,customer.system, andticketing.correlationexplaining the new context blocks. Note:staff.systemandcustomer.systemare live-served from a Google Doc / DB override respectively in production — these bundled-file edits are the fallback copy, not what's live. The live doc/DB versions need a separate update after this merges (tracked outside this PR).Test plan
pytest— fullchat_orchestratorsuite (2539 passed; 1 pre-existing unrelated failure confirmed present onmaintoo)pytest shared/tests/(921 passed; 1 pre-existing unrelated failure confirmed present onmaintoo, caused by stale local.worktrees/dirs)test_grid_context_feeds.py,test_prepare_context_grid_feeds.py, plus additions totest_alert_judgment_context.py,test_correlator.py,test_notify_alert_delivery_repository.py,test_providers_episodic.pyprompt_checksums.jsonregenerated and diff reviewed — only the three touched prompts changedruff checkcleanpre-commit run --all-filesclean (test-wiring, loguru guard, operator-data scrub all pass)🤖 Generated with Claude Code