Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Oct 26, 2025

When using spotlight run if the process is not using Sentry SDK
with logs integration, we lose all its logging output that comes
to stdout/stderr. This change automatically captures that output
checks against any log items we receive from the process on the
sidecar and sends them as Sentry log events only if we cannot
get any logs from our integration.

Note: mostly vibe-coded

When using `spotlight run` if the process is not using Sentry SDK
with logs integration, we lose all its logging output that comes
to stdout/stderr. This change automatically captures that output
checks against any log items we receive from the process on the
sidecar and sends them as Sentry log events only if we cannot
get any logs from our integration.
@vercel
Copy link

vercel bot commented Oct 26, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
spotlightjs Skipped Skipped Oct 27, 2025 2:01pm

@BYK BYK marked this pull request as ready for review October 27, 2025 07:42
@BYK BYK requested a review from betegon October 27, 2025 07:42
Comment on lines 124 to 134
logger.debug("Detected Sentry logging in the process, disabling stdio relay");
relayStdioAsLogs = false;
// Return false to skip this log (prevent duplicate)
return false;
}
}
}
}

return true;
};
Copy link

Choose a reason for hiding this comment

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

Bug: fuzzySearcher starts empty, causing relayStdioAsLogs to remain true if SDK logs arrive first.
Severity: HIGH | Confidence: 0.90

🔍 Detailed Analysis

The fuzzySearcher is initialized empty. If Sentry SDK logs are received by the sidecar via the /stream endpoint before any stdout/stderr data has been processed and added to the searcher, the fuzzySearcher.search() operation will not find any matches. This prevents the relayStdioAsLogs flag from being correctly set to false, leading to continued duplication of logs where both stdout/stderr and SDK logs are sent.

💡 Suggested Fix

Ensure fuzzySearcher is populated with initial stdout/stderr data before processing SDK logs, or delay SDK log processing. Alternatively, initialize relayStdioAsLogs to false and only set it to true if no SDK logs are detected.

🤖 Prompt for AI Agent
Fix this bug. In packages/sidecar/src/cli/run.ts at lines 91-134: The `fuzzySearcher` is
initialized empty. If Sentry SDK logs are received by the sidecar via the `/stream`
endpoint before any stdout/stderr data has been processed and added to the searcher, the
`fuzzySearcher.search()` operation will not find any matches. This prevents the
`relayStdioAsLogs` flag from being correctly set to `false`, leading to continued
duplication of logs where both stdout/stderr and SDK logs are sent.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member

@betegon betegon left a comment

Choose a reason for hiding this comment

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

great one! one step closer to a great spotlight run

cursor[bot]

This comment was marked as outdated.

@BYK BYK requested a review from betegon October 27, 2025 14:05
Copy link
Member

@betegon betegon left a comment

Choose a reason for hiding this comment

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

let's go. loved the new comments you added btw.

@BYK
Copy link
Member Author

BYK commented Oct 27, 2025

loved the new comments you added btw.

All Cursor 😅

@BYK BYK merged commit 9cc23af into main Oct 27, 2025
20 checks passed
@BYK BYK deleted the byk/feat/run-auto-log-stdio branch October 27, 2025 15:24
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.

3 participants