mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Emit a visible Goal continuing local-command marker before managed /goal continuations, then preserve it through server events, session history, and desktop history restore. Render the marker as a compact divider so a new assistant continuation after end_turn is visually separated from the previous assistant output. Related: #901 Tested: bun test src/query/stopHooks.test.ts src/server/__tests__/ws-memory-events.test.ts src/server/__tests__/sessions.test.ts && cd desktop && bun run test MessageList.test.tsx chatStore.test.ts Tested: bun run check:server Tested: bun run check:desktop Not-tested: live release build and Windows v0.4.3 repro path; keep issue open until release validation. Scope-risk: moderate Confidence: high
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import {
|
|
formatGoalContinuationStatusOutput,
|
|
shouldLetGoalPromptHookContinue,
|
|
} from './stopHooks.js'
|
|
|
|
describe('stop hook goal continuation', () => {
|
|
test('converts unmet managed /goal prompt hooks into normal blocking continuation', () => {
|
|
expect(
|
|
shouldLetGoalPromptHookContinue({
|
|
preventContinuation: true,
|
|
blockingError: {
|
|
blockingError: 'Prompt hook condition was not met: keep working',
|
|
command: '<cc-haha-goal-hook>\nship the feature',
|
|
},
|
|
}),
|
|
).toBe(true)
|
|
})
|
|
|
|
test('preserves prevent-continuation semantics for non-goal hooks', () => {
|
|
expect(
|
|
shouldLetGoalPromptHookContinue({
|
|
preventContinuation: true,
|
|
blockingError: {
|
|
blockingError: 'Prompt hook condition was not met: stop',
|
|
command: 'ordinary prompt hook',
|
|
},
|
|
}),
|
|
).toBe(false)
|
|
|
|
expect(
|
|
shouldLetGoalPromptHookContinue({
|
|
preventContinuation: false,
|
|
blockingError: {
|
|
blockingError: 'Prompt hook condition was not met: keep working',
|
|
command: '<cc-haha-goal-hook>\nship the feature',
|
|
},
|
|
}),
|
|
).toBe(false)
|
|
})
|
|
|
|
test('formats goal continuation status output for visible transcript separators', () => {
|
|
expect(
|
|
formatGoalContinuationStatusOutput(
|
|
'Prompt hook condition was not met: finish <release> & verify',
|
|
),
|
|
).toBe('Goal continuing: finish release verify')
|
|
})
|
|
})
|