Repository navigation
Fix orchestrated SharePoint and OneDrive actions that never read files - #1712
Merged
Paul Lizer (paullizer) merged 6 commits intoOct 8, 2026
Conversation
An orchestration "Use an action" step calls its model without a chat agent, so SharePoint and OneDrive file functions had no model token budget and refused every call with model_context_unavailable before reaching Microsoft Graph. The step still completed, and the answer said the documents couldn't be searched. Production telemetry showed the refusal for search_files on spo at 2026-10-07 21:40:39Z; the m365 agent found the same file in chat. - Bind the step model's ModelTokenBudget around each file function call, and offer the step's own model to retained-file analysis, so analyze_file completes after the user approves deeper analysis and retries. - Check the model's token limits before the step's model or Graph is called. - Stop the step with m365_model_limits_required or m365_evidence_unavailable instead of reporting application failures as findings. - Version 0.261.294, fix doc, admin and logging-tag docs, release notes, and functional tests for the real runner, step scope and file runtime. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A retry runs the plan's approved step model, and an Auto plan whose model limits changed is refused with "Review a new plan". So after an admin sets the model's token limits in Model Endpoints, the user asks again. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…lizer-investigate-orchestrator-m365-sharepoint # Conflicts: # application/single_app/config.py # docs/explanation/release_notes.md
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve the config.py and release notes conflicts, and renumber this fix from 0.261.297 to 0.261.300: the base now uses 0.261.297 through 0.261.299 for other changes. Only this fix's references were renumbered. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Paul Lizer (paullizer)
merged commit Oct 8, 2026
59ca957
into
paullizer-react-v2-ui
11 checks passed
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
With Orchestrate on, a plan step that used the Microsoft 365 SharePoint action never searched SharePoint. Asked the same question in chat, the
m365agent found the document. In App Insights for the reported run, the step'ssearch_filescall was refused withmodel_context_unavailable(sc_resource=spo) before any Microsoft Graph request, and the step still reported Completed.ModelTokenBudgetfrom the same endpoint and model resolution as its chat service, mirroringbuild_agent_model_budget. An auto function-invocation filter binds that budget around each function call. The same filter offers the step's own model to retained-file analysis, for that request only.analyze_filetherefore completes after the user approves deeper analysis and retries. Before, it failed every retry withm365_unavailable.m365_model_limits_requiredandm365_evidence_unavailablefailures. Their messages say what to do next. A model without verified token limits is caught before the step's model or Graph is called. Bounded-coverage outcomes, such as a full context window, file limits, nothing found and throttling, are still reported as findings.Worth a careful look:
get_m365_analysis_agent()is replaced byget_m365_analysis_model(). It returns either the chat agent's model, through the journal, or the step-bound model. Either one must match the request, data user and conversation. The step binding is a ContextVar, set and reset around each function call._build_action_model()keeps its signature. Its model resolution and capture-configuration code moved into separate helpers, so file steps resolve the endpoint once.paullizer-react-v2-ui(most recently at 0.261.299), with conflicts only inconfig.pyand the release notes each time, and renumbers this fix to 0.261.300.Linked issue
N/A. No issue was filed; the root cause was confirmed from App Insights telemetry, described above.
Release Notes & Latest Features
Is this visible to end users?
Is this admin-facing (Admin Settings, governance, deployment, config)?
Should this become a Latest Feature card?
Screenshot needed for the card?
Version bump
application/single_app/config.pyVERSIONthird segment bumped, or not needed because this is docs-only. It is now 0.261.300, after merging the base at 0.261.299.deployers/version.txtbumped, or not needed becausedeployers/was not changedTesting / validation
I ran the Python tests in a fresh virtual environment built from
application/single_app/requirements.txtpluspytest.python -m pytest functional_tests/test_orchestration_m365_file_actions.py -q: passed, 7 tests (new). These run the real action runner, step scope, Microsoft 365 runtime, approval service, SharePoint plugin and file-runtime wiring. Graph, storage and the model are doubled, and network access is blocked. Each of four deliberate breaks makes at least one test fail: removing the step filter (the shipped bug), the analysis-model binding, the evidence refusal codes, or the up-front limits check.python -m pytest functional_tests/test_orchestration_m365_file_actions.py functional_tests/test_orchestration_m365_actions.py functional_tests/test_orchestration_action_runtime.py functional_tests/test_m365_runtime_adapters.py functional_tests/test_m365_file_analysis.py functional_tests/test_m365_agent_continuation.py functional_tests/test_m365_file_runtime.py functional_tests/test_m365_provider_core.py functional_tests/test_m365_catalog_budget_integration.py functional_tests/test_orchestration_external_metadata.py functional_tests/test_orchestration_external_pre_effect.py functional_tests/test_orchestration_dependency_runtime.py functional_tests/test_orchestration_source_authority_runtime.py functional_tests/test_orchestration_workflow_run_adapter.py functional_tests/test_pytest_return_false_guard.py -q: passed, 768 tests.python -m pytest functional_tests/test_m365_agent_streaming.py functional_tests/test_m365_chat_action_cards.py functional_tests/test_orchestration_catalog_auto_execution.py functional_tests/test_orchestration_external_configuration_capture.py functional_tests/test_orchestration_external_preflight_adapter.py functional_tests/test_orchestration_visual_outputs.py functional_tests/test_workflow_m365_rebase_integration.py -q: passed, 409 tests.python -m pytest functional_tests/test_orchestration_m365_file_actions.py functional_tests/test_orchestration_m365_actions.py functional_tests/test_orchestration_action_runtime.py functional_tests/test_m365_runtime_adapters.py functional_tests/test_m365_file_analysis.py functional_tests/test_m365_agent_continuation.py functional_tests/test_m365_file_runtime.py functional_tests/test_m365_provider_core.py functional_tests/test_m365_catalog_budget_integration.py functional_tests/test_docs_site_quality.py functional_tests/test_docs_app_surface_coverage.py -q: passed, 288 tests.python scripts/check_broken_access_control.py --full-file application/single_app/functions_orchestration_actions.py application/single_app/functions_orchestration_m365.py application/single_app/functions_m365_agent_continuation.py application/single_app/functions_m365_analysis_runtime.py application/single_app/functions_orchestration_schema.py: passed for 5 files.python scripts/check_xss_sinks.pyon the same 5 files: passed for 5 files.python scripts/build_docs_inventory.py: no change to the inventory.ui_tests/test_v2_orchestration_m365_recovery.py, which needs a V2 build and Chromium. V2 is unchanged, and that test supplies its own failure payloads.Documentation
[ORCHESTRATION_M365]row in the logging-tags reference.docs/explanation/fixes/ORCHESTRATION_M365_FILE_ACTION_EVIDENCE_FIX.md)Security checklist
@swagger_route(security=get_auth_security())(no route changes)sanitize_settings_for_user()(no settings payload changes)The model budget holds no secrets. The step-bound analysis model serves only its own request, data user and conversation, and adds no data or model access beyond what the step already uses.