fix(forgejo): retry workspaces whose origin could not be read #60

Merged
lucas merged 2 commits from 59-workspace-index-failed-origin-lookups into main 2026-10-22 18:04:03 +02:00
Collaborator

The workspace index cached a failed git remote get-url origin exactly like an origin on another host. One transient failure, such as a directory that isn't mounted yet at startup, then kept a registered repository "not connected" until restart, and Forgejo comments on it were dropped. The new lookupOrigin separates a missing origin (git exit 2), which is a real answer, from other git failures. The index now caches only answers, retries a workspace whose lookup failed on every lookup, and logs each failure with git's error text.

Verification

  • bun test apps/server/src/forgejo: 228 pass, 0 fail. This includes the new tests:
    • a non-repo directory that later becomes a repo is matched;
    • a repo without origin stays cached;
    • lookupOrigin returns the right result for an origin, no origin, a non-repo directory and a missing path.
  • bun run typecheck: passes for protocol, server and web.

Closes #59

The workspace index cached a failed `git remote get-url origin` exactly like an origin on another host. One transient failure, such as a directory that isn't mounted yet at startup, then kept a registered repository "not connected" until restart, and Forgejo comments on it were dropped. The new `lookupOrigin` separates a missing origin (git exit 2), which is a real answer, from other git failures. The index now caches only answers, retries a workspace whose lookup failed on every lookup, and logs each failure with git's error text. ## Verification - `bun test apps/server/src/forgejo`: 228 pass, 0 fail. This includes the new tests: - a non-repo directory that later becomes a repo is matched; - a repo without origin stays cached; - `lookupOrigin` returns the right result for an origin, no origin, a non-repo directory and a missing path. - `bun run typecheck`: passes for protocol, server and web. Closes #59
lookupOrigin reports a repo without an origin remote (git exit 2) as an
answer and every other git failure, such as a path that is not (yet) a
repo or a spawn error, as a failure with git's error text, so callers
can avoid treating a possibly transient failure as final.

Refs #59

Co-Authored-By: Claude Opus 5.5 via omp-deck
The workspace index cached a failed `git remote get-url origin` the
same as an origin on another host, so a single transient failure (e.g.
a directory not yet mounted at startup) left a registered repository
"not connected" until restart, and Forgejo comments on it were dropped.
Only real answers are cached now; a workspace whose read failed is
resolved again on the next lookup, and each failure is logged with
git's error.

Closes #59

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-10-22 18:03:56 +02:00
lucas merged commit e21cc341d7 into main 2026-10-22 18:04:03 +02:00
lucas deleted branch 59-workspace-index-failed-origin-lookups 2026-10-22 18:04:03 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck!60
No description provided.