fix: bound ix map background refresh (single-flight + deadline)#290
Merged
Conversation
`ix map` runs both interactively and as an automatic background refresh (editor/agent hooks re-map on change). Repeated or overlapping invocations could stack and run unbounded against a slow backend. Make the refresh safe: - CLI-level single-flight lock per workspace: concurrent `ix map` runs coalesce instead of stacking; stale locks (dead/aged holder) self-heal. - Hard wall-clock deadline shared across every ingest/map request, so a single run is always bounded even when the backend stalls; previously untimed list/source-hashes/stitch requests now get a per-request timeout. - Retry is abort-aware: a deadline/timeout abort is no longer retried. - Skip the automatic refresh (IX_AUTO_MAP=1) when the active backend is remote; remote ingestion should be deliberate. Manual `ix map` is unaffected; opt in with IX_AUTO_MAP_CLOUD=1. Adds unit tests for the lock, abort-aware retry, and auto-skip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ix map background refresh: single-flight + deadlineix map background refresh (single-flight + deadline)
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.
What
ix mapruns both interactively and as an automatic background refresh (editor/agent hooks re-map on change). Repeated or overlapping invocations could stack and run unbounded against a slow backend. This makes the refresh safe to run frequently.Changes
single-flight.ts): oneix mapper workspace at a time. A concurrent invocation coalesces and exits 0 instead of stacking. The lock auto-releases on exit and a stale lock (dead or aged-out holder) is stolen, so it never wedges. Holds regardless of launcher (hook, watcher, manual, CI).list/source-hashes/stitchrequests now get a per-request timeout too. Tunable viaIX_MAP_DEADLINE_MS(0 disables).IX_AUTO_MAP=1),ix mapskips if the active backend is remote — remote ingestion should be deliberate, not a write on every change from every client. Manualix mapis unaffected;IX_AUTO_MAP_CLOUD=1opts the automatic path back in.Tests
New unit tests for the single-flight lock, abort-aware retry, and auto-skip decision. Full suite: 532 passed / 2 skipped.
🤖 Generated with Claude Code