Skip to content

Commit a7312b1

Browse files
authored
fix(webapp): stop logging expected auth/restore conditions as errors (#3931)
Two expected, non-failure conditions were being logged at `error` level, which surfaces them as exceptions in error tracking and adds noise without signal. This downgrades both to `warn`. The first is the checkpoint-restore path when a `RESTORE` event already exists for a checkpoint — a benign idempotency skip on a duplicate or retried event. The second is the `/api/v1/token` endpoint when the authorization code is invalid or expired, which is the expected steady state while the CLI polls the endpoint during login; genuinely unexpected failures there still log at `error`. No behavior or response changes — the token endpoint still returns 400 in the same cases.
1 parent 911a1cf commit a7312b1

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Log expected auth-code and checkpoint-restore conditions at `warn` instead of `error`.

apps/webapp/app/routes/api.v1.token.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ export async function action({ request }: ActionFunctionArgs) {
3737
return json(responseJson);
3838
} catch (error) {
3939
if (error instanceof Error) {
40-
logger.error("Error getting PersonalAccessToken from AuthorizationCode", {
41-
url: request.url,
42-
error: error.message,
43-
});
40+
const expected = error.message === "Invalid authorization code, or code expired";
41+
const fields = { url: request.url, error: error.message };
42+
if (expected) {
43+
logger.warn("Error getting PersonalAccessToken from AuthorizationCode", fields);
44+
} else {
45+
logger.error("Error getting PersonalAccessToken from AuthorizationCode", fields);
46+
}
4447

4548
return json({ error: error.message }, { status: 400 });
4649
}

apps/webapp/app/v3/services/restoreCheckpoint.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class RestoreCheckpointService extends BaseService {
8282
});
8383

8484
if (restoreEvent) {
85-
logger.error("Restore event already exists", {
85+
logger.warn("Restore event already exists", {
8686
runId: checkpoint.runId,
8787
attemptId: checkpoint.attemptId,
8888
checkpointId: checkpoint.id,

0 commit comments

Comments
 (0)