feat: improve SessionStart hooks and feedback injection (#803)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
jnjpng
2026-02-03 15:57:58 -08:00
committed by GitHub
parent 8bc50b58ee
commit e2a0545a01
3 changed files with 106 additions and 7 deletions

View File

@@ -955,6 +955,36 @@ describe.skipIf(isWindows)("Hooks Integration Tests", () => {
expect(parsed.agent_id).toBe("agent-abc");
expect(parsed.agent_name).toBe("My Agent");
});
test("collects stdout as feedback regardless of exit code", async () => {
createHooksConfig({
SessionStart: [
{
matcher: "*",
hooks: [
{
type: "command",
command: "echo 'Session context for agent'",
},
],
},
],
});
const result = await runSessionStartHooks(
true,
"agent-123",
"Test Agent",
undefined,
tempDir,
);
// SessionStart collects stdout regardless of exit code
expect(result.feedback).toHaveLength(1);
expect(result.feedback[0]).toContain("Session context for agent");
// SessionStart never blocks
expect(result.blocked).toBe(false);
});
});
// ============================================================================