Skip to content

[BREAKING] Python: Move path normalization to common shared code - #8123

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 5 commits into
microsoft:mainfrom
westey-m:file-path-common-normalization
Sep 8, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 5 commits into
microsoft:mainfrom
westey-m:file-path-common-normalization

Conversation

@westey-m

@westey-m westey (westey-m) commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation & Context

Improve consistency

Description & Review Guide

Move path normalization to common shared code

Related Issue

Fixes #

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings September 7, 2026 13:21
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Sep 7, 2026
@github-actions github-actions Bot changed the title Move path normalization to common shared code Python: Move path normalization to common shared code Sep 7, 2026

Copilot 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.

🟡 Changes recommended

The derivation still permits case-insensitive collisions and silently relocates several existing persisted layouts.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Centralizes filesystem-safe storage-key derivation to improve isolation consistency across Python persistence providers.

Changes:

  • Adds shared storage-key encoding and safety helpers.
  • Migrates session, todo, memory, and file-memory path derivation.
  • Adds collision, Unicode, traversal, and isolation tests plus documentation updates.
File summaries
File Description
python/samples/02-agents/context_providers/file_memory_provider.py Documents opaque scopes and uses a flat example.
python/packages/core/tests/workflow/test_agent_executor.py Removes redundant whitespace.
python/packages/core/tests/core/test_sessions.py Tests session filename isolation and Unicode encoding.
python/packages/core/tests/core/test_harness_todo.py Tests todo-store key derivation.
python/packages/core/tests/core/test_harness_memory.py Tests memory-store key derivation.
python/packages/core/tests/core/test_harness_file_memory.py Tests scope isolation and fail-closed behavior.
python/packages/core/tests/core/test_filesystem.py Covers the shared derivation helper.
python/packages/core/AGENTS.md Documents storage-key conventions.
python/packages/core/agent_framework/_sessions.py Reuses shared filename derivation.
python/packages/core/agent_framework/_harness/_todo.py Reuses shared todo path derivation.
python/packages/core/agent_framework/_harness/_memory.py Reuses shared memory path derivation.
python/packages/core/agent_framework/_harness/_file_memory.py Encodes scopes as single storage segments.
python/packages/core/agent_framework/_harness/_file_access.py Clarifies path-normalizer limitations.
python/packages/core/agent_framework/_filesystem.py Implements shared storage-key helpers.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 6
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 6b746d4ffaea
Model: gpt-5.6-sol-fast

Overview

This PR centralizes opaque storage-key derivation and adds strong traversal, reserved-name, Unicode-normalization, and isolation coverage. The shared encoding separates identifiers that the previous path normalizer folded together, but several consumers adopt it without preserving their existing persisted layouts. As a result, existing memory, file-memory, session/history, and todo data can appear missing after an upgrade.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
4 verified findings remained after source verification (1 high, 3 medium) across 4 files. Details are attached to the affected lines below.

Affected areas: python/packages/core/agent_framework/_filesystem.py, python/packages/core/agent_framework/_harness/_file_memory.py, python/packages/core/agent_framework/_harness/_memory.py, python/packages/core/agent_framework/_harness/_todo.py

@westey-m westey (westey-m) changed the title Python: Move path normalization to common shared code [BREAKING ]Python: Move path normalization to common shared code Sep 7, 2026
@westey-m westey (westey-m) changed the title [BREAKING ]Python: Move path normalization to common shared code [BREAKING] Python: Move path normalization to common shared code Sep 7, 2026
@agent-framework-automation agent-framework-automation Bot added the breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible label Sep 7, 2026
Merged via the queue into microsoft:main with commit 44dc76c Sep 8, 2026
38 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — 6bb5e685 Deployed Sep 8, 2026 by westey-m via add_label #22109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants