Skip to content

fix: correct SQLite file URIs on Windows - #1868

Merged
AbirAbbas merged 4 commits into
Agent-Field:devfrom
0xMrMasry:fix/windows-sqlite-file-uris
Oct 20, 2026
Merged

AbirAbbas merged 4 commits into
Agent-Field:devfrom
0xMrMasry:fix/windows-sqlite-file-uris

Conversation

@0xMrMasry

@0xMrMasry 0xMrMasry commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What changed

On native Windows, a fresh codeaf launch disables memory, conversation search, and automations with SQL logic error: out of memory (1). The database openers pass net/url.URL a Windows drive path, producing file://C:%5C.... SQLite rejects that URI before opening a database. With the same driver and machine, :memory:, a plain filename, and file:///C:/... all open successfully.

Add a shared file-URI constructor that uses forward slashes and a rooted URL path, then use it in the graph, automation, collection, and read-only plan-preview database openers. POSIX absolute paths keep their existing URI shape, and query parameters remain with each caller. The regression test exercises persistence at the requested filename with spaces, #, &, and %, connection pragmas, and read-only access.

Related to #1082. This addresses database opening; the separate Windows resume/presence-locking problems remain outside this change.

How it was checked

On Windows amd64 with Go 1.26.5 and the repository's modernc.org/sqlite v1.29.1:

  • Before the fix, go test ./internal/automation -run '^TestStoreRefusesAForeignDatabase$' -count=1 fails with the reported SQLite error.
  • After the fix, the following eight focused tests pass across all five packages:
go test ./internal/sqliteuri ./internal/store ./internal/automation ./internal/workspace ./internal/plandb -run '^(TestFileOpensTheNamedDatabase|TestOpenMakesItsDirectoryOnAFirstRun|TestOpenIsHappyWhenTheDirectoryIsAlreadyThere|TestStoreRefusesAForeignDatabase|TestCreateWorksOutTheFirstWake|TestTakeCatchesUpOnceAndMarksItLate|TestNestedCollectionsAllowSharedParentsButRejectCycles|TestRootPreviewReadsBesideAWriterAndNeverCreatesAStore)$' -count=1
  • git diff --check passes.
  • The full automation suite on Windows also encounters existing presence-lock rename and POSIX-path fixture failures; this PR does not claim full Windows support.
  • go vet ./internal/sqliteuri ./internal/store ./internal/automation ./internal/workspace ./internal/plandb passes.
  • make changelog-check passes, including the entry for fix: correct SQLite file URIs on Windows #1868.
  • make pr-ready passes go build ./... and then fails at go vet ./... because unmodified tests use Unix-only syscall.Setpgid, syscall.Kill, and syscall.Flock, and other unmodified test helpers/packages are excluded on Windows. The full local gate therefore does not pass.
  • Upstream GitHub Actions requires maintainer approval for the fork PR before CI can run.

Checklist

  • Change entry added for fix: correct SQLite file URIs on Windows #1868 and validated, as prescribed in docs/rules/changelog.md.
  • No slash command, key, tool, default, limit, or refusal was added or changed, so no manual update is needed.
  • No new entry in .github/known-red.txt.
  • Only the paths belonging to this fix were staged.

Copy link
Copy Markdown
Member

Hey, thanks for the PR. Could you sign the CLA when you get a chance so we can review it?

@0xMrMasry

Copy link
Copy Markdown
Contributor Author

Hey, thanks for the PR. Could you sign the CLA when you get a chance so we can review it?

Happy to sign! Could you share the CLA signing link? The license/cla check currently shows "Expected" without a link.

@0xMrMasry

0xMrMasry commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks! I've now signed the CLA as 0xMrMasry, and CLA Assistant showed the confirmation: "Thank you 0xMrMasry for signing the CLA!"

The PR still appears to be waiting for license/cla, with no status reported yet. Could you recheck the CLA integration, or let me know if there's another step I need to complete?

@santoshkumarradha

AbirAbbas and others added 2 commits October 20, 2026 09:29
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@AbirAbbas AbirAbbas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified, including natively on Windows: cross-compiled test binaries run on Windows pass at this head (drive, forward-slash, UNC and special-character paths, pragmas kept, read-only doesn't create a missing DB), and the same automation test built from dev fails with the original SQL logic error: out of memory (1). On Linux the URIs are byte-identical to what dev produced for spaces, #, &, %, ?, unicode and backslashes, so POSIX users see no change. I added those cases as tests and merged current dev. A few other openers still build URIs by hand; that's pre-existing and filed separately. Thanks!

@AbirAbbas
AbirAbbas added this pull request to the merge queue Oct 20, 2026
Merged via the queue into Agent-Field:dev with commit a4dff11 Oct 20, 2026
6 checks passed
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.

3 participants