Show the error reason after the generic failure message
When an agent turn fails, users only saw "요청을 완료하지 못했습니다. 다시
시도해 주세요." with no clue why. Capture the failure reason (explicit
error field, or provider-error text like "API Error: 529 Overloaded"
classified by detectClaudeProviderFailureMessage) in the turn controller
and append it to the failure message ("...\n\n오류 내용: <reason>",
secret-redacted + length-capped). Update the paired-room loop filter to
startsWith so a failure-with-reason is still recognized and not
re-injected into prompt history. Unit-tested.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,16 @@ vi.mock('./config.js', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('./service-routing.js', async () => {
|
||||
const actual =
|
||||
await vi.importActual<typeof import('./service-routing.js')>(
|
||||
'./service-routing.js',
|
||||
);
|
||||
return { ...actual, hasReviewerLease: vi.fn(() => true) };
|
||||
});
|
||||
|
||||
import {
|
||||
filterLoopingPairedBotMessages,
|
||||
matchesExpectedPairedFollowUpIntent,
|
||||
resolveFollowUpDispatch,
|
||||
resolveExecutionTarget,
|
||||
@@ -19,6 +28,7 @@ import {
|
||||
resolveQueuedTurnRole,
|
||||
resolveSessionFolder,
|
||||
} from './message-runtime-rules.js';
|
||||
import { appendErrorDetailToFailureText } from './message-turn-controller.js';
|
||||
import {
|
||||
resolveLeaseServiceId,
|
||||
type EffectiveChannelLease,
|
||||
@@ -38,6 +48,33 @@ const baseLease: EffectiveChannelLease = {
|
||||
explicit: true,
|
||||
};
|
||||
|
||||
describe('filterLoopingPairedBotMessages', () => {
|
||||
const FAIL = '요청을 완료하지 못했습니다. 다시 시도해 주세요.';
|
||||
const msg = (content: string, isBot: boolean) =>
|
||||
({ content, is_bot_message: isBot }) as never;
|
||||
|
||||
it('filters both the plain failure and a failure that carries an error reason', () => {
|
||||
const detailed = appendErrorDetailToFailureText(
|
||||
FAIL,
|
||||
'API Error: 529 Overloaded',
|
||||
);
|
||||
const out = filterLoopingPairedBotMessages(
|
||||
'chat-1',
|
||||
[
|
||||
msg(FAIL, true),
|
||||
msg(detailed, true),
|
||||
msg('진짜 사용자 메시지', false),
|
||||
msg('GPU 상태 정상입니다', true),
|
||||
],
|
||||
FAIL,
|
||||
);
|
||||
expect(out.map((m) => (m as { content: string }).content)).toEqual([
|
||||
'진짜 사용자 메시지',
|
||||
'GPU 상태 정상입니다',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('message-runtime-rules', () => {
|
||||
it('maps review_ready to a reviewer turn', () => {
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user