Pydantic AI: From Finding to Fix PR
The bug
When loading failed, the agent continued with a fresh session. Saving it could overwrite the conversation's valid state.
The proposed repair
The proposed change skips saving after a failed load, except after an explicit restart. It adds a state-preservation test and updates the documentation.

Step 1
Find the bug
Spot the finding, inspect its evidence, then initiate a fix.

Step 2
Create the Fix PR
The user confirms the repository and target branch before initiating the repair.

Step 3
Review the draft PR
Early opens draft PR #3 with the proposed code change, test, and repair explanation. Engineering controls the merge.

Step 4
Illustrative next step
Review and merge the PR
Engineering reviews the proposed code and tests, then merges the approved fix. This illustrates the next step, not this case's current outcome: PR #3 is still a draft.

- Bug
- When loading failed, the agent continued with a fresh session. Saving it could overwrite the conversation's valid state.
- Files changed
- 4
- Patch
- +41 / −11
- Result
A proposed repair on Early's fork. Not merged upstream. Engineering reviews and controls the merge.
Verification and remaining evidence
The fork PR reports a passing Python compilation check. Upstream automation reports reproducing the original state-loss failure, not verifying this repair. Behavioral tests for the proposed fix have not yet been executed. The explicit restart exception still needs dedicated test coverage. GitHub currently reports no CI checks for this proposal.
python3 -m py_compile src/pydantic_ai_harness/pydantic_ai_harness/code_mode/_repl_store.py tests/harness/code_mode/test_repl_store.pyProposed fix ced2bfd Prepared by Early Technologies using its own open-source analysis and fork. Pydantic AI is not presented as an Early customer or endorser.