Skip to content

Add Microsoft 365 actions, approvals, and delegated workflow execution - #1497

Open
Paul Lizer (paullizer) wants to merge 5 commits into
Developmentfrom
paullizer-sharepoint-file-sync
Open

Paul Lizer (paullizer) wants to merge 5 commits into
Developmentfrom
paullizer-sharepoint-file-sync

Conversation

@paullizer

@paullizer Paul Lizer (paullizer) commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add separate Microsoft 365 Calendar, Email, OneDrive, and SharePoint Online (SPO) actions with delegated user access, live file RAG, and cloud-aware Copilot Retrieval/Graph selection. No PAYG, workspace file sync, or Azure AI Search ingestion is introduced.
  • Unify source-sharing, extended-analysis, and workflow Run as decisions across chat, Profile, Approvals, and notifications. Sharing acknowledgement covers retained evidence as well as answers; published copies remain governed by conversation access.
  • Add durable conversation evidence, staged analysis, approval-aware continuations, encrypted workflow connections, and claimed mail/calendar delivery. Revalidate selected actions and capabilities, preserve completed work, and prevent automatic replay of uncertain side effects.
  • Preserve existing combined Graph action editing while blocking new creation, cloning, restoration, and settings-based resurrection. Update source-specific documentation, the generated surface inventory, and regression coverage; bump the application to 0.261.031.

Agent streaming follow-up: commit bdb668af fixes the Azure-reproduced unsupported partition_key argument on 23 Cosmos replacement calls and a second reproduced execution-context failure between streamed chunks. Replacements retain body-derived partition routing and ETag checks; streams retain their isolated context through cleanup. Real-SDK and real Semantic Kernel regressions cover both failures. This commit has been pushed, but the Azure testing app has not been redeployed.

CodeQL remediation: follow-up commits 1883af6e and c23e32c1 remove public workflow-evaluator diagnostics, protect historical run/notification projections, clarify control flow and expected Cosmos outcomes, and replace the execution/connection import cycle with shared context primitives and owner-injected authorization. Pre/post-refresh validation and HTTP 202 approval/sign-in waits remain intact. The four intentional Protocol/facade findings are documented rather than globally suppressed; each associated review thread has been answered and resolved.

Target: Development in microsoft/simplechat (the session/project integration branch).

Setup: configure delegated Graph permissions and register /api/m365/connections/callback. Saved workflow credentials require the Key Vault secret named by M365_WORKFLOW_TOKEN_KEY_SECRET_NAME containing a base64-encoded 32-byte encryption key; retain prior key versions during rotation. Bootstrap provisions m365_connections and m365_execution_runs, both partitioned by /user_id. See docs/explanation/features/MICROSOFT_365_ACTIONS.md for setup and limitations.

Linked issue

Refs #1493. Related sync/external-tab work in #954 and #956 remains separate.

Release Notes & Latest Features

  • New Feature
  • Bug Fix
  • UI Enhancement
  • Breaking Change
  • Internal only

Compatibility changes: no new combined Graph actions; Microsoft 365 workflows require an explicitly selected, consenting Run as account rather than implicit caller/owner credentials.

Is this visible to end users?

  • Yes
  • No

Is this admin-facing (Admin Settings, governance, deployment, config)?

  • Yes
  • No

Should this become a Latest Feature card?

  • Yes
  • No
  • Already added

Screenshot needed for the card?

  • Yes
  • No
  • Attached

Version bump

  • application/single_app/config.py VERSION third segment bumped, or not needed because this is docs-only
  • deployers/version.txt bumped, or not needed because deployers/ was not changed

Application: 0.261.028 -> 0.261.029 for the feature, 0.261.030 for CodeQL remediation, and 0.261.031 for the Cosmos/agent-streaming fixes. No deployer files changed.

Testing / validation

  • Streaming/Cosmos follow-up integrated M365, memory, streaming, and retention suite: 571 passed, 96 subtests passed. Focused optimized-Python suite: 109 passed, 56 subtests passed. Real-module normal/optimized web and scheduler cold imports: 13 passed.
  • New regressions exercise the real Cosmos SDK and RequestsTransport with autospecced HTTP responses, and the real Semantic Kernel agent streaming API with an offline model. They verify partition/ETag safety, stable per-stream context, approval/sign-in propagation, and early cleanup without prefetch.
  • Earlier CodeQL remediation suite: 606 passed, 96 subtests passed; focused optimized-Python regressions 161 passed, 87 subtests passed.
  • Earlier feature qualification: optimized-Python publication/provider/analysis/history suite 173 passed; publication-provenance suite 18 passed.
  • Remaining Protocol/facade review: targeted storage/provider suites 188 passed. The concrete storage implementations and public exception consumers confirm that no runtime changes are needed for these four notes.
  • python -m pytest .\ui_tests\test_m365_lifecycle_and_approvals.py -q: 27 passed in local Chromium using the Azure Playwright-ready harness during feature qualification.
  • All three route-policy scripts: 12 checks passed. Documentation surface/site checks: 13 checks passed. All changed Python files compile and git diff --check passes; browser JavaScript syntax was checked during feature qualification.
  • Earlier CodeQL analysis on head c23e32c161175034ca4c9a0d4890174e2cfd5f5a: all three language jobs passed. The PR check decreased from 31 findings to four intentional notes, with no remaining PR security/error findings. The four corresponding review threads were individually answered and resolved; the underlying notes were not dismissed or suppressed. These results predate the streaming follow-up and are not a claim about CI on its new head.

Known pre-existing test failures: three unchanged tests in test_conversation_context_grounding.py reproduce the same failures against original PR head b8a75418 (one stale call-count assertion and two incomplete AST fixtures); those were excluded from the earlier expanded run. The streaming follow-up also encountered an unchanged chat-reattach test that asserts historical version 0.239.191 exactly and fails against pre-fix 0.261.030. These unrelated tests were not modified to hide their failures; details are in the fix documents.

Not performed: live Commercial/Government/custom-cloud, Graph/Copilot, or Key Vault qualification; no tenant permissions or deployed resources were changed. Azure telemetry inspection was read-only. Publishing the streaming fix does not redeploy or validate it on the testing URL; local fixtures do not establish target-tenant API availability or consent.

Documentation

  • Release notes updated, or not needed
  • Feature documentation updated, or not needed
  • Fix documentation updated, or not needed

Added the versioned feature specification, Microsoft 365 user guide, and four action reference pages; updated Profile/workflow/admin/chat-control documentation and regenerated docs/_data/app_surface.yml. Added docs/explanation/fixes/M365_CODEQL_REMEDIATION_FIX.md with the root causes, regression evidence, and no-code-change rationale for alerts 2752–2754 (Protocol stubs) and 2764 (public exception export). Added docs/explanation/fixes/M365_AGENT_STREAMING_FIX.md for the deployed Cosmos error and reproduced streaming-context failure. Release notes were left unchanged as requested; a Latest Feature card is not included in this PR.

Security checklist

  • New Flask routes include @swagger_route(security=get_auth_security())
  • Settings sent to non-admin frontends use sanitize_settings_for_user()
  • Browser JavaScript is served from local SimpleChat static assets only; no CDN-hosted JS
  • No secrets, keys, connection strings, or local-only artifacts are included

Introduce separate Calendar, Email, OneDrive, and SharePoint Online actions with delegated retrieval, source-sharing approvals, retained conversation evidence, and explicit workflow Run as authorization.

Retire new combined Graph actions, enforce live capability checks, add cloud-aware retrieval and durable continuation safeguards, and document setup for version 0.261.029.

Refs #1493

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

…indings

Remove provider exception text from public alert decisions and historical run/notification projections. Preserve waiting responses, exception identity, budget retry behavior, and expected Cosmos outcomes. Add regression coverage and bump the app to 0.261.030. Refs #1493; CodeQL remediation for #1497.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move immutable context and fingerprint primitives below execution and connection owners. Inject the live Run as validator from both web and scheduler bootstrap, fail closed before credentials when unconfigured, and preserve pre/post-refresh checks. Add cold-import and revocation coverage and document the four intentional CodeQL findings. Refs #1493; remediation for #1497.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread application/single_app/conversation_memory_storage.py
Comment thread application/single_app/conversation_memory_storage.py
Comment thread application/single_app/conversation_memory_storage.py
Comment thread application/single_app/functions_conversation_memory.py
Record the passing implementation-head CodeQL analysis, the concrete Protocol implementations and public exception consumers, and individual replies resolving all four remaining Advanced Security review threads. Documentation only; no runtime or version change. Refs #1493 and #1497.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove unsupported partition_key arguments from conditional Cosmos replacements while preserving body-derived partition routing and ETag checks. Keep async agent stream pulls and cleanup in one isolated context, preserve approval/sign-in handling, and log terminal failures safely. Add real-SDK and Semantic Kernel regressions and bump the application to 0.261.031. Refs #1493; follow-up for #1497.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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