Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors logging behavior for 404 Not Found errors. It updates the sandbox timeout handler to log an info message instead of reporting a telemetry error when a sandbox is not found, configures the logger to include stack traces for error-level logs, and adjusts the logging middleware to log 404 StatusNotFound responses at the Info level rather than the Warn level. I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9009ffbab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
5aad415 to
d71980e
Compare
A timeout/pause call can race the sandbox's own expiry: the SDK cannot always know a sandbox is already gone before issuing the request, so KeepAliveFor returning 404 is an expected outcome, not a failure. PostSandboxesSandboxIDTimeout reported every KeepAliveFor error through telemetry.ReportError, which logs at WARN and records a span error. For the 404 case that is pure noise that buries real failures. Log the 404 at INFO (no stack trace, no span error) and keep ReportError for every other code. Also lower the access-log level for HTTP 404 responses from WARN to INFO in the shared logging middleware — a 404 is a normal "already gone / never existed" outcome, not a client error worth a WARN. To make the 404 branch testable without a real orchestrator, the handler now goes through a small timeoutOrchestrator interface (timeoutBackendOverride), matching the existing pause/fork/connect backend-override pattern. Added a test asserting a 404 records no span error while a 5xx still does.
20daeec to
8299ea2
Compare
8299ea2 to
ac81f60
Compare
Summary
A timeout/pause call can race the sandbox's own expiry — the SDK cannot always know a sandbox is already gone before issuing the request, so a
404fromKeepAliveForis an expected outcome, not a failure. The handler previously reported everyKeepAliveForerror throughtelemetry.ReportError, which logs at WARN and records a span error. For the 404 case that is pure noise that buries real failures.Changes
sandbox_timeout.go— on a404, log at INFO (no stack trace, no span error) instead oftelemetry.ReportError. Every other status still flows throughReportError, so real 5xx failures stay visible. The handler now callsKeepAliveForthrough a smalltimeoutOrchestratorinterface (timeoutBackendOverride), matching the existing pause/fork/connect backend-override pattern, so the branch is testable without a real orchestrator.middleware/logging.go— HTTP404responses log at INFO instead of WARN in the request access log. A 404 is a normal "already gone / never existed" outcome, not a client error.Note (scope reduced from the original PR)
The original PR also edited
logger/logger.goto cap automatic stack-trace capture atErrorLevel, on the premise that stack traces were attached to every WARN. That premise does not hold on currentmain: the logger config already setsDevelopment: false, and zap captures stack traces atErrorLevel(notWarnLevel) in non-development mode (zap.Config.buildOptions→stackLevel := ErrorLevel). Thelogger.gochange was therefore a no-op and has been dropped.Test plan
go test ./internal/handlers/ -shortpasses (DB-gated integration tests skipped).sandbox_timeout_notfound_test.go: a 404 fromKeepAliveForreturns 404 to the client and records no span error; a 5xx still records a span error (real failures stay visible).packages/apiandpackages/shared/pkg/middleware./cc @ryan-sana @jakubno @dobrac @ValentaTomas @arkamar @tvi Looking forward to your code review.