Repository navigation
Show Core errors in the console language - #707
Merged
Merged
Conversation
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.
What
Every failure the console shows, read or write, now goes through the one shared helper,
coreError(error, t). Catalogued Core codes get their bilingual copy. Other codes show Core's English message in English and name the code in Chinese. A failure without a code names its HTTP status, and one that never reached Core uses the console's own words. Pages that wrap a reason in their own sentence ("无法加载 Item:…") keep that sentence and pass coreError as the reason.Call sites that used to show
error.messageand now use coreError:errorTextand its string state are gone. The overview hook returnsfailed, and the toast detail isreadFailure.unknown.isGatewayOrNetworkFailurenow classifies the error itself instead of matching message text.session-historykeeps the raw rejection reasons instead of strings.AgentCoreErrorand showsdelete.rejectedwith coreError.AgentCoreErrorinstead of a string.useDeleteFlow, used by Agents, Environment templates, Skills, Files and Vaults): the refusal shown in the confirm dialog.coreErrorMessageis deleted, and every Skill detail failure uses coreError.classifyFilesListError/filesErrorReasonmapping and itsfiles.errors.*keys are deleted.AgentCoreError, and the dialog showserrors.rejectedwith coreError, so code-less or param-less refusals no longer show raw English in zh.sandboxRequestError): a refusal outside the catalog now follows coreError instead of a fixed "request was rejected" sentence, so the console says which code Core refused with. The now-unused zh sandbox key is deleted.sandboxConfigurationRejection(lib/sandbox-labels.ts) kept a fallback to Core's raw message forsandbox_configuration_error. That code is catalogued, so the fallback never ran. It now returns the catalogued reason only.Left alone on purpose:
session-diagnostics.tsxshows API content and belongs to Fail Turns when the model host is unreachable #704.removal_unconfirmedsentinel andRuntimeDurableHistoryIncompleteErroralready map to localized keys.TypeError.messageonly to classify the error, never to show it.Why
The zh console showed Core's raw English error text on many pages, because each page rendered
error.messageitself. One helper keeps the rule in one place.Verification
pnpm --filter @oac/web typecheck: passed (also after the rebase onto Fail Turns when the model host is unreachable #704).vitest runon the touched tests (key-flows, file-operations, project-sessions, overview-loader, overview-model, executor-credential-ownership, session-history, locale, core-error): 9 files, 62 tests passed. The executor credentials zh test now asserts that a failed read names the code (Core 请求失败(credential_store_unavailable)。) and not Core's English message.resources.specnow injects its deletion refusal withcode: "conflict_error", as real Core sends one.internal_errorshows "无法加载 Item:Core 未能完成请求。" in zh.make check-namesandmake check-docs: passed.Skipped
make check: focused checks only.Need help on this PR? Tag
@codesmith-botwith what you need.