Skip to content

fix(server): truncate oversized log lines and catch buffer allocation errors - #6469

Open
sentry[bot] wants to merge 1 commit into
devfrom
seer/fix/server-log-memory-range-error
Open

sentry[bot] wants to merge 1 commit into
devfrom
seer/fix/server-log-memory-range-error

Conversation

@sentry

@sentry sentry Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

What is this about?

Stopping the OpenWork server from crashing when it writes a very large log line.

What problem does it solve?

Some requests, such as /workspace/:id/opencode/* or session-groups/events, return large responses. The JSON log record for one can exceed Node's internal buffer allocation limit. Writing it then throws RangeError: Failed to allocate memory, which crashes the server. Logging must never fail an otherwise successful request, and this breaks that rule.

What was the situation before?

The log output error check only recognized specific system error codes: EPIPE, ERR_STREAM_DESTROYED, ENOSPC, EDQUOT, and EIO. A RangeError has no .code property, so it was re-thrown and crashed the server.

How is this implemented?

  • apps/server/src/log-utils.ts: log output helpers moved here so they can be unit-tested without the full server dependency tree.
  • truncateLogLine: caps each line at 2 MiB and appends [LOG TRUNCATED].
  • isUnavailableLogOutputError: now treats RangeError as suppressible.
  • writeLogLine: catches RangeError, skips that one record, and keeps stdout logging active for later requests.

What else changed?

none

Release note

OpenWork server no longer crashes when a request returns a very large response; oversized log lines are shortened instead.

Evidence

  • Unit tests added in apps/server/test/server-log-output.test.ts covering truncation boundaries and error classification. This description links no test results or report.

Fixes DESKTOP-APP-3F

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics October 24, 2026 11:06 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-landing October 24, 2026 11:06 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-app October 24, 2026 11:06 Inactive
@vercel
vercel Bot temporarily deployed to Preview – openwork-den October 24, 2026 11:06 Inactive
@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Oct 24, 2026 11:06am UTC
openwork-den Skipped Skipped Oct 24, 2026 11:06am UTC
openwork-diagnostics Skipped Skipped Oct 24, 2026 11:06am UTC
openwork-landing Skipped Skipped v0 Oct 24, 2026 11:06am UTC

Request Review

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

OpenWork evidence

Status Commit Preview Updated
🟡 Updating evidence 3bc1f95 View run 2026-10-24 11:07:21 UTC

A preview for this commit is being prepared.

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden clearance. Complete security and confidentiality review of 3bc1f9551aa8a4177f9c8298421bf94cc2612ae5 found no high or medium security findings and no confidentiality findings. Any new push dismisses this approval. Analysis run

@diff-warden

diff-warden Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Warden: approved

No high or medium security findings and no confidentiality findings.

Reviewed 3bc1f9551aa8 · Warden run · Updates after every Warden run.

This branch is waiting to be deployed

4 inactive and 1 waiting deployments
Preview – openwork-diagnostics — 3bc1f955 Deployed Oct 24, 2026 by vercel[bot]
Preview – openwork-app — 3bc1f955 Deployed Oct 24, 2026 by vercel[bot]
Preview – openwork-den — 3bc1f955 Deployed Oct 24, 2026 by vercel[bot]
Preview – openwork-landing — 3bc1f955 Deployed Oct 24, 2026 by vercel[bot]
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.

0 participants