Session 135 answered a coordinator's ask_user card and the next reply
proposed and created a custom tool while the header still said Plan mode
was on. Two gaps let it happen.
The card's answer was posted as an ordinary user message and queued as a
plain reply, so run-bot-reply read plan_mode as false and applied no
allowlist. bot_questions now records plan_mode from the run that asked,
and postBotQuestionAnswers carries it onto the message and the queued
reply, for both the answer and the skip. Only Tab, or approving a plan,
leaves the mode; the prompt's "their answer runs with the save allowed"
escape is gone from PlanModeNote, planModeFileEscape and their review
fault.
The mode also hid write tools, so a refused call came back as "There is
no tool called ...", which is untrue and hides the reason. filterPlanModeTools
becomes gatePlanModeTools: every tool keeps its name, description and
schema, and only run is replaced with the Plan mode refusal, so the bot
reads why it stopped and can say so. load_tools is gated the same way, so
a deferred tool can't be pulled in.
prose-choice-question now reads an offer ending in a colon ("Want me to:")
and treats "want me to", "should i" and "shall i" as choice cues, so the
reply that closed session 135 is sent back to ask_user instead of being
shipped as prose options.
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import type { HarnessToolUse } from "@/src/harness/types";
|
|
import type { ReplyStatus } from "@/src/dict/reply-status-dict";
|
|
import type { StorageScope } from "@/src/utils/storage-access";
|
|
import reviewBotReply from "./review-bot-reply";
|
|
|
|
type Params = {
|
|
bot_id: number | string;
|
|
user_id: number | string;
|
|
session_id: number | string;
|
|
job_id?: number | string;
|
|
/**
|
|
* The run is a reply with Plan mode on (`PlanModeToolNames`), so a file
|
|
* can't be saved until the user leaves the mode (Tab) or approves a
|
|
* plan. Answering a card does not leave it.
|
|
*/
|
|
plan_mode?: boolean;
|
|
scopes: StorageScope[];
|
|
};
|
|
|
|
/**
|
|
* The check a reply and a task report share, as `runTextLoop`'s `review`:
|
|
* files, tasks, graphics and work the answer names, against the app's
|
|
* record (`reviewBotReply`). One place so a task report is held to the
|
|
* same record as a chat reply.
|
|
*/
|
|
export default function reviewRunAnswer({ bot_id, user_id, session_id, job_id, plan_mode, scopes }: Params) {
|
|
return ({ text, tool_uses, status }: { text: string; tool_uses: HarnessToolUse[]; status?: ReplyStatus }) =>
|
|
reviewBotReply({ text, tool_uses, bot_id, user_id, session_id, job_id, plan_mode, status, scopes });
|
|
}
|