Skip to content

🤖 fix: detach SSH base repo gc#3346

Merged
ethanndickson merged 2 commits into
mainfrom
ssh-gc-timeout-rrxp
May 21, 2026
Merged

🤖 fix: detach SSH base repo gc#3346
ethanndickson merged 2 commits into
mainfrom
ssh-gc-timeout-rrxp

Conversation

@ethanndickson
Copy link
Copy Markdown
Member

@ethanndickson ethanndickson commented May 21, 2026

Summary

Detach shared SSH base-repo gc from mux's SSH command timeout so maintenance can keep long-lived bare repos defragmented without mux killing Git mid-pack-finalization.

Background

The existing base repo maintenance path ran git gc --prune=now through mux's timed SSH command wrapper. On large shared bare repos, that timeout can fire while Git is finalizing packs, leaving a .pack without its matching .idx. Git then cannot see the objects in that pack, and later sync pushes can fail with unresolved remote deltas.

Implementation

This keeps the existing maintenance triggers and retry flow, but runs gc through setsid so the actual Git process is in its own session/process group. Proactive preflight uses setsid -f and only waits for the remote spawn because that maintenance is advisory. Retry cleanup uses setsid -f -w, which waits for the detached child to exit and returns its status, so the next retry can benefit from completed maintenance without putting gc itself under mux's kill timeout. Missing setsid is checked before redirecting gc output, so local logs preserve actionable spawn diagnostics; gc's own output still goes to /tmp/.mux-base-repo-gc.log on the SSH host.

Risks

The behavior depends on util-linux setsid with -f/-w support on the SSH host. If it is missing, maintenance logs a warning and sync proceeds through the existing best-effort path; correctness is preserved, but base-repo defragmentation may not run on that host.


Generated with mux • Model: openai:gpt-5.5 • Thinking: xhigh • Cost: $29.50

Run SSH base-repo gc as a remote detached maintenance process instead of holding it under mux's SSH command timeout. This keeps the advisory defragmentation path while avoiding SIGKILL during Git pack finalization.

Tests update retry orchestration expectations for the detached gc spawn timeout.

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$27.08`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=27.08 -->
@ethanndickson
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a45337372

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/node/runtime/SSHRuntime.ts Outdated
Comment thread src/node/runtime/SSHRuntime.ts Outdated
Keep proactive base repo gc advisory, but use setsid -w for retry cleanup so retries can wait for detached maintenance without letting mux's timeout kill git gc itself.

Also preserve missing-setsid diagnostics by checking command availability before redirecting gc output to the remote log.
@ethanndickson
Copy link
Copy Markdown
Member Author

Addressed Codex feedback:

  • PRRT_kwDOPxxmWM6DrCEC: retry cleanup now uses setsid -f -w, so it waits for the detached gc child to finish before retrying while still keeping the gc process outside mux's kill-timeout process group.
  • PRRT_kwDOPxxmWM6DrCEF: the command now checks command -v setsid before redirecting gc output to the remote log, preserving actionable spawn diagnostics in mux logs.

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson ethanndickson added this pull request to the merge queue May 21, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 21, 2026
@ethanndickson ethanndickson added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit 7239f68 May 21, 2026
24 checks passed
@ethanndickson ethanndickson deleted the ssh-gc-timeout-rrxp branch May 21, 2026 05:06
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.

1 participant