Skip to content

Fix/20260331#818

Merged
paullizer merged 13 commits intoDevelopmentfrom
fix/20260331
Apr 2, 2026
Merged

Fix/20260331#818
paullizer merged 13 commits intoDevelopmentfrom
fix/20260331

Conversation

@paullizer
Copy link
Copy Markdown
Contributor

  • Cross-Cloud Deployment Improvements

    • Updated the Azure CLI, AZD, Bicep, and Terraform deployment paths to better align with the current SimpleChat runtime configuration and reduce post-deployment manual fixes.
    • Added optional Azure Video Indexer deployment support with cloud-aware defaults, including the correct endpoint and ARM API version handling for Azure Commercial, Azure Government, and registered custom clouds.
    • (Ref: deployers/azure.yaml, deployers/azurecli/deploy-simplechat.ps1, deployers/bicep/main.bicep, deployers/bicep/modules/videoIndexer.bicep, deployers/terraform/main.tf, application/single_app/functions_settings.py)
  • Python Runtime Dependency Refresh and Supply-Chain Hardening

    • Continued the requirements hardening work from v0.240.014 by tightening the main application runtime to exact package pins, reducing dependency drift across local development, CI, and Azure deployments to help mitigate supply-chain exposure.
    • Upgraded the Flask runtime stack to Flask==3.1.3 and Werkzeug==3.1.6, and updated the shared Markup import path to markupsafe so the app starts correctly with Flask 3's package boundary changes.
    • Refreshed key runtime dependencies including gunicorn, requests, openai, Markdown, markdown2, azure-ai-projects, azure-ai-agents, pyjwt, pypdf, semantic-kernel, protobuf, redis, pyodbc, PyMySQL, cython, and aiohttp to pick up current security, compatibility, and capability improvements while keeping builds reproducible.
    • (Ref: application/single_app/requirements.txt, application/single_app/config.py, functional_tests/test_flask_markup_import_fix.py, docs/explanation/fixes/FLASK_31_MARKUP_IMPORT_FIX.md)
  • Dependency Pinning and Requirements Hardening

    • Pinned previously floating Python package requirements to exact versions across the main app, UI test, deployer, and external app requirement files to reduce unexpected dependency drift and tighten supply-chain control.
    • Corrected stale external app dependency entries by replacing dotenv with python-dotenv, removing the stdlib-only logging package, removing an unused Flask requirement from the databaseseeder utility, and adding pytest-playwright so the UI test dependency set matches the pytest fixture usage in the test suite.
    • (Ref: application/single_app/requirements.txt, ui_tests/requirements.txt, deployers/bicep/requirements.txt, application/external_apps/databaseseeder/requirements.txt, application/external_apps/bulkloader/requirements.txt)
  • Assistant Citation Artifact Storage for Large Tabular Payloads

    • Moved large raw tabular and tool citation payloads off the main assistant message document and into linked child artifact records so tool-heavy answers stay compact in primary chat storage.
    • Added helper flows in functions_message_artifacts.py to keep a compact citation summary on the assistant message, externalize the full raw citation payload into assistant_artifact records with assistant_artifact_chunk support for larger payloads, and rehydrate those raw payloads later for exports or deeper inspection.
    • Assistant messages now keep compact summaries such as tool name, reduced arguments, counts, and a few sample rows while the heavy raw citation payload is referenced through artifact_id and raw_payload_externalized=True.
    • Updated chat persistence to store the linked artifact records during message save, excluded those artifact records from normal chat history and conversation views, and updated export flows to stitch the preserved raw payloads back together when needed.
    • This reduced primary assistant message size, lowered the risk of hitting Cosmos DB per-item limits on large tabular responses, reduced heavy citation data carried through normal chat reads, and preserved the full raw evidence for export and debugging.
    • Additional size reductions in the same phase compacted stored citation summaries, dropped noisy tabular citation arguments such as user_id, conversation_id, and source, and removed the duplicate user_message field from assistant message documents.
    • (Ref: functions_message_artifacts.py, route_backend_chats.py, route_backend_conversations.py, route_frontend_conversations.py, route_backend_conversation_export.py, test_assistant_citation_artifact_storage.py, ASSISTANT_CITATION_ARTIFACT_STORAGE_FIX.md)

…asets

What we did in part one was move the large raw tabular/tool payloads off the main assistant message and store them as linked child records instead. The core code is in functions_message_artifacts.py. We added helpers to:

