Skip to content

fix(sessions): bound git branch probe to prevent gateway footer stalls - #109458

Closed
dwc1997 wants to merge 2 commits into
openclaw:mainfrom
dwc1997:fix/git-branch-probe-timeout
Closed

dwc1997 wants to merge 2 commits into
openclaw:mainfrom
dwc1997:fix/git-branch-probe-timeout

Conversation

@dwc1997

@dwc1997 dwc1997 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The synchronous git symbolic-ref probe in resolveBranchWithGitSync runs during gateway prompt footer assembly. The spawnSync call had no timeout, so a stalled git process could block the gateway indefinitely.

Why This Change Was Made

Add GIT_SYMBOLIC_REF_TIMEOUT_MS (5 seconds) and killSignal: "SIGKILL" to the spawnSync call. The caller already returns null when git is unavailable or on non-zero exit, so the timeout path is safe — a stalled probe falls back to the same null result.

The 5s bound follows the same pattern as macOS system probes (#109241) and other synchronous gateway probes.

User Impact

Gateway prompt footer assembly is no longer blocked indefinitely by a stalled git symbolic-ref call. getGitBranch() returns null on timeout.

Evidence

  • src/agents/sessions/footer-data-provider.ts — one spawnSync call bounded with timeout: 5000, killSignal: "SIGKILL"
  • oxfmt --check + oxlint on changed file
  • git diff origin/main...HEAD --check — clean

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Jul 17, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 3:51 AM ET / 07:51 UTC.

Summary
Adds an exported five-second timeout constant and SIGKILL deadline to the synchronous Git branch probe used by session footer data.

PR surface: Source +6. Total +6 across 1 file.

Reproducibility: yes. at source level, though not through a completed live run: current main performs an unbounded synchronous Git child call, and Node documents that such calls wait for child exit without a configured timeout. (nodejs.org)

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: src/agents/sessions/footer-data-provider.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Post a redacted controlled stalled-child terminal or log transcript showing the probe is killed near the configured deadline and returns the existing fallback.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No after-fix real setup evidence is present; add redacted terminal output or logs from a controlled stalled Git-child run, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review, and redact private paths, endpoints, IPs, credentials, and other sensitive details.

Risk before merge

  • [P2] No after-fix real behavior evidence currently demonstrates that a deliberately stalled Git child is reaped at the deadline and footer branch resolution returns its existing fallback.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the bounded hard-kill behavior, add focused regression coverage for the exact spawn options and fallback, and provide a controlled stalled-child terminal or log transcript showing the call returns within the deadline.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated code repair is indicated; contributor-supplied real behavior proof is the remaining merge gate.

Security
Cleared: The diff only bounds an existing fixed-command child process and introduces no dependency, secret, permission, package-resolution, or supply-chain change.

Review details

Best possible solution:

Keep the bounded hard-kill behavior, add focused regression coverage for the exact spawn options and fallback, and provide a controlled stalled-child terminal or log transcript showing the call returns within the deadline.

Do we have a high-confidence way to reproduce the issue?

Yes at source level, though not through a completed live run: current main performs an unbounded synchronous Git child call, and Node documents that such calls wait for child exit without a configured timeout. (nodejs.org)

Is this the best way to solve the issue?

Yes; bounding the existing best-effort probe at its owner boundary is the narrowest maintainable fix, preserves the established fallback, and matches the merged sibling probe pattern.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 73d04395defe.

Label changes

Label justifications:

  • P2: This is a bounded availability hardening fix for a limited session-footer path rather than a demonstrated widespread gateway outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix real setup evidence is present; add redacted terminal output or logs from a controlled stalled Git-child run, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review, and redact private paths, endpoints, IPs, credentials, and other sensitive details.
Evidence reviewed

PR surface:

Source +6. Total +6 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 6 0 +6
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 6 0 +6

What I checked:

  • Current-main bug path: At current main, resolveBranchWithGitSync calls spawnSync("git", ...) without a timeout or hard-kill signal; the PR changes that exact options object. (src/agents/sessions/footer-data-provider.ts:75, 73d04395defe)
  • Caller and fallback behavior: The synchronous probe is used only when resolving the special .invalid reftable branch sentinel; a failed probe already falls back to detached, so the proposed timeout preserves the existing failure result. The upstream implementation shows the same cache, caller, and fallback structure. (github.com) (src/agents/sessions/footer-data-provider.ts, 73d04395defe)
  • Dependency contract: Node documents that spawnSync blocks until the child exits, has no timeout by default, and uses SIGTERM by default; specifying both a timeout and SIGKILL directly addresses a child that otherwise does not exit. (nodejs.org)
  • Public-surface check: The sessions barrel exports only the ReadonlyFooterDataProvider type from this module, so exporting the timeout constant inside the implementation file does not add it to the documented sessions barrel. (github.com) (src/agents/sessions/index.ts:24, 73d04395defe)
  • Sibling precedent: The merged fix(infra): bound macOS metadata probes #109241 applied the same five-second SIGKILL deadline pattern to other best-effort synchronous system probes, supporting consistency but not replacing proof for this Git path. (src/infra/os-summary.ts, 23de5c297d1d)
  • Proof gap: The PR body supplies formatting, lint, and diff checks only; it contains no controlled stalled-child run, terminal output, runtime logs, recording, or linked artifact showing the after-fix deadline and fallback. (src/agents/sessions/footer-data-provider.ts:79, 8851aba637e5)

Likely related people:

  • badlogic: The OpenClaw footer provider follows the upstream Pi footer-data-provider design, including the synchronous reftable branch fallback and asynchronous refresh path. (github.com) (role: upstream feature owner; confidence: medium; files: src/agents/sessions/footer-data-provider.ts)
  • Alix-007: Authored the recently merged sibling change that established the five-second SIGKILL pattern for best-effort synchronous metadata probes. (role: adjacent probe-hardening contributor; confidence: medium; commits: 23de5c297d1d; files: src/infra/os-summary.ts, src/infra/system-presence.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-17T00:38:13.473Z sha 069ef5e860df5ccf78a2f175d9c519b8c7629c17 :: needs real behavior proof before merge. :: none

dwc1997 added 2 commits July 17, 2026 15:44
The synchronous git symbolic-ref probe runs during gateway prompt footer
assembly. It had no timeout, so a stalled git process could block the
gateway indefinitely.

Add GIT_SYMBOLIC_REF_TIMEOUT_MS (5s) and SIGKILL, matching the bounded
probe pattern applied to macOS system probes (openclaw#109241).
@dwc1997
dwc1997 force-pushed the fix/git-branch-probe-timeout branch from 069ef5e to 8851aba Compare July 17, 2026 07:45
@dwc1997

dwc1997 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Closing: no test file exists for footer-data-provider.ts, the function is private, and there is no user-reported issue backing this change. Cannot satisfy the proof requirement. The pattern itself is valid but this file lacks the test harness needed for a quality PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant