fix(agent-loop): open turns before pre-step

This commit is contained in:
_Kerman
2026-08-04 13:49:35 +08:00
parent 0ac95437b4
commit d4fa26023d
154 changed files with 1104 additions and 1099 deletions
+4 -2
View File
@@ -108,7 +108,7 @@ export function apply(ctx: Context, config: Config): void {
* Run and fold one configured Codex hook point.
*
* A supplied turn records the hook provenance pair inside that open turn.
* Pre-turn `UserPromptSubmit` and detached lifecycle points omit it.
* Detached lifecycle points omit it.
*/
async function runPoint(
point: string,
@@ -203,7 +203,9 @@ export function apply(ctx: Context, config: Config): void {
turn_id: String(turn),
prompt: blocksToText(messages.flatMap(message => message.content)),
}
const merged = await runPoint('UserPromptSubmit', '', payload, { agent, plainStdoutAsContext: true, signal })
const merged = await runPoint('UserPromptSubmit', '', payload, {
agent, turn, plainStdoutAsContext: true, signal,
})
/* jscpd:ignore-start */
if (merged.decision === 'deny') {
return { kind: 'reject' }