Skip to content

Mattermost UI bridge: source filter + legacy archi_service backfill#5

Open
hassan11196 wants to merge 2 commits into
fix/pr-543-reviewfrom
feat/mattermost-chat-ui-bridge
Open

Mattermost UI bridge: source filter + legacy archi_service backfill#5
hassan11196 wants to merge 2 commits into
fix/pr-543-reviewfrom
feat/mattermost-chat-ui-bridge

Conversation

@hassan11196

@hassan11196 hassan11196 commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

PR archi-physics#543 already plumbed Mattermost conversations into the cross-source list query, surfaced archi_service in the API response, and added the sidebar badge. This PR fills the two remaining gaps so Mattermost-originated chats are fully equivalent to web chats in the UI.

Changes

  • scripts/backfill_mattermost_archi_service.py — idempotent backfill for deployments that ran the Mattermost service pre-PR-543. Heuristic: any conversation_metadata row whose client_id matches mm_user_% was created by ThreadContextManager and should have archi_service = 'mattermost'. Defaults to dry-run; --apply performs the UPDATE. Prints a sample of affected rows in either mode so operators can sanity-check first.
  • src/interfaces/chat_app/app.py:list_conversations — accept an optional ?source=all|chat|mattermost|api query parameter. Rejects unknown values with 400. Filters post-fetch so the existing cross-source SQL stays unchanged. Also replaces a stray print() error path with logger.error().

Test plan

  • pytest tests/unit/test_list_conversations_source_filter.py — 10/10 green locally
  • Run scripts/backfill_mattermost_archi_service.py against a dev DB (dry-run first, then --apply) and confirm row counts
  • Hit GET /api/list_conversations?source=mattermost and confirm only Mattermost-originated rows are returned
  • Hit GET /api/list_conversations?source=bogus and confirm 400

@hassan11196 hassan11196 force-pushed the feat/mattermost-chat-ui-bridge branch from 8b1115f to 3d9789e Compare May 14, 2026 09:35
@hassan11196 hassan11196 force-pushed the feat/mattermost-chat-ui-bridge branch 2 times, most recently from fdb81d4 to 28c8fc8 Compare May 14, 2026 09:48
langgraph-prebuilt 1.0.9+ imports ExecutionInfo from langgraph.runtime,
a symbol that only exists in langgraph 1.2+. With langgraph==1.0.2
pinned (which declares langgraph-prebuilt<1.1.0), pip's resolver still
picks up langgraph-prebuilt==1.0.13 (the highest matching minor), and
the resulting environment fails to import langchain.tools.tool_node at
test collection time:

    ImportError: cannot import name 'ExecutionInfo' from 'langgraph.runtime'

Pinning langgraph-prebuilt==1.0.8 (the last release before the
ExecutionInfo import was added) makes the resolved environment
self-consistent again. Mirrored in both Dockerfile requirement files
since they're build-time copies of requirements-base.txt.
PR archi-physics#543 already plumbed Mattermost conversations into the cross-source
list query, surfaced archi_service in the API response, and added the
sidebar badge. This PR fills the two remaining gaps:

  scripts/backfill_mattermost_archi_service.py
    Idempotent backfill for deployments that ran the Mattermost service
    pre-PR-543. Heuristic: any conversation_metadata row whose client_id
    matches 'mm_user_%' was created by ThreadContextManager and should
    have archi_service = 'mattermost'. Defaults to dry-run; --apply
    performs the UPDATE. Prints a sample of affected rows in either
    mode so operators can sanity-check before applying.

  src/interfaces/chat_app/app.py:list_conversations
    Accept an optional ?source=all|chat|mattermost|api query parameter.
    Rejects unknown values with a 400. Filters post-fetch so the
    existing cross-source SQL stays unchanged. Also replaces a stray
    print() error path with logger.error().

  tests/unit/test_list_conversations_source_filter.py
    10 cases covering the filter behaviour and validator. Uses a
    pure-Python replica of the inline filter so no Flask/Postgres is
    needed in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant