Skip to content

fix: correct SQLite file URIs on Windows - #1868

Open
0xMrMasry wants to merge 2 commits into
Agent-Field:devfrom
0xMrMasry:fix/windows-sqlite-file-uris
Open

0xMrMasry wants to merge 2 commits into
Agent-Field:devfrom
0xMrMasry:fix/windows-sqlite-file-uris

Conversation

@0xMrMasry

@0xMrMasry 0xMrMasry commented Oct 17, 2026 •

Copy link
Copy Markdown

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

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.

2 participants