fix(model-router): a non-object Skill answer counts as no deny for the guard latch

This commit is contained in:
bchanot committed 2026-11-02 18:41:58 +01:00
1 parent c480f51977
commit 9bbd1d5baa
2 files changed
+17 -3

No files matched your search

+14
View File
@@ -7437,3 +7437,17 @@ test('GUARD: /clear re-arms it', async ($, on) => {
await clearSession($)
expect(denied(await write($, `${ROOT}/src/a.ts`))).toContain(GUARD)
})
test('GUARD: a deny-free Skill answer latches, the skill loads once', async (
$, on) => {
let ran = 0
on('tool.call', { tool: 'Skill' }, () => {
ran += 1
return { result: 'ok' as never }
})
writeBottoms(on)
await bootRig($, on, OPUS, 1000, newWorld())
await $.tool.call({ tool: 'Skill', skill: 'diagram' } as never)
expect(ran).toBe(1)
expect(denied(await write($, `${ROOT}/src/a.ts`))).toBe('')
})
+3 -3
View File
@@ -4571,9 +4571,9 @@ function registerSkills(on: On, st: State): void {
await tierAsk($, st, st.turnMain, `Skill /${clean(skill, NAME_CAP)}`)
}
const out = await next(e)
if (e.agentId === undefined && !('deny' in (out as Rec))) {
st.skillRun = true
}
const refused = typeof out === 'object' && out !== null &&
'deny' in out
if (e.agentId === undefined && !refused) st.skillRun = true
return out
} finally {
st.skillCalls -= 1