Repair Prometheus JSON + in-place re-login modal - #27
Merged
Conversation
A stray backslash (e.g. an unescaped Windows path) in a Prometheus reply failed all three JSON-extraction attempts and dumped the raw envelope into the chat bubble. repairNearMissJson() now fixes invalid escapes and unescaped control characters inside strings before extraction runs, and a recovery warning is pushed whenever anything past a clean first parse was needed. ChatPanel now renders that warning for modifications-less turns too, where the proposal card never mounts to show it. Closes #12 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GYBpuCrvmUzNCGcFABRGw
apiFetch previously hard-navigated to /login on any 401, discarding unsaved state (a half-typed chat message, an in-progress edit). It now shows a re-auth modal (reusing LoginForm's existing embedded mode) and, on successful re-auth, retries the original request and resumes in place instead of just avoiding navigation. Concurrent 401s share one prompt. A cancelled re-auth, or a retry still 401, falls back to the old hard-navigate behavior. Mounted once at the root layout so it covers every apiFetch call site. Closes #14 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GYBpuCrvmUzNCGcFABRGw
Label and For were unbounded free text that could wrap a row across several lines, and the Code column's Copy button could get clipped by the panel's overflow-hidden. Truncates Label/For at 110px with a hover tooltip for the full value, marks the remaining short/bounded columns whitespace-nowrap, wraps the table in its own overflow-x-auto scroll container instead of relying on the panel's clipping overflow, and reorders columns (Revoke, Code, For, Created, Expires, Status, Label) per live iteration against the running table. Created (and a redeemed row's "Redeemed ..." timestamp) now render as a local DD/MM hh:mm format specific to this table, not a change to prefsShared.tsx's shared formatTs() used elsewhere. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GYBpuCrvmUzNCGcFABRGw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
repairNearMissJson()fixes invalid backslash escapes and unescaped control characters inside Prometheus's JSON string literals before the existing 3-attempt parse cascade runs; a recovery warning now surfaces whenever anything past a clean first parse was needed (repair, fence-strip, or slice), including for modifications-less turns where the proposal card never mounts to show it.apiFetchno longer hard-navigates to/loginimmediately on a 401. It shows an in-place re-auth modal (reusingLoginForm's existingembeddedmode) and, on successful password re-auth, retries the original request and resumes in place — a chat send actually completes, not just avoids losing the draft. Concurrent 401s share one prompt. Cancel, or a retry still 401, falls back to the old hard-navigate.overflow-x-autoinstead of clipping), Revoke moved to the first column, and a compactDD/MM hh:mmdate format for this table's Created/Redeemed columns.Known gap, filed separately as #26 (not fixed here): the modal's "Continue with Google" path signs back in but does not resume the in-flight action (OAuth is a full-page redirect round trip) and currently lands on the default agent rather than the page the user was on. Reproduced live.
Test plan
/login?next=...npx vitest run lib/ai/__tests__/prometheus.test.ts lib/__tests__/apiFetch.test.tspass before merge if you want CI to be the first runnerCloses #12
Closes #14
🤖 Generated with Claude Code
https://claude.ai/code/session_011GYBpuCrvmUzNCGcFABRGw