Build a compact citation that stays on the assistant message.
Store the full raw citation payload in separate assistant_artifact records, with assistant_artifact_chunk records if the payload is large enough to need chunking.
Rehydrate those raw payloads later when an export or deep inspection needs the full data again.
In practice, that meant the assistant message no longer carried the full tabular function_result blob. It only kept a summary like tool name, compact arguments, counts, and a few sample rows. The heavy payload was externalized with an artifact_id and raw_payload_externalized=True. That is the “large assistant-side payloads outside primary chat items” change you’re remembering.

The chat write path was updated in route_backend_chats.py to persist those artifact records via persist_agent_citation_artifacts(...). The normal conversation/history paths were updated to hide those artifact records from visible chat history with filter_assistant_artifact_items(...) in route_backend_conversations.py and route_frontend_conversations.py. Export paths were updated to stitch the raw payload back together with build_message_artifact_payload_map(...) and hydrate_agent_citations_from_artifacts(...) in route_backend_conversation_export.py.

Why that helped performance and reliability:

It kept the main assistant message much smaller.
It prevented large tabular citations from pushing a single Cosmos message item over size limits.
It reduced the amount of heavy citation data carried around in normal chat reads/history assembly.
It preserved the raw data for export/debugging instead of throwing it away.
A few extra size cuts were part of that same phase:

We compacted stored citation summaries instead of keeping the full raw result on the main message.
We excluded noisy args like user_id, conversation_id, and source from compact tabular citation arguments in functions_message_artifacts.py.
We also removed the duplicate user_message field from assistant message docs, as called out in ASSISTANT_CITATION_ARTIFACT_STORAGE_FIX.md.
@paullizer paullizer requested a review from Copilot April 2, 2026 14:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bundles several runtime, UX, and reliability improvements across SimpleChat, including hardened dependency pinning, safer template bootstrapping, workspace UX fixes, and a new storage pattern for large assistant citation payloads.

Changes:

  • Externalize large assistant agent_citations into linked Cosmos “artifact” child records (with hydration for exports and filtering for normal history views).
  • Harden workspace/chat UI behavior (endpoint-disabled quiet load, autofill metadata markers, safer chat bootstrap rendering, improved plugin validation/save error surfacing).
  • Refresh/pin dependencies across the app, deployers, UI tests, and external utilities, plus documentation/release-note updates for the shipped fixes/features.

Reviewed changes

Copilot reviewed 56 out of 57 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
ui_tests/test_workspace_page_endpoint_disabled_quiet.py UI regression to ensure workspace doesn’t call disabled endpoints API when tab is hidden
ui_tests/test_workspace_page_autofill_metadata.py UI regression validating autofill-ignore metadata on workspace modal/build surfaces
ui_tests/test_group_workspace_page_autofill_metadata.py UI regression validating autofill-ignore metadata on group workspace surfaces
ui_tests/test_chat_page_multi_endpoint_notice_render.py UI smoke test for authenticated chats render + multi-endpoint notice bootstrap robustness
ui_tests/requirements.txt Pins UI test dependencies and adds pytest-playwright
functional_tests/test_workspace_endpoint_disabled_state_quiet.py Functional regression for endpoint module gating + quiet disabled handling
functional_tests/test_workspace_autofill_overlay_metadata.py Functional regression for workspace autofill metadata normalization
functional_tests/test_tabular_relational_analysis_helpers.py Functional regression for new deterministic tabular relational helpers + relationship hints
functional_tests/test_tabular_raw_tool_fallback.py Extends fallback regressions to enforce prompt-budgeted compaction
functional_tests/test_tabular_multisheet_workbook_support.py Updates multi-sheet orchestration regressions and query guidance assertions
functional_tests/test_tabular_entity_lookup_mode.py Extends entity-lookup regressions for anchor scoring + sheet selection logic
functional_tests/test_reasoning_effort_initial_sync.py Updates startup ordering regression and adds legacy model restore assertions
functional_tests/test_plugin_validation_managed_fields_compatibility.py Regression ensuring persisted audit fields don’t break plugin validation
functional_tests/test_group_workspace_autofill_overlay_metadata.py Functional regression for group workspace autofill metadata normalization
functional_tests/test_flask_markup_import_fix.py Regression for Flask 3 Markup import path + fix documentation presence
functional_tests/test_chat_template_json_bootstrap_safety.py Regression ensuring chats template avoids JSON.parse string bootstrap
functional_tests/test_chat_multi_endpoint_notice_template_fallback.py Regression ensuring multi-endpoint notice is safe-defaulted and bootstrap-safe
functional_tests/test_assistant_citation_artifact_storage.py Regression for citation artifact externalization + hydration behavior
docs/Gemfile.lock Dependency updates for docs site build
docs/explanation/release_notes.md Moves PR’s release-note entries under a newer version section
docs/explanation/fixes/WORKSPACE_PLUGIN_VALIDATION_AUDIT_FIELDS_FIX.md Fix doc for managed/audit fields plugin validation compatibility
docs/explanation/fixes/WORKSPACE_ENDPOINTS_DISABLED_TOAST_FIX.md Fix doc for quiet behavior when endpoints are disabled
docs/explanation/fixes/WORKSPACE_AUTOFILL_OVERLAY_METADATA_FIX.md Fix doc for workspace autofill overlay hardening
docs/explanation/fixes/TABULAR_PROMPT_BUDGET_FALLBACK_FIX.md Fix doc for prompt-budget truncation/compaction in tabular fallbacks
docs/explanation/fixes/TABULAR_NAMED_MEMBER_SHARE_SEMIJOIN_FIX.md Fix doc for deterministic named-member share behavior via semi-join
docs/explanation/fixes/TABULAR_MULTISHEET_ENTITY_LOOKUP_RELIABILITY_FIX.md Fix doc for entity-lookup multi-sheet reliability and error clarity
docs/explanation/fixes/GROUP_WORKSPACE_AUTOFILL_OVERLAY_METADATA_FIX.md Fix doc for group workspace autofill overlay hardening
docs/explanation/fixes/FLASK_31_MARKUP_IMPORT_FIX.md Fix doc for Flask 3 Markup import compatibility
docs/explanation/fixes/CHAT_TEMPLATE_JSON_BOOTSTRAP_FIX.md Fix doc for removing JSON.parse-based bootstrap in chats template
docs/explanation/fixes/CHAT_LEGACY_MODEL_SELECTION_RESTORE_FIX.md Fix doc for restoring legacy preferred model selection
docs/explanation/fixes/ASSISTANT_CITATION_ARTIFACT_STORAGE_FIX.md Fix doc for storing large assistant citation payloads as artifacts
docs/explanation/features/TABULAR_RELATIONAL_ANALYSIS_HELPERS.md Feature doc for deterministic relational helpers and relationship hints
deployers/bicep/requirements.txt Pins Bicep deployer Python deps
application/single_app/templates/workspace.html Adds autofill-ignore metadata + endpoint module gating + metadata normalization helper
application/single_app/templates/group_workspaces.html Adds autofill-ignore metadata + endpoint module gating + metadata normalization helper
application/single_app/templates/chats.html Removes JSON.parse bootstrap, adds safe defaults for multi-endpoint notice
application/single_app/templates/_multiendpoint_modal.html Adds autofill-ignore metadata for endpoint modal + password fields
application/single_app/templates/_agent_modal.html Adds autofill-ignore metadata for agent modal container
application/single_app/static/js/workspace/workspace_plugins.js Surfaces real validation errors and backend save error messages
application/single_app/static/js/workspace/workspace_plugins_new.js Same validation/save error surfacing for the newer workspace plugin flow
application/single_app/static/js/workspace/workspace_model_endpoints.js Skips init when UI absent + quiet handling for “endpoints disabled” responses
application/single_app/static/js/plugin_common.js Adds getErrorMessageFromResponse() helper for consistent error extraction
application/single_app/static/js/chat/chat-model-selector.js Restores legacy preferred model selection before selector refresh
application/single_app/static/js/admin/admin_plugins.js Better validation error display + backend error extraction on save
application/single_app/static/js/admin/admin_plugins_new.js Same validation/save error surfacing for the newer admin plugin flow
application/single_app/route_frontend_conversations.py Filters out assistant artifact records from conversation views
application/single_app/route_backend_plugins.py Expands validation sanitization for storage-managed plugin fields
application/single_app/route_backend_conversations.py Filters artifacts from message APIs and cascades deletion to child docs
application/single_app/route_backend_conversation_export.py Rehydrates agent citations from artifact records during export
application/single_app/route_backend_chats.py Persists citation artifacts + prompt-budget compaction + improved workbook routing guidance
application/single_app/requirements.txt Pins/updates main runtime dependencies (Flask 3, Werkzeug, etc.)
application/single_app/json_schema_validation.py Adds shared storage-managed field stripping for plugin validation
application/single_app/functions_message_artifacts.py New artifact storage/hydration helpers for large assistant payloads
application/single_app/config.py Moves Markup import to markupsafe and bumps VERSION
application/external_apps/databaseseeder/requirements.txt Pins deps and replaces dotenv with python-dotenv
application/external_apps/bulkloader/requirements.txt Pins deps and replaces dotenv with python-dotenv

@paullizer paullizer merged commit ec117ec into Development Apr 2, 2026
5 checks passed
@paullizer paullizer deleted the fix/20260331 branch April 2, 2026 14:59
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.

2 participants