[codex] Add client failure reporting and visible surfacing#27
Draft
[codex] Add client failure reporting and visible surfacing#27
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Context: - translation failures could disappear in production because banner visibility, notification rendering, and fire-and-forget auto-translate handling were incomplete - the Vercel callback path needed proof before expanding client telemetry coverage Changes: - fix shared trial banner visibility and add a notification toast renderer with a single app-level mount - add the v1 client telemetry contract, redacting transport, global error forwarding, and classified translation failure emission - add a Vercel /api/client-telemetry proof handler with deployment notes and route verification - add regression and telemetry coverage for banner visibility, inline error rendering, callback validation, and translation classification Impact: - known and unexpected client failures are visible and measurable instead of failing silently - unexpected auto-translate promise failures now surface in UI and telemetry - the current Vite catch-all rewrite is proven not to shadow /api/client-telemetry Tests: - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vitest run tests/components/NotificationToast.test.tsx tests/components/DefaultKeyBanner.test.tsx tests/components/chapter/ChapterContent.test.tsx tests/current-system/translation.test.ts tests/services/clientTelemetry.test.ts tests/services/api-key-validation.test.ts - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npm run build - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vercel build - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vercel curl /api/client-telemetry --deployment https://codex-telemetry-fa9kmjyhm-adityas-projects-9c03351d.vercel.app - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vercel curl /api/client-telemetry --deployment https://codex-telemetry-fa9kmjyhm-adityas-projects-9c03351d.vercel.app -- --request POST --header 'content-type: application/json' --data '{"event_type":"translation_failed"}' Docs: - docs/WORKLOG.md - docs/guides/DEPLOYMENT.md
Context: - MainApp assumed handleTranslate returned a thenable and chained .catch() directly - appScreen.integration.test.tsx exposed that the boundary throws when a mock or sync implementation returns undefined Changes: - normalize the auto-translate call through Promise.resolve().then(...) so sync throws, undefined returns, and real promises share the same catch path - update the integration test mock to reflect the intended async handleTranslate contract Impact: - auto-translate error handling is robust at the async boundary - appScreen integration tests no longer fail on the same regression pattern Tests: - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vitest run tests/store/appScreen.integration.test.tsx
Context: - the post-review checklist required a real async-boundary fix, a rebase onto current main, and updated verification notes - WORKLOG needed the rebase result and the distinction between real regressions and mixed-suite timeout noise Changes: - record the MainApp promise-normalization fix and the aligned appScreen integration mock - document the successful rebase onto origin/main and the single worklog conflict resolution - log the post-rebase targeted test outcomes, including isolated reruns for the timeout-shaped mixed-suite failures Impact: - future review can distinguish resolved regressions from test-runner contention artifacts without rediscovering them Tests: - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vitest run tests/store/appScreen.integration.test.tsx - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npx vitest run tests/smoke/critical-components.smoke.test.tsx - export PATH="/Users/aditya/.nvm/versions/node/v22.17.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/bin:/Users/aditya/.codex/tmp/arg0/codex-arg0pDiON6:/Users/aditya/.antigravity/antigravity/bin:/Users/aditya/bin:/Users/aditya/.claude/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/aditya/.local/bin:/Users/aditya/.nvm/versions/node/v22.17.0/bin:/Applications/Codex.app/Contents/Resources" && npm run build
eec993c to
7900adb
Compare
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
This PR closes the immediate silent-failure gaps in the reader and lays down the first client telemetry path for production debugging. It makes known and unexpected translation failures visible to users, records the failure type at the store boundary, and adds a Vercel callback proof for best-effort client telemetry.
Root Cause
Translation failures could disappear in production because three paths were incomplete:
A post-review regression surfaced at the async boundary:
MainAppassumedhandleTranslate()always returned a thenable and chained.catch()directlyundefinedbroke that assumptionChanges
MainApp.tsx: mountNotificationToastonce at the app root, catch unexpected auto-translate failures, and normalize thehandleTranslate()boundary throughPromise.resolve().then(...)components/DefaultKeyBanner.tsx: fix shared-trial banner visibility and emit visible render telemetrycomponents/NotificationToast.tsx: add the missing notification renderercomponents/ChapterView.tsxandcomponents/chapter/ChapterContent.tsx: carry error telemetry into the reader surface and emitui_error_renderedservices/clientTelemetry.tsandtypes/telemetry.ts: add the v1 client telemetry contract, redacting transport, and callback/analytics routingservices/telemetryService.ts: forward early boot errors, uncaught exceptions, and unhandled rejections into the client telemetry pathservices/ai/apiKeyValidation.ts,services/translationService.ts,store/slices/translationsSlice.ts,store/slices/uiSlice.ts,store/slices/chaptersSlice.ts: classify translation failures and propagate structured telemetry metadata through the storeapi/client-telemetry.js: add the Vercel callback proof handlertests/store/appScreen.integration.test.tsx: align the mockedhandleTranslate()contract with the async store APImainto pick upff5d821and54d4279Testing
export PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vitest run tests/store/appScreen.integration.test.tsxexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vitest run tests/db/migrations/fresh-install.test.tsexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vitest run tests/services/navigationService.test.tsexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vitest run tests/components/NotificationToast.test.tsx tests/components/DefaultKeyBanner.test.tsx tests/components/chapter/ChapterContent.test.tsx tests/current-system/translation.test.ts tests/services/clientTelemetry.test.ts tests/services/api-key-validation.test.ts tests/api/client-telemetry.test.tsexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vitest run tests/smoke/critical-components.smoke.test.tsxexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npm run buildexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vercel buildexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vercel curl /api/client-telemetry --deployment https://codex-telemetry-fa9kmjyhm-adityas-projects-9c03351d.vercel.appexport PATH="$HOME/.nvm/versions/node/v22.17.0/bin:$PATH" && npx vercel curl /api/client-telemetry --deployment https://codex-telemetry-fa9kmjyhm-adityas-projects-9c03351d.vercel.app -- --request POST --header 'content-type: application/json' --data '{"event_type":"translation_failed"}'appScreen.integrationand the smoke import, but both files passed immediately in isolated reruns after rebase.fresh-installandnavigationServicewere green in the combined run, confirming the original branch-skew failures are resolved.Review Checklist
fix/codex-telemetry-uxvercel.jsonrewrite change was made because the deployed proof showed/api/client-telemetryis not shadowed by the SPA rewritemain