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:
Shawn Tian
2026-08-16 22:38:15 +08:00
committed by GitHub
parent e32334fbb2
commit 5c81ed69e2
17 changed files with 208 additions and 19 deletions
+26 -3
View File
@@ -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': {