FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(code-host): recover transient reads without retrying writes by kitlangton · Pull Request #49 · kitlangton/stack · GitHub

fix(code-host): recover transient reads without retrying writes - #49

Merged
kitlangton merged 1 commit into
mainfrom
fix/code-host-concurrency
Aug 28, 2026
Merged

fix(code-host): recover transient reads without retrying writes#49
kitlangton merged 1 commit into
mainfrom
fix/code-host-concurrency

Conversation

Copy link
Copy Markdown
Owner

Why

A single code-host read timeout currently aborts a stack operation, even when another attempt could succeed. GitLab also rereads already-known titles and retains failed source-project lookups in its cache, so optional work can fail a repair and later reads can repeat an old failure without contacting the host.

Investigation also reproduced a subprocess deadlock: a child filling stderr before closing stdout hangs while stack drains the pipes sequentially.

What Changes

Situation New behavior
Recognized transport timeout/reset/EOF or HTTP 502/503/504 during a read Retry at most twice, with jittered backoff around one and two seconds
Authentication error or invalid JSON Fail without retrying
Create, merge, retarget, body update, or close times out Do not retry; the host may already have accepted the write
GitLab project lookup fails Do not retain the failed cache entry; successful lookups remain shared
GitLab stack block already contains titles or references live metadata Reuse existing information rather than rereading it
Optional historical-title lookup fails Warn and preserve the existing entry; required current-body reads still fail normally
A child writes more than stderr pipe capacity before stdout Drain both streams concurrently and retain output/exit handling

Retry Boundaries

Retries wrap only explicit read call sites: lists, details, merge-state polling, and GitLab source-project lookup. Decoding remains outside the retry boundary. A retry stays inside its existing concurrency slot, and interruption cancels the delay rather than launching another request.

Scope

Related to #43, taking an automatic-recovery-first approach. This does not add stack.codeHostConcurrency, change the default of four jobs, or claim to reproduce the reporter's particular environment. Keep #43 open pending their timeout details and verification; persistent overload may still need a separate concurrency-policy decision.

Verification

GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null bun run test
bun run typecheck
bun run format:check
bun run lint
bun run package:smoke
bun run changeset:status --since origin/main
bun src/cli.ts --help
bun src/cli.ts sync --help
git diff --check

200 tests pass. New provider tests use injected CLI failures and TestClock to cover recovery, bounded attempts, cancellation, mutation exclusion, cache behavior, and concurrency. Stack regressions reproduce duplicate metadata reads and failed optional enrichment, while protecting mandatory-read and interruption boundaries. Latch-backed pipe tests and a real child writing 2 MiB to stderr reproduce the deadlock before the fix and pass afterward. No live-provider load tests were run.

Add bounded jittered backoff at explicit read boundaries, avoid caching failed GitLab project lookups, and reuse known titles while treating optional history enrichment as best effort.

Drain child process output concurrently to prevent stderr pipe deadlocks. Cover retries, cancellation, mutation safety, enrichment boundaries, and real pipe backpressure.
kitlangton merged commit e06bf99 into main Aug 28, 2026
1 check passed
kitlangton deleted the fix/code-host-concurrency branch August 28, 2026 02:44
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL