mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
fix(runner) preserve native instructions (#1557)
* fix(codex): preserve native instructions Keep HAPI guidance in the developer layer so app-server retains Codex persistence rules. Align long-running goal states with the Codex 0.147 protocol. * fix(codex): filter new goal statuses
This commit is contained in:
@@ -15,6 +15,29 @@ describe('appServerConfig', () => {
|
||||
return `${developerInstructions}\n\n${codexCollaborationSpawnAgentInstructions}`;
|
||||
};
|
||||
|
||||
it('preserves Codex built-in base instructions by omitting the default override', () => {
|
||||
const params = buildThreadStartParams({
|
||||
cwd: '/workspace/project',
|
||||
mode: { permissionMode: 'default', collaborationMode: 'default' },
|
||||
mcpServers
|
||||
});
|
||||
|
||||
expect(params).not.toHaveProperty('baseInstructions');
|
||||
expect(params.developerInstructions).toBe(codexSystemPrompt);
|
||||
});
|
||||
|
||||
it('keeps an explicit base instruction override separate from HAPI developer instructions', () => {
|
||||
const params = buildThreadStartParams({
|
||||
cwd: '/workspace/project',
|
||||
mode: { permissionMode: 'default', collaborationMode: 'default' },
|
||||
mcpServers,
|
||||
baseInstructions: 'Custom base instructions.'
|
||||
});
|
||||
|
||||
expect(params.baseInstructions).toBe('Custom base instructions.');
|
||||
expect(params.developerInstructions).toBe(codexSystemPrompt);
|
||||
});
|
||||
|
||||
it('applies CLI overrides when permission mode is default', () => {
|
||||
const params = buildThreadStartParams({
|
||||
cwd: '/workspace/project',
|
||||
@@ -26,7 +49,7 @@ describe('appServerConfig', () => {
|
||||
expect(params.cwd).toBe('/workspace/project');
|
||||
expect(params.sandbox).toBe('danger-full-access');
|
||||
expect(params.approvalPolicy).toBe('never');
|
||||
expect(params.baseInstructions).toBe(codexSystemPrompt);
|
||||
expect(params.baseInstructions).toBeUndefined();
|
||||
expect(params.developerInstructions).toBe(codexSystemPrompt);
|
||||
expect(params.config).toEqual({
|
||||
'mcp_servers.hapi': {
|
||||
@@ -129,7 +152,7 @@ describe('appServerConfig', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('concatenates custom developer instructions after base instructions', () => {
|
||||
it('concatenates custom developer instructions after HAPI instructions without overriding base instructions', () => {
|
||||
const params = buildThreadStartParams({
|
||||
cwd: '/workspace/project',
|
||||
mode: { permissionMode: 'default', collaborationMode: 'default' },
|
||||
@@ -137,7 +160,7 @@ describe('appServerConfig', () => {
|
||||
developerInstructions: 'Only respond in Chinese.'
|
||||
});
|
||||
|
||||
expect(params.baseInstructions).toBe(codexSystemPrompt);
|
||||
expect(params.baseInstructions).toBeUndefined();
|
||||
expect(params.developerInstructions).toBe(`${codexSystemPrompt}\n\nOnly respond in Chinese.`);
|
||||
expect(params.config).toEqual({
|
||||
'mcp_servers.hapi': {
|
||||
|
||||
Reference in New Issue
Block a user