Skip to content

fix(app): eliminate submission starvation and timeouts - #53458

Open
4Liberty wants to merge 1 commit into
anomalyco:v2from
4Liberty:fix/submission-starvation-and-timeouts
Open

4Liberty wants to merge 1 commit into
anomalyco:v2from
4Liberty:fix/submission-starvation-and-timeouts

Conversation

@4Liberty

@4Liberty 4Liberty commented Oct 6, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #53049

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Resolves submission starvation and timeout aborts where user prompts, agent question replies, permissions, and commands take excessively long to submit or fail with "Request failed: Timed out waiting for the server to respond", particularly under multi-agent or background task loads.

  1. Interactive Request Prioritization: Interactive user actions (/prompt, /model, /agent, /form/reply, /permission/reply, /command, /shell, /abort, /cancel) are classified as priority requests and inserted ahead of waiting background reads in the queue via waiting.unshift(...).
  2. Concurrency Scaling & Budgets: Increased loopback request queue limit from 4 to 12 slots, raised standard headers timeout to 120s, and allocated a 180s timeout budget for priority requests.
  3. Resilient Question Form Mutations: Added retry: 3 and exponential backoff (retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 5000)) to replyMutation and rejectMutation. Transient network/queue spikes no longer drop questionnaire answers.
  4. Database Concurrency: Increased SQLite PRAGMA busy_timeout to 30s and enabled 2GB memory-mapped I/O to prevent lock contention during active concurrent sessions.

How did you verify your code works?

  • Added unit tests in packages/app/src/runtime/server/request-queue.test.ts verifying priority queue jumping and priority timeout behavior.
  • Verified that while 4 slow catalog/background requests are in flight, user prompt submissions dispatch immediately without waiting.
  • Confirmed questionnaire submissions retry cleanly on artificial transient failures without failing the prompt UI.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- Implement priority queueing in request-queue to prioritize user prompts, question form replies, permissions, commands, and aborts ahead of background sync.
- Scale requestQueueLimit to 12 and increase priority request timeout to 180s.
- Add retry logic with exponential backoff to question dock mutations.
- Increase SQLite busy_timeout to 30s and enable 2GB mmap_size to prevent database lock contention under multi-agent load.
- Increase SSE connect timeout to 10s and idle watchdog timeout to 90s to avoid false-positive reconnect storms.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title fix(app,core,client): eliminate submission starvation and timeouts doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@4Liberty 4Liberty changed the title fix(app,core,client): eliminate submission starvation and timeouts fix(app): eliminate submission starvation and timeouts Oct 8, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant