* fix: Codex CLI SessionStart additionalContext at top level (#505) Codex CLI expects additionalContext at the top level of the hook output, not nested under hookSpecificOutput. Flattened the Codex branch of writeHookOutput so the injected instructions actually reach the agent. Fixes #505 * Merge main; move #99 Codex @ponytail report assertion to top-level additionalContext (#505) --------- Co-authored-by: Emeriko <dietrich.gebert@gmail.com>
This commit is contained in:
parent
055a1453d3
commit
33c00d3d7a
|
|
@ -43,10 +43,10 @@ function writeHookOutput(event, mode, context = '') {
|
|||
if (isCodex) {
|
||||
const output = { systemMessage: `PONYTAIL:${mode.toUpperCase()}` };
|
||||
if (context) {
|
||||
output.hookSpecificOutput = {
|
||||
hookEventName: event,
|
||||
additionalContext: context,
|
||||
};
|
||||
// ponytail: Codex CLI expects additionalContext at top level, not nested
|
||||
// under hookSpecificOutput. The hookSpecificOutput wrapper is for Claude
|
||||
// Code's SubagentStart. See issue #505.
|
||||
output.additionalContext = context;
|
||||
}
|
||||
process.stdout.write(JSON.stringify(output));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -61,9 +61,10 @@ assert.equal(fs.readFileSync(codexState, 'utf8'), 'ultra');
|
|||
let output = JSON.parse(result.stdout);
|
||||
assert.equal(output.systemMessage, 'PONYTAIL:ULTRA');
|
||||
assert.match(
|
||||
output.hookSpecificOutput.additionalContext,
|
||||
output.additionalContext,
|
||||
/PONYTAIL MODE ACTIVE — level: ultra/,
|
||||
);
|
||||
assert.equal(output.hookSpecificOutput, undefined, 'Codex should not use hookSpecificOutput (#505)');
|
||||
|
||||
result = run(
|
||||
'ponytail-mode-tracker.js',
|
||||
|
|
@ -85,7 +86,7 @@ assert.equal(result.status, 0, result.stderr);
|
|||
assert.equal(fs.readFileSync(codexState, 'utf8'), 'lite');
|
||||
output = JSON.parse(result.stdout);
|
||||
assert.match(
|
||||
output.hookSpecificOutput.additionalContext,
|
||||
output.additionalContext,
|
||||
/PONYTAIL MODE ACTIVE — level: lite/,
|
||||
);
|
||||
|
||||
|
|
@ -229,8 +230,8 @@ result = run('ponytail-subagent.js', { HOME: subHome, USERPROFILE: subHome, PLUG
|
|||
assert.equal(result.status, 0, result.stderr);
|
||||
output = JSON.parse(result.stdout);
|
||||
assert.equal(output.systemMessage, 'PONYTAIL:FULL');
|
||||
assert.equal(output.hookSpecificOutput.hookEventName, 'SubagentStart');
|
||||
assert.match(output.hookSpecificOutput.additionalContext, /PONYTAIL MODE ACTIVE — level: full/);
|
||||
assert.ok(output.additionalContext, 'Codex SubagentStart should have additionalContext at top level (#505)');
|
||||
assert.match(output.additionalContext, /PONYTAIL MODE ACTIVE — level: full/);
|
||||
|
||||
// SubagentStart scoping (issue #506): PONYTAIL_SUBAGENT_MATCHER limits the
|
||||
// injection to agent types whose name matches the regex. Unset keeps the
|
||||
|
|
|
|||
Loading…
Reference in New Issue