fix: refactor 5 additional aliased output.args mutations + strengthen audit test
Address Oracle review feedback: refactor 4 aliased mutations via argsObject in plugin/tool-execute-before.ts and 1 via toolOutput in atlas/tool-execute-before.ts. Strengthen audit test regex to catch Output.args mutations regardless of the variable name prefix (toolOutput, argsObject aliases). Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -100,21 +100,20 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
}
|
||||
|
||||
if (input.tool === "task") {
|
||||
const argsObject = output.args
|
||||
const category = typeof argsObject.category === "string" ? argsObject.category : undefined
|
||||
const subagentType = typeof argsObject.subagent_type === "string" ? argsObject.subagent_type : undefined
|
||||
const taskId = typeof argsObject.task_id === "string" ? argsObject.task_id : undefined
|
||||
const category = typeof output.args.category === "string" ? output.args.category : undefined
|
||||
const subagentType = typeof output.args.subagent_type === "string" ? output.args.subagent_type : undefined
|
||||
const taskId = typeof output.args.task_id === "string" ? output.args.task_id : undefined
|
||||
|
||||
if (category) {
|
||||
argsObject.subagent_type = "sisyphus-junior"
|
||||
replaceToolArgs(output, { subagent_type: "sisyphus-junior" })
|
||||
} else if (!subagentType && taskId) {
|
||||
const resolvedAgent = await resolveSessionAgent(ctx.client, taskId)
|
||||
argsObject.subagent_type = resolvedAgent ?? "continue"
|
||||
replaceToolArgs(output, { subagent_type: resolvedAgent ?? "continue" })
|
||||
}
|
||||
|
||||
const normalizedSubagentType =
|
||||
typeof argsObject.subagent_type === "string" ? stripInvisibleAgentCharacters(argsObject.subagent_type) : undefined
|
||||
const prompt = typeof argsObject.prompt === "string" ? argsObject.prompt : ""
|
||||
typeof output.args.subagent_type === "string" ? stripInvisibleAgentCharacters(output.args.subagent_type) : undefined
|
||||
const prompt = typeof output.args.prompt === "string" ? output.args.prompt : ""
|
||||
const loopState = typeof ctx.directory === "string" ? readState(ctx.directory) : null
|
||||
const shouldInjectOracleVerification =
|
||||
normalizedSubagentType === "oracle"
|
||||
@@ -136,12 +135,14 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
verification_attempt_id: verificationAttemptId,
|
||||
verification_session_id: undefined,
|
||||
})
|
||||
argsObject.run_in_background = false
|
||||
argsObject.prompt = buildUltraworkOracleVerificationPrompt(
|
||||
prompt,
|
||||
loopState.prompt,
|
||||
verificationAttemptId,
|
||||
)
|
||||
replaceToolArgs(output, {
|
||||
run_in_background: false,
|
||||
prompt: buildUltraworkOracleVerificationPrompt(
|
||||
prompt,
|
||||
loopState.prompt,
|
||||
verificationAttemptId,
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user