mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
fix: omit reasoning summary for codex spark subagents (#594)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { EnhancedMode } from '../loop';
|
||||
import {
|
||||
buildThreadStartParams,
|
||||
buildTurnStartParams,
|
||||
codexCollaborationSpawnAgentInstructions
|
||||
codexCollaborationSpawnAgentInstructions,
|
||||
supportsReasoningSummary
|
||||
} from './appServerConfig';
|
||||
import { codexSystemPrompt } from './systemPrompt';
|
||||
|
||||
@@ -123,18 +125,100 @@ describe('appServerConfig', () => {
|
||||
expect(params.approvalPolicy).toBe('never');
|
||||
expect(params.sandboxPolicy).toEqual({ type: 'readOnly' });
|
||||
expect(params.effort).toBe('high');
|
||||
expect(params.summary).toBe('detailed');
|
||||
expect(params.summary).toBeUndefined();
|
||||
expect(params.collaborationMode).toEqual({
|
||||
mode: 'default',
|
||||
settings: {
|
||||
model: 'o3',
|
||||
reasoning_effort: 'high',
|
||||
developer_instructions: withCollaborationInstructions(codexSystemPrompt)
|
||||
}
|
||||
});
|
||||
expect(params.model).toBeUndefined();
|
||||
});
|
||||
|
||||
it('omits reasoning summary for models that do not support it', () => {
|
||||
const params = buildTurnStartParams({
|
||||
threadId: 'thread-1',
|
||||
message: 'hello',
|
||||
cwd: '/workspace/project',
|
||||
mode: {
|
||||
permissionMode: 'default',
|
||||
model: 'gpt-5.3-codex-spark',
|
||||
modelReasoningEffort: 'high',
|
||||
collaborationMode: 'default'
|
||||
}
|
||||
});
|
||||
|
||||
expect(params.effort).toBe('high');
|
||||
expect(params.summary).toBeUndefined();
|
||||
expect(params.collaborationMode).toEqual({
|
||||
mode: 'default',
|
||||
settings: {
|
||||
model: 'gpt-5.3-codex-spark',
|
||||
developer_instructions: withCollaborationInstructions(codexSystemPrompt)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('detects namespaced models that do not support reasoning summary', () => {
|
||||
const params = buildTurnStartParams({
|
||||
threadId: 'thread-1',
|
||||
message: 'hello',
|
||||
cwd: '/workspace/project',
|
||||
mode: {
|
||||
permissionMode: 'default',
|
||||
model: 'codex/gpt-5.3-codex-spark',
|
||||
modelReasoningEffort: 'high',
|
||||
collaborationMode: 'default'
|
||||
}
|
||||
});
|
||||
|
||||
expect(params.effort).toBe('high');
|
||||
expect(params.summary).toBeUndefined();
|
||||
});
|
||||
|
||||
it('normalizes reasoning summary model support checks', () => {
|
||||
expect(supportsReasoningSummary(' Codex/GPT-5.3-CODEX-SPARK ')).toBe(false);
|
||||
expect(supportsReasoningSummary('gpt-5.5')).toBe(true);
|
||||
expect(supportsReasoningSummary(undefined)).toBe(true);
|
||||
});
|
||||
|
||||
it('omits reasoning summary for non-collaboration turns on unsupported models', () => {
|
||||
const params = buildTurnStartParams({
|
||||
threadId: 'thread-1',
|
||||
message: 'hello',
|
||||
cwd: '/workspace/project',
|
||||
mode: {
|
||||
permissionMode: 'default',
|
||||
model: 'gpt-5.3-codex-spark',
|
||||
modelReasoningEffort: 'high'
|
||||
} as EnhancedMode
|
||||
});
|
||||
|
||||
expect(params.effort).toBe('high');
|
||||
expect(params.summary).toBeUndefined();
|
||||
expect(params.model).toBe('gpt-5.3-codex-spark');
|
||||
expect(params.collaborationMode).toBeUndefined();
|
||||
});
|
||||
|
||||
it('keeps reasoning summary for non-collaboration turns on supported models', () => {
|
||||
const params = buildTurnStartParams({
|
||||
threadId: 'thread-1',
|
||||
message: 'hello',
|
||||
cwd: '/workspace/project',
|
||||
mode: {
|
||||
permissionMode: 'default',
|
||||
model: 'o3',
|
||||
modelReasoningEffort: 'high'
|
||||
} as EnhancedMode
|
||||
});
|
||||
|
||||
expect(params.effort).toBe('high');
|
||||
expect(params.summary).toBe('detailed');
|
||||
expect(params.model).toBe('o3');
|
||||
expect(params.collaborationMode).toBeUndefined();
|
||||
});
|
||||
|
||||
it('puts collaboration mode in turn params with model settings', () => {
|
||||
const params = buildTurnStartParams({
|
||||
threadId: 'thread-1',
|
||||
@@ -152,7 +236,6 @@ describe('appServerConfig', () => {
|
||||
mode: 'plan',
|
||||
settings: {
|
||||
model: 'o3',
|
||||
reasoning_effort: 'high',
|
||||
developer_instructions: withCollaborationInstructions(codexSystemPrompt)
|
||||
}
|
||||
});
|
||||
@@ -189,6 +272,7 @@ describe('appServerConfig', () => {
|
||||
expect(instructions).toContain('If you call spawn_agent with fork_context: true');
|
||||
expect(instructions).toContain('do not set agent_type, model, or reasoning_effort');
|
||||
expect(instructions).toContain('omit fork_context or set fork_context: false');
|
||||
expect(instructions).toContain('Do not rely on parent turn reasoning settings for spawned agents');
|
||||
});
|
||||
|
||||
it('rejects collaboration mode payloads without a resolved model', () => {
|
||||
|
||||
Reference in New Issue
Block a user