Skip to content

fix(container): propagate host project lookup errors - #3611

Merged
lyingbug merged 1 commit into
Tencent:mainfrom
dvd233:fix/host-project-lookup-db-errors-3609
Sep 25, 2026
Merged

lyingbug merged 1 commit into
Tencent:mainfrom
dvd233:fix/host-project-lookup-db-errors-3609

Conversation

@dvd233

@dvd233 dvd233 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Description

hostProjectLookupImpl.ProjectDirForSession was treating every GORM query error as an unbound session. That makes a cancelled or otherwise failed lookup indistinguishable from gorm.ErrRecordNotFound, so the workspace resolver can allocate a replacement session directory instead of failing closed.

This change keeps the existing unbound behavior only for gorm.ErrRecordNotFound and returns all other database/query errors to the resolver. It also adds a regression test for an already-cancelled context.

Type of Change

  • 🐛 Bug fix
  • 🧪 Test

Related Issue

Fixes #3609

Testing

  • go test -tags desktop ./internal/container/host_project_lookup.go ./internal/container/host_project_lookup_test.go -run '^TestProjectLookupPropagatesDatabaseErrors$' -count=1
  • go test -tags desktop ./internal/container/host_project_lookup.go ./internal/container/host_project_lookup_test.go -run 'TestProjectLookup(FailsClosedWhenDirectoryRevoked|EmptyHostWorkspaceDirIsUnbound|ReturnsFalseForUnknownSession|PropagatesDatabaseErrors)$' -count=1
  • go vet -tags desktop ./internal/container/host_project_lookup.go ./internal/container/host_project_lookup_test.go
  • gofmt and git diff --check

The focused tests pass locally. The full package run on this Windows host has an unrelated baseline failure because the existing approved-directory test uses POSIX paths; the same package is run by the repository's Ubuntu CI workflow.

Copilot AI lite review requested due to automatic review settings September 23, 2026 05:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lyingbug
lyingbug merged commit 0cb1e57 into Tencent:main Sep 25, 2026
4 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.

[Bug]: Host project lookup silently falls back after database errors

3 participants