Skip to content

Fix Recorder crash on bare relative session filename - #8386

Open
Junpei Zhang (pei711) wants to merge 1 commit into
microsoft:mainfrom
pei711:contrib/fix-recorder-bare-filename
Open

Junpei Zhang (pei711) wants to merge 1 commit into
microsoft:mainfrom
pei711:contrib/fix-recorder-bare-filename

Conversation

@pei711

Copy link
Copy Markdown

What

ChatCompletionClientRecorder.finalize() called os.makedirs(os.path.dirname(self.session_file_path), exist_ok=True). For a bare relative filename like session.json, dirname is '' and makedirs('') raises FileNotFoundError.

Change

  • python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/chat_completion_client_recorder.py: only call os.makedirs when the parent directory is non-empty.
  • Added a parametrized regression test (bare-relative, explicit-relative, nested-relative, absolute) in test_chat_completion_client_recorder.py.

Verification

New test fails before the fix and passes after; existing recorder tests unaffected.

This branch has not been deployed

No deployments
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