Skip to content

Stop logToServer from recursing on failure - #6275

Merged
j0ntz merged 1 commit into
developfrom
jon/log-server-no-recursion
Oct 23, 2026
Merged

j0ntz merged 1 commit into
developfrom
jon/log-server-no-recursion

Conversation

@j0ntz

@j0ntz j0ntz commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Asana task

With LOG_SERVER set in config.json, src/app.ts points console.log, info, warn and error at logToServer. The failure handler in logToServer reported through that same console. Each failed POST queued two more POSTs to the unreachable server, and the count doubled every round.

The fix reports the failure through global.clog, which src/app.ts sets before the redirect. Capturing console inside logger.ts does not work in the app: Metro's inline requires load the logger on the first redirected call, after the redirect is in place. The new test loads the logger the same way. It sees 63 requests after six rounds without the fix and 1 with it.

Found while building per-slot app log capture for agent simulator runs, which points LOG_SERVER at a local listener. LOG_SERVER stays null in release builds. Production behavior does not change.

Tested on the iOS simulator with LOG_SERVER pointed at a server that reads each request and then drops the connection. Every POST fails there:

Build Requests Failure reports sent back
Before 4237 in 48 s 2118
After 359 in 92 s, during an ETH to SOL quote 0

The quote list loaded normally with every POST failing.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Note

Low Risk
Dev-only logging path when LOG_SERVER is set; production behavior is unchanged.

Overview
Fixes runaway HTTP traffic in dev when LOG_SERVER is configured but the listener is down or unreachable.

logToServer used console.error / console.log on POST failure; with src/app.ts redirecting those methods back to logToServer, each failed request spawned two more, doubling load every round. Failures now go through global.clog, the pre-redirect console saved in app.ts.

Adds a Jest test that mirrors Metro’s lazy logger load and asserts only one fetch per log line when the server errors. CHANGELOG notes the dev-build fix; release builds (LOG_SERVER null) are unchanged.

Reviewed by Cursor Bugbot for commit 90275f5. Bugbot is set up for automated code reviews on this repo. Configure here.

Test evidence

90275f5
Stop logToServer from recursing on failure
2026-10-17

1. swap quote logged to slot file

2. quotes load while log server drops requests

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-17T03:31:19.322062Z 90275f5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

With LOG_SERVER set, src/app.ts points console.log/info/warn/error at
logToServer. Its failure handler reported through that same console, so
each failed POST queued two more POSTs to the unreachable server, and
the count doubled on every round (63 requests after six rounds in the
new test). Report the failure through global.clog, which src/app.ts
sets before the redirect. Capturing console in logger.ts does not work:
Metro's inline requires load the logger on the first redirected call.
@j0ntz
j0ntz force-pushed the jon/log-server-no-recursion branch from 90275f5 to 40ffc7a Compare October 23, 2026 00:43
@cursor

cursor Bot commented Oct 23, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@j0ntz
j0ntz enabled auto-merge October 23, 2026 00:44
@j0ntz

j0ntz commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Landing this without a review.

  • Rationale: a dev-only logging fix that runs only when LOG_SERVER is configured, which release builds leave null
  • Authority: Force Land = Land Approved on the linked Asana task (1219236792960312)
  • Bypassed: the approving-review requirement only. Every required check is green on 40ffc7ada8e1748f9de0a4fb203bf150ae25497c.

@j0ntz
j0ntz merged commit 02dd456 into develop Oct 23, 2026
6 checks passed
@j0ntz
j0ntz deleted the jon/log-server-no-recursion branch October 23, 2026 01:11
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