Repository navigation
Background recovery, bridge workspace cleanup, bridge health in the UI - #18
Merged
Merged
Conversation
The backend already reported whether a project's bridge was ready, restarting or given up, but the UI never showed it. - A "Bridge · Restarting" (warning) or "Bridge · Unavailable" (danger) badge sits next to Repository details in the header. Nothing is shown while the bridge is ready. - Repository details then shows a notice with the bridge's message, restart count, time to the next restart and the log path (with Copy). When the bridge has given up it explains that reopening the repository starts a fresh bridge and offers a Reopen repository button. - workspace-setup is polled every 5 s while the bridge needs attention and every 30 s otherwise, and not at all while the tab is hidden. Each poll runs git status on the repository, so this keeps the cost bounded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXCvrGWmmRNDLmy7nYS2QP
Startup and project open awaited Controller.recover(), which can replay a submission against an external UHP server. A slow or hung server kept Foreman from listening and made opening a project hang. - Startup and project open now start recovery without waiting for it. Concurrent calls share one in-flight recovery per controller. - A failure is recorded as a recovery.failed event and written to stderr with credentials masked, never left as an unhandled rejection. - Recovery claims the assignments it is handling, and the 5 s reconcile loop skips only those, so the two never process one assignment at once. Recovery only stops runs that were active when it started, so a run started meanwhile is left alone. A late "still running" observation can no longer overwrite a terminal assignment. - Recovery state (idle, running or failed, with timestamps and the last error) is reported in service status and workspace-setup. - Shutdown does not wait for recovery, and its final flush is bounded. The rule that decides whether a Reviewer response proves the complete read-only evidence package was written out twice, in the live submit path and in reconcile. It is now one method used by both, with each site's error text and events unchanged. Tests pinning both sites (a pass case and eight rejection cases each) pass before and after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXCvrGWmmRNDLmy7nYS2QP
Seeding ran two git cat-file processes per file, and bridge workspaces were never deleted. - seedWorkspace streams every blob through one `git cat-file --batch` process, parsed incrementally from raw buffers with backpressure. All existing limits and error messages are kept; blob size is checked from the record header before the body is buffered, and the child has a timeout. On a 3000-file repository seeding took a median 2.7 s instead of 24.2 s. - DELETE /extensions/foreman-workspace/v1/workspaces/:id removes a workspace and its sibling dirs: 204, 404 for an unknown id, 409 while a response is running in it. - At startup the bridge removes bridge-named directories under its work root that no persisted state references. - Idle workspaces are swept after LOCAL_CLI_UHP_WORKSPACE_TTL_MS (default 24 h, 0 disables); one with a running response is never removed. - Removal resolves paths and never follows a symlink out of the work root. State writes are serialized so concurrent persists cannot race. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DXCvrGWmmRNDLmy7nYS2QP
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR covers the four follow-ups left from the audit fixes, in three commits.
Recover unfinished work in the background and share the reviewer check (
654ca87)Startup and project open used to wait for recovery to finish. Recovery can replay a submission to an external UHP server, so a slow or hung server kept Foreman from listening and made opening a project hang.
recovery.failedevent and logged to stderr with credentials masked. It never surfaces as an unhandled rejection.recoverystate is reported in service status and inworkspace-setup:idle/running/failed, with timestamps and the last error.reviewerModelEvidence. That check requiresselectedHarnessId, which comes from the reported harness, to equal the requested harness.Seed bridge workspaces in one git process and clean them up (
6d16080)git cat-file --batchprocess. All existing limits and messages are kept.DELETE /extensions/foreman-workspace/v1/workspaces/:idreturns 204, 404 for an unknown id, or 409 while a response is running. It requires the bridge token like every other route.LOCAL_CLI_UHP_WORKSPACE_TTL_MS(default 24 h;0disables). A workspace with a running response is never removed.Show the local bridge's health in the UI (
d2998bb)workspace-setuprequest runsgit statuson the repository. The UI therefore polls it every 5 s while the bridge needs attention, every 30 s otherwise, and not at all while the tab is hidden.Verification
recovery,reviewer-evidenceandbridge-status.pnpm test:bridge: 68/68 passing on two consecutive runs. New tests cover batch seeding (binary, symlink, executable, 250+ files, and failure cases), DELETE, symlink safety, the startup sweep, and the TTL sweep.Worth knowing
refreshDiscovery) is still awaited. It has its own timeout, and recovery needs its result.🤖 Generated with Claude Code
https://claude.ai/code/session_01DXCvrGWmmRNDLmy7nYS2QP
Generated by Claude Code