mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-08 01:43:07 +00:00
fix(cli): trust injected Codex session hook
Codex now requires hook trust before non-managed hooks can run. HAPI relies on the runtime-injected SessionStart hook to receive the Codex thread/session id, so leaving that hook untrusted breaks local Codex startup without manual /hooks review.\n\nGenerate the same trusted_hash Codex derives for the injected SessionStart command and pass it through the runtime hooks.state override. The trust is scoped to the synthetic session-flags hook key and the exact generated command, so user, project, and plugin hooks still go through Codex review normally.\n\nAlso cover the generated config args so future changes keep both the hook declaration and its trust state together.\n\nValidation:\n- bun test cli/src/codex/utils/codexMcpConfig.test.ts\n- bun typecheck
This commit is contained in:
@@ -103,6 +103,10 @@ describe('codexMcpConfig', () => {
|
||||
expect(args[1]).toContain('hooks.SessionStart=[');
|
||||
expect(args[1]).toContain('type = "command"');
|
||||
expect(args[1]).toContain('hook-forwarder --port 4312 --token secret-token');
|
||||
expect(args[2]).toBe('-c');
|
||||
expect(args[3]).toContain('hooks.state={');
|
||||
expect(args[3]).toContain(':session_start:0:0');
|
||||
expect(args[3]).toContain('trusted_hash="sha256:');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user