-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(agent): render subagent tool failures + harden memory lock symlinks #4507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
56 changes: 56 additions & 0 deletions
56
app/src/pages/conversations/components/ToolFailureLines.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { useT } from '../../../lib/i18n/I18nContext'; | ||
| import type { ToolFailureExplanation } from '../../../store/chatRuntimeSlice'; | ||
|
|
||
| /** | ||
| * The failure classes the UI has localized copy for (#4254 / #4459), keyed by | ||
| * the camelCase form of the wire's PascalCase `class`. Any class not in this | ||
| * set falls back to the English `causePlain` / `nextAction` on the payload. | ||
| */ | ||
| const LOCALIZED_FAILURE_CLASSES: ReadonlySet<string> = new Set([ | ||
| 'missingPermission', | ||
| 'missingApp', | ||
| 'serviceUnavailable', | ||
| 'badCredentials', | ||
| 'blockedByPolicy', | ||
| 'modelConnection', | ||
| 'timeout', | ||
| 'denied', | ||
| 'approvalExpired', | ||
| 'unknown', | ||
| ]); | ||
|
|
||
| /** Lowercase the first character: `MissingPermission` → `missingPermission`. */ | ||
| function toCamelClass(cls: string): string { | ||
| return cls.length > 0 ? cls[0].toLowerCase() + cls.slice(1) : cls; | ||
| } | ||
|
|
||
| /** | ||
| * The "why + what to do next" pair rendered under a failed tool row (#4254 / | ||
| * #4459). Copy resolves by failure class from i18n, falling back to the English | ||
| * `causePlain` / `nextAction` carried on the wire when the class is one the UI | ||
| * hasn't localized. Shared by the parent processing transcript and the | ||
| * sub-agent renderers so a failed child tool shows the same why/next copy. | ||
| */ | ||
| export function ToolFailureLines({ failure }: { failure: ToolFailureExplanation }) { | ||
| const { t } = useT(); | ||
| const camel = toCamelClass(failure.class); | ||
| const known = LOCALIZED_FAILURE_CLASSES.has(camel); | ||
| const cause = known | ||
| ? t(`conversations.toolFailure.${camel}.cause`, failure.causePlain) | ||
| : failure.causePlain; | ||
| const next = known | ||
| ? t(`conversations.toolFailure.${camel}.next`, failure.nextAction) | ||
| : failure.nextAction; | ||
| return ( | ||
| <span | ||
| data-testid="processing-tool-failure" | ||
| className="mt-1 flex flex-col gap-0.5 text-[11px] leading-snug"> | ||
| <span className="text-coral-600 dark:text-coral-300"> | ||
| <span className="font-semibold">{t('conversations.toolFailure.whyLabel')}:</span> {cause} | ||
| </span> | ||
| <span className="text-content-muted"> | ||
| <span className="font-semibold">{t('conversations.toolFailure.nextLabel')}:</span> {next} | ||
| </span> | ||
| </span> | ||
| ); | ||
| } |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hardening only makes the final
openno-follow undercfg(unix). In the supported Windows desktop build, the code still doessymlink_metadatafollowed by a normalOpenOptions::open, so a workspace-controlled process can swap.memory-write.lockto a reparse-point symlink in that gap and redirect the advisory lock outside the containment-checked workspace. Please either reject this path on Windows or open with the Windows no-reparse/fail-if-symlink flags as well.Useful? React with 👍 / 👎.