Skip to content

Commit 0e87915

Browse files
committed
fix(webapp): stop logging expected auth/restore conditions as errors
1 parent 43b4936 commit 0e87915

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Downgrade two expected, non-failure conditions from `error` to `warn` so they
7+
stop firing as Sentry errors:
8+
9+
- Checkpoint restore when a RESTORE event already exists (benign idempotency
10+
skip on a duplicate/retried event).
11+
- Token endpoint when the authorization code is invalid/expired, which is the
12+
expected steady state while the CLI polls during login. Genuinely unexpected
13+
failures still log at `error`.

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ 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+
// The CLI polls this endpoint while the user completes login, so an
41+
// invalid/expired code is the expected steady state, not an error.
42+
const expected = error.message === "Invalid authorization code, or code expired";
43+
const fields = { url: request.url, error: error.message };
44+
if (expected) {
45+
logger.warn("Error getting PersonalAccessToken from AuthorizationCode", fields);
46+
} else {
47+
logger.error("Error getting PersonalAccessToken from AuthorizationCode", fields);
48+
}
4449

4550
return json({ error: error.message }, { status: 400 });
4651
}

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

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

8484
if (restoreEvent) {
85-
logger.error("Restore event already exists", {
85+
// Idempotency guard: the restore already happened (duplicate/retried
86+
// event). This is a benign skip, not a failure.
87+
logger.warn("Restore event already exists", {
8688
runId: checkpoint.runId,
8789
attemptId: checkpoint.attemptId,
8890
checkpointId: checkpoint.id,

0 commit comments

Comments
 (0)