Skip to content

fix: add 10s per-file timeout to ingest to prevent hangs on large repos - #126

Closed
four-bytes-robby wants to merge 1 commit into
mainfrom
fix/ingest-timeout
Closed

four-bytes-robby wants to merge 1 commit into
mainfrom
fix/ingest-timeout

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 11, 2026

Copy link
Copy Markdown
Member

Changes

  • Added 10-second per-file timeout to ingest processing to prevent hangs on large repos
  • Version bump 1.7.3 → 1.7.4

Checklist

  • Build succeeds
  • Changes tested locally
  • Conventional commit format

Summary by cubic

Add a 10-second per-file timeout to the ingest pipeline to prevent hangs on large repos. Bumps @four-bytes/four-opencode-brain to 1.7.4.

  • Bug Fixes
    • Enforces a 10s per-file limit with Promise.race; on timeout, emits ingest.file_timeout, records an error, increments filesProcessed, and continues to the next file.
    • Refactors the file loop into a processFile function with early returns for simpler flow.

Written for commit 9e7e40d. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/ingest/index.ts">

<violation number="1" location="src/ingest/index.ts:393">
P1: `Promise.race` timeout does not cancel `processFile`, so timed-out files can still mutate DB/state after being marked timed out.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/ingest/index.ts

for (const [i, walked] of walkedFiles.entries()) {
try {
await Promise.race([

@cubic-dev-ai cubic-dev-ai Bot Jun 11, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Promise.race timeout does not cancel processFile, so timed-out files can still mutate DB/state after being marked timed out.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/ingest/index.ts, line 393:

<comment>`Promise.race` timeout does not cancel `processFile`, so timed-out files can still mutate DB/state after being marked timed out.</comment>

<file context>
@@ -383,10 +386,27 @@ export async function ingestPath(
+
+    for (const [i, walked] of walkedFiles.entries()) {
+        try {
+            await Promise.race([
+                processFile(walked, i),
+                new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), FILE_TIMEOUT_MS))
</file context>
Fix with cubic

@four-bytes-robby

Copy link
Copy Markdown
Member Author

Superseded by #132 (timeout fix integrated there)

@four-bytes-robby
four-bytes-robby deleted the fix/ingest-timeout branch June 15, 2026 15:15
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