-
Notifications
You must be signed in to change notification settings - Fork 391
fix: Prevent SQLite corruption in parallel mode with atomic operations #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
cabana8471-arch
wants to merge
11
commits into
AutoForgeAI:master
from
cabana8471-arch:fix/sqlite-parallel-corruption
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
49f4495
fix: prevent SQLite corruption in parallel mode with atomic operations
cabana8471-arch fbacc05
fix: address ruff linting errors and connection leak
cabana8471-arch 041f576
fix: correct import order (classes before functions)
cabana8471-arch 0a30735
fix: sort imports alphabetically per CodeRabbit feedback
cabana8471-arch 1cbc66a
fix: correct import order per ruff (uppercase before lowercase)
cabana8471-arch 4a3fe77
fix: sort imports alphabetically to fix ruff I001
cabana8471-arch 7acdb95
fix: organize imports in feature_mcp.py
cabana8471-arch 9032826
fix: address PR #108 review comments for SQLite parallel safety
cabana8471-arch bf9df05
Merge branch 'master' into fix/sqlite-parallel-corruption
cabana8471-arch b111099
fix: add missing Integer and text imports to registry.py
cabana8471-arch 4b5b643
fix: add UTF-8 encoding for subprocess calls on Windows
cabana8471-arch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: leonvanzyl/autocoder
Length of output: 6215
🏁 Script executed:
Repository: leonvanzyl/autocoder
Length of output: 103
🏁 Script executed:
Repository: leonvanzyl/autocoder
Length of output: 3621
🏁 Script executed:
Repository: leonvanzyl/autocoder
Length of output: 5510
🏁 Script executed:
Repository: leonvanzyl/autocoder
Length of output: 5057
🏁 Script executed:
Repository: leonvanzyl/autocoder
Length of output: 2522
EXCLUSIVE mode causes "cannot start a transaction within a transaction" error.
When
isolation_level == "EXCLUSIVE", the code executessession.execute(text("BEGIN EXCLUSIVE"))at line 501. However, SQLAlchemy's "begin" event (lines 367-370) fires and executesBEGIN IMMEDIATEbefore this statement runs. Sinceautocommit=Falseon the sessionmaker, attemptingBEGIN EXCLUSIVEwithin an already-started transaction causes SQLite to error.This affects the actual usage in
feature_mcp.pyline 564, which callsatomic_transaction(_session_maker, "EXCLUSIVE").Proposed fix
Either:
session = session_maker() try: - # For EXCLUSIVE mode, override the default IMMEDIATE from event hooks - # For IMMEDIATE mode, the event hooks handle BEGIN IMMEDIATE automatically - if isolation_level == "EXCLUSIVE": - session.execute(text("BEGIN EXCLUSIVE")) - # Note: For IMMEDIATE, we don't issue BEGIN here - the event hook handles it - # This prevents the fragile "BEGIN on already-begun transaction" issue + if isolation_level != "IMMEDIATE": + raise ValueError(f"Only IMMEDIATE isolation level is supported, got: {isolation_level}") yield session📝 Committable suggestion
🤖 Prompt for AI Agents