Repository navigation
fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments - #136
Conversation
…hind fork-nested-subagents A delegated chat that is not an explore subagent gets a blocking ask_user_question tool. The call records the question in the new chatd.chat_descendant_questions table and ends the turn; the answer is the next user message. The parent's wait_agent reports needs_input while the child's question is unanswered and, when called while it is pending, waits for the answer before it waits for the child.
…c and cover the late question TestDescendantQuestionEndsTurn raced the child's turn against the root's wait_agent call: when the question was already pending, wait_agent waited the default five minutes and the test hit its deadline (about 1 in 3 to 1 in 15 runs). The root's wait_agent now starts once the question is pending, with a 1 second timeout. TestDescendantQuestionWaitAgent now also covers a question the child asks while the parent waits on it, which only the racy end-to-end path exercised. TestAppendForkTools now includes wait_agent, so wrapping it with the experiment off fails.
…ions-1-chatd-tool # Conflicts: # coderd/database/forkdb/forkdbmock/forkdbmock.go # coderd/database/forkdb/querier.go # coderd/database/forkdb/sqlc.yaml
Adds the forkdb query ListPendingChatDescendantQuestionsByRoot with its dbauthz (read access to the root chat) and dbmetrics wrappers.
Lists the unanswered ask_user_question calls of the unarchived descendants in a chat's family behind fork-nested-subagents, so the root chat UI and API clients can answer them. Adds the codersdk types and client method and the generated swagger, API docs and TypeScript types.
…tions wait_agent now always runs the wrapped tool, so include_tool_calls and its validation apply while a question is pending, a question asked before an inner timeout is reported, and a failed question lookup is an error. Model-only user rows from lifecycle hooks no longer answer a question.
…ions-1-chatd-tool # Conflicts: # coderd/database/forkdb/sqlc.yaml
…ions-1-chatd-tool # Conflicts: # coderd/x/chatd/fork_tools.go
…ndant-questions-2-questions-route
…ions-1-chatd-tool # Conflicts: # coderd/database/dbauthz/fork_forkdb_test.go
…ions-1-chatd-tool # Conflicts: # coderd/database/dbauthz/fork_forkdb.go # coderd/database/dbmetrics/fork_forkdb.go # coderd/database/forkdb/sqlc.yaml # coderd/x/chatd/ARCHITECTURE.md
…ions-2-questions-route # Conflicts: # coderd/database/dbauthz/fork_forkdb_test.go # coderd/database/forkdb/chat_descendant_questions.sql.go # coderd/database/forkdb/chat_descendant_questions_test.go # coderd/database/forkdb/queries/chat_descendant_questions.sql
…family question list
…ions-2-questions-route # Conflicts: # coderd/apidoc/docs.go # coderd/apidoc/swagger.json
…ions-4-secret-answers
…hitecture document
…ers in key commands
Also send an empty options array for questions without options, and match the secret-answer route ID to its summary.
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6dee42d542
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…ions-6-secret-substitution
…ike/descendant-questions-6b-secret-hardening
…ions-6b-secret-hardening # Conflicts: # coderd/x/chatd/fork_descendant_questions.go # coderd/x/chatd/fork_secret_answers.go # coderd/x/chatd/fork_secret_answers_internal_test.go # coderd/x/chatd/fork_secret_answers_test.go
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f12d2726f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…backslash forms Store a secret answer in the transaction that checks its question under the chat row lock, refuse an ordinary question that would replace a secret one whose answer report is queued, and scrub the forms that Bash's printf %q and declare -p write.
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
coder/coderd/fork_chat_questions.go
Lines 257 to 261 in 8f3752a
When two requests answer the same pending secret question concurrently, the second can enter this delete-and-reinsert path after the first stores value A but before it sends its report, replacing A with B. The first request's subsequent WithSecretAnswerReport send validates only that some answer exists for the call ID, so it can resume the child using B and return 204, while the request that actually supplied B can then receive 409 because the question is no longer pending. Preserve an identity for the in-flight answer or serialize storing and reporting so one submission cannot silently report another submission's value.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review 5845643171 (concurrent secret answer submissions, P2): dropped. It needs two concurrent answers from the user to the same question, and the stored value is still one that the user gave for that question, so nothing reaches the model or runs as code.
|
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
Merge evidence for head
|
…space stop in the pstack adapter (#154) * docs: map notify_user and the daily wake-up limits in the pstack adapter * docs: check the pstack adapter against main at d1bb658 * docs: re-pin pstack adapter cites that #115 and #136 moved * docs: re-pin pstack adapter cites that #136 moved * docs: say that a root archive stops the workspaces of workspace subagents * docs: re-pin pstack adapter cites that #147 moved * docs: qualify the wake-up limits, pause notices, inbox, and workspace autostop * docs: condition the archive cleanup of isolated subagents on the experiment * docs(docs/fork): qualify notification limits and the archive workspace stop * docs(docs/fork): qualify notify_user availability, limit, and silent drops
* feat(coderd): let descendant chats ask the user blocking questions behind fork-nested-subagents
A delegated chat that is not an explore subagent gets a blocking
ask_user_question tool. The call records the question in the new
chatd.chat_descendant_questions table and ends the turn; the answer is the
next user message. The parent's wait_agent reports needs_input while the
child's question is unanswered and, when called while it is pending, waits
for the answer before it waits for the child.
* test(coderd/x/chatd): make the descendant question tests deterministic and cover the late question
TestDescendantQuestionEndsTurn raced the child's turn against the root's wait_agent call: when the question was already pending, wait_agent waited the default five minutes and the test hit its deadline (about 1 in 3 to 1 in 15 runs). The root's wait_agent now starts once the question is pending, with a 1 second timeout.
TestDescendantQuestionWaitAgent now also covers a question the child asks while the parent waits on it, which only the racy end-to-end path exercised. TestAppendForkTools now includes wait_agent, so wrapping it with the experiment off fails.
* feat(coderd/database): list a chat family's pending descendant questions
Adds the forkdb query ListPendingChatDescendantQuestionsByRoot with its
dbauthz (read access to the root chat) and dbmetrics wrappers.
* feat: add GET /api/v2/chats/fork/{chat}/questions
Lists the unanswered ask_user_question calls of the unarchived descendants
in a chat's family behind fork-nested-subagents, so the root chat UI and API
clients can answer them. Adds the codersdk types and client method and the
generated swagger, API docs and TypeScript types.
* fix(coderd): keep wait_agent options and timeouts for descendant questions
wait_agent now always runs the wrapped tool, so include_tool_calls and its
validation apply while a question is pending, a question asked before an
inner timeout is reported, and a failed question lookup is an error.
Model-only user rows from lifecycle hooks no longer answer a question.
* test(coderd): cover skipping an undecodable descendant question
* fix(coderd/database/forkdb): ignore model-only user rows in the family question list
* feat(site/src): show descendant chat questions on the root chat page
* fix(site/src/api): keep the descendant questions fetcher module-private
* fix(coderd): end the question wait on a replaced question and retire it on clear
* fix(site/src/pages/AgentsPage/components): name the descendant question dock by its header
* fix(coderd/database/forkdb): retire a cleared chat's question in the family question list
* refactor(site/src/api): move the descendant question query options to api/queries
* wip: chat_secret_answers storage (node, queries, dbauthz, dbmetrics, dbcrypt)
* chore(coderd/database/forkdb): generate chat_secret_answers queries
* feat(coderd): accept secret answers to descendant questions outside chat messages
* docs(coderd/x/chatd): leave a TODO for chat_secret_answers in the architecture document
* fix(site/src): handle load errors, focus and stale answers in the descendant question dock
* fix(enterprise/dbcrypt): encrypt, decrypt and delete chat secret answers in key commands
* fix(coderd): drop the pending secret answer with a detached context
* fix(site/src/pages/AgentsPage/components): show a failed poll next to cached descendant questions
* fix(coderd): refuse every message while a secret question is pending
Also send an empty options array for questions without options, and match the secret-answer route ID to its summary.
* fix(enterprise/dbcrypt): page chat secret answers in key commands
* fix(site/src/pages/AgentsPage/components): disable descendant answers while the chat cannot take a turn
* feat(coderd): expire chat secret answers after 24 hours
* feat(coderd): give descendant tools secret answers without showing them to the model
* fix: reject null bytes in secret answers and skip re-answered ones in key rotation
* fix(site/src): refresh the descendant chat's caches after the dock answers
* test(site/src/pages/AgentsPage/components): keep the seeded child chat cached in the dock test
* fix(coderd): let a secret answer be given again after its queued message is deleted
* fix(coderd/database): batch the secret answer purge on the database clock and record it
The purge now deletes at most 1000 expired answers per tick, measures the
24 hour TTL with now() like GetChatSecretAnswersByChatID, and adds the
purged count to the dbpurge log line and records_purged metric.
* test(site/src/pages/AgentsPage/components): name the dock story fixture variants
* fix(coderd): keep tool methods through the secret wrapper and reject short secret answers
Turn setup reads a descendant chat's secret answers once and wraps the
tools only when the chat has some. The wrapper forwards the optional
methods the chat loop asserts. The secret answer route rejects values
under 8 bytes, which the output scrub would match in ordinary text.
* fix(coderd): unescape the tool call ID of the secret answer route
* test(site/src/pages/AgentsPage/AgentChatPage): pin a subagent answer from a running root chat
* feat(coderd/x/chatd): offer secret questions to descendant chats
* feat(site/src): take secret answers to descendant questions in a masked field
* style(coderd/x/chatd): gofmt the secret answer test tool
* fix(coderd): send the tool call ID of a secret answer in the request body
* fix(site/src): send the secret answer's tool call ID in the request body
* fix: keep a concurrent secret answer when an undelivered one is deleted
InsertChatSecretAnswer returns the row's created_at, and the cleanup after a
failed send deletes the answer only while that created_at still matches. A
request that replaced the row inserted it later, so its answer stays.
* fix(coderd): regenerate the secret answer queries and update the purge test for the insert's created_at
* fix(coderd/x/chatd): update secret answer tests for the insert's created_at
* fix(coderd/database): restore the time imports the merged secret answer insert needs
* test(site/src): expect the disabled answer field on a secret question's card
* fix: keep an in-flight secret answer and accept messages with the experiment off
A failed send no longer deletes the answer: the question stays pending, and
the next answer replaces the unreported one in one transaction. This drops
the created_at check that only guarded that delete. The guard on the normal
answer path applies only with fork-nested-subagents on, because the secret
answer route is gone without it.
* fix(coderd/database): drop the created_at fixups that the secret answer insert no longer needs
* fix(coderd/x/chatd): drop the created_at fixups that the secret answer insert no longer needs
* fix(coderd): keep a secret question pending past a promoted queued message
Only the secret answer's own message, or a context boundary, retires a secret question. A message the user queued before the question no longer answers it when the end of the turn promotes it.
* fix(coderd): replace a secret answer past its TTL while its message is queued
* fix(coderd): refuse secret edits and serialize the secret answer replacement
Edits of a chat message or of a queued message's content now get the same refusal as a new message while a secret question is pending. Replacing an unreported answer now locks the chat row and rechecks, in the same transaction, that no queued or delivered message reports the answer.
* fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments
Refuse secret questions in computer-use chats, scrub cut-off prefixes and
suffixes of a value, withhold media from wrapped tools while answers are
active, give execute the value through a shell variable the wrapper
assigns, and refuse internal messages to a child whose pending question is
secret.
* fix(coderd/x/chatd): restore the JSON escaping helpers of the secret scrub
* perf(enterprise/dbcrypt): page chat secret answers by key during recrypt
* fix(coderd/x/chatd): withhold attachments and refuse queued secret questions
A tool result that attaches a file while the chat holds secret answers
now drops the attachment metadata, because the next prompt resolves the
file bytes for the model. A secret question is now refused while
messages wait in the queue of the chat: the end of the turn would deliver
them after the question and answer it without the value. The check holds
the chat row lock that SendMessage takes before it refuses messages to a
chat with a pending secret question.
* fix(coderd/x/chatd): show the queued secret question refusal without the transaction prefix
* fix(coderd): reuse the queued report when an expired secret answer is replaced
An answer past its TTL can be replaced while the message that reports it
is still queued. The route now skips the send in that case, so the queued
message reports the new answer and no second report reaches the child
after the question is answered.
* fix(coderd/x/chatd): scrub secret answers that a JSON encoder escaped to ASCII
Python's default json.dumps writes each non-ASCII character as a \u
escape, so a value with such a character matched none of the scrub forms.
The scrub now also matches the ASCII-only JSON forms, with lowercase and
uppercase hex.
* fix(coderd/x/chatd): substitute execute workdir and isolate secret shell variables
A placeholder in an execute parameter other than command, such as
workdir, now gets the value as JSON, as in other tools. The variable the
wrapper assigns gets underscores added until the command does not name
it, so the command cannot assign or unset it. A value in which a $ or a
backtick follows a [ is refused for execute, because Bash runs the
subscripts of such a value as code where it evaluates the variable as
arithmetic.
* fix(coderd/x/chatd): refuse shell-evaluable values and protect scrub placeholders
execute now refuses a secret value with $ or a backtick, since Bash
evaluates a variable again in arithmetic and array subscripts. The other
execute parameters get their values before the command holds the
assignments, so a value holding its own placeholder is substituted once.
The scrub writes null-byte markers until the end, so a fragment pass cannot
cut a placeholder, and it matches JSON forms with an escaped solidus.
* fix(coderd/x/chatd): narrow the execute refusal back to arithmetic-unsafe values
execute again refuses only a value with $ or a backtick after a [, which
Bash runs where it evaluates a variable as arithmetic. Refusing every $
blocked common generated passwords. Other re-evaluating contexts are ones
the command picks, outside the accidental-exposure threat model.
* fix(coderd): recheck secret questions on every send and scrub Bash ANSI-C quoting
SendMessage now refuses any message to a chat whose pending question is
secret inside its transaction, not only message_agent sends, because the
chat API checks before the question can be recorded. Only the message that
reports a stored answer passes. The scrub also matches the $'...' form in
which Bash writes a word with a control character, as set -x does.
* test(coderd/x/chatd): mark the secret answer report in TestSecretAnswerReachesToolsNotModel
* fix(coderd): recheck secret questions on edits and bind answer reports to their question
Codex round 6 on #136: EditMessage rechecks the pending secret question
under the chat lock, the answer report carries its tool call ID and passes
only while that question is pending with a stored answer, and the scrub
covers uppercase hex in JSON escapes of ASCII characters.
* test(coderd/x/chatd): drop the busy behavior argument main removed from sendSubagentMessage
* test(coderd/x/chatd): cover a late answer report after a newer secret question
* fix(coderd/x/chatd): scrub secret answers as Go's %q and %+q quote them
* fix(site/src/pages/AgentsPage/components): keep password managers off the secret answer field
* fix: address Codex review of secret questions
The tool row reads secrecy from the result too, the dock renders the
secret prompt as Markdown and keeps focus after a secret answer, and
ordinary questions keep options required in the tool schema.
* chore(site/src/pages/AgentsPage/components): format secret question changes
* fix(coderd/x/chatd): let only secret questions leave out options in the schema
* fix: keep secret questions answered and let the user decline them
Keep the secret answers of earlier questions until their TTL so tool output
that shows a persisted value stays scrubbed. A deleted answer report still
retires its secret question, so an edit cannot revive it. The user can
decline a secret question, such as for a value too short to hide, which
retires it without a value.
* test(site/src/pages/AgentsPage/components): cover the sent secret answer state and name fixtures with mock
* chore(site/src/pages/AgentsPage/components): format secret question tests and drop a duplicate comment
* fix(coderd): drop a declined question's stored answer and keep secret answer reports through prompt overrides
* chore(coderd/apidoc): describe declined secret answers
* fix(coderd): refuse to decline a secret question whose answer report is queued
* fix(site/src/pages/AgentsPage/components): clear stale secret answer errors and explain a disabled secret form
* chore(site/src/pages/AgentsPage/components): format the secret answer submitting story
* test(coderd): check the queued decline refusal under the chat lock
The coderd test raced a promotion of the queued report, so either 409
satisfied it. The chatd test queues the report itself.
* fix(site/src/pages/AgentsPage/components): tie secret answer errors to the field and explain secret questions in descendant chats
* test(site/src/pages/AgentsPage/components/ChatElements/tools): leave the secret question story to the visual capture
Part of #73
This PR hardens the secret answer substitution of #126. Codex found twenty-four ways a secret answer could still reach the model, run as shell code, or be answered without the value. This PR fixes twenty-three of them before PR7 turns the
secretflag on, and Limits explains the one left. The flag stays off here too, so no chat can have a secret question yet. Tests turn it on.Threat model
The scrub protects against accidental exposure. A tool prints or shows the value, and the model would otherwise see it. The scrub does not protect against a model that deliberately transforms the value, for example with base64, before a tool prints it. The workspace sees the value, so a transformed value is out of scope.
What changes
ask_user_questionin a computer-use chat now leaves thesecretproperty out of its schema, and it refuses a secret question with "a computer-use chat cannot ask secret questions".json.dumpswrites each non-ASCII character as a\uescape, so a value withämatched none of the scrub forms. The scrub now also matches the ASCII-only JSON forms, with a surrogate pair for a character outside the Basic Multilingual Plane. Every JSON form, ASCII-only or not, is matched in lowercase and uppercase hex, so an encoder that writes\u003Cfor<or\^[for an escape character is covered too (fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4524960974). Each JSON form also has a variant with/written as\/, as PHP's defaultjson_encodewrites it (fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4524578928). The scrub also matches the value as Bash writes it in$'...'for a word with a control character, asset -xdoes, with non-ASCII characters kept or in octal (fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4524816627). It also matches the value as Go's%qand%+qwrite it, with a control character as\x01, as an agent error that quotes a path does (fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4525118082). It also matches the value as Bash'sprintf %qwrites a word with shell characters, each with a backslash before it, and asdeclare -pwrites it in"..."(fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4527514286).attach_fileandpropose_planreturn a text result whose metadata names a stored file, and the next prompt resolves that file's bytes for the model. While the chat holds secret answers, the wrapper now drops attachment metadata from every result, text results included, and adds the same note.execute(4523933071): feat(coderd): give descendant tools secret answers without showing them to the model #126 put the value into the command string, so the shell parsed it as code. A'broke the quoting, and$(...)or a backtick ran a command. The wrapper now starts the command withCODER_SECRET_ANSWER_<n>='<value>';, where the value is single-quoted and each'is written as'\''. Each placeholder becomes an expansion of that variable, chosen for the quotes around it:"${CODER_SECRET_ANSWER_<n>}"outside quotes,${...}inside double quotes, and'"${...}"'inside single quotes. The quote scan skips backslash escapes but does not follow command substitutions or here-documents. A wrong guess there only splits the value into words or keeps the expansion as text. In no case does the shell run the value as a command. Bash still expands the subscripts of an array reference when it evaluates a variable as arithmetic, soexecuterefuses a placeholder whose value has a$or a backtick after a[(fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4524460000). The error tells the model to write the value to a file withwrite_file. The wrapper adds underscores to the variable name until the command does not contain it, so the command cannot assign or unset it (4524460010). Placeholders in the otherexecuteparameters, such asworkdir, get the JSON-escaped value, as for other tools (4524459992). They get it before the command gets the assignments, and nothing scans the command again, so a value that holds its own placeholder is in the command once, quoted (4524578900). The variable is not exported. The scrub also matches the single-quoted form, so the assignment never shows in tool output, for example inps.wait_agentnote for a secret question no longer offersmessage_agent.forkValidateSubagentResume, whichmessage_agentand wake-ups call before and inside the send transaction, now refuses a send to a child whose pending question is secret. Such a message would answer the question without the value. The refusal also applies to wake-ups, so a wake-up of such a child fails with that error instead of answering the question.SendMessagetakes before its own check, so no send can reach the queue in between. An ordinary question now takes the same lock, and it is refused while the report of an answer to the pending secret question waits in the queue. The end of the turn would deliver that report as the answer to the ordinary question (fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4527514295).SendMessageorEditMessage, so a question recorded in between would be answered by the message. Both now refuse, in their transaction, every message to a descendant chat whose pending question is secret, withchatd.ErrSecretQuestionPending, which the chat API returns as the same 409. Only the message that reports a stored answer passes, and it marks its context withchatd.WithSecretAnswerReport.chatd.WithSecretAnswerReportnow carries the tool call ID, and the report passes only while that question is pending and its answer is stored. OtherwiseSendMessagereturnschatd.ErrSecretAnswerNotPending, and the answer route returns 409. The answer route also stores the answer in the transaction that checks its question under the chat row lock, so it refuses an answer to a question that is no longer pending with 409 instead of storing it, where the child could still use its placeholder (fix(coderd/x/chatd): keep secret answers out of shell code, media and fragments #136 thread 4527514274).The two other #126 threads need no code. The 8 byte floor (4523933077) is a recorded product call, and a clear recovers. The options schema (4523688921) stays as it is, because provider tool schemas don't reliably support
if/then, and upstream's error names the missing options on the next step.Limits
Bash evaluates a variable again in a few places where the command puts it, and there a command substitution in the value runs. Arithmetic is the only such place that
executerefuses. An associative array subscript in a builtin such asunsetordeclare, and indirect expansion, are not refused (#136 thread 4524578916). Ordinary use of the placeholder never puts the value there, so these places are outside the accidental-exposure threat model. Refusing every value with$or a backtick would block common generated passwords and push the model towrite_file, which leaves the value on disk.With the flag off
Nothing can create a secret question or a secret answer, so none of the new paths run except one read. Each message or edit to a descendant chat now reads the chat's pending question in its transaction, an indexed read by
chat_id, and finds no secret question.Validation
TestSubstituteExecuteSecretAnswersruns the rewritten command undersh -c. The value holds',",;,|echo INJECTED,&,*, a newline and a backslash. The command uses the placeholder bare, in double quotes and in single quotes, andprintfprints the value unchanged in all three. Negative controls: with the value spliced into the command as before, the test fails. With every placeholder expanded as"${...}", the single-quoted case fails. The test also covers a placeholder inworkdir, a command that assigns and unsets the variable names, and a value that runs code in$(( )). It also runs a value that holds its own placeholder and a quote that would end the assignment, and it checks that a value with$or a backtick after[is refused. With theworkdirsubstitution removed, the variable name fixed, the command scanned again, or the arithmetic refusal removed, it fails.TestScrubSecretAnswerscovers a cut-off prefix, a cut-off suffix, a 7 byte run that stays, the single-quoted form, the ASCII-escaped JSON forms of a value withäand an emoji, uppercase hex escapes of<and of a control character, an escaped/, a value that starts like its placeholder, both$'...'forms of a value with control characters, the Go%qand%+qforms of a value with a control character andä, and theprintf %qanddeclare -pforms of values with a space,$and~. Wherebashexists, it also scrubs a realset -xtrace and realprintf %qanddeclare -poutput. With the fragment scrub, the ASCII forms, the uppercase forms, the Go quoted forms, the escaped/forms, the$'...'forms, the backslash forms, the escaped~forms or the markers removed, it fails.TestSecretAnswerToolscovers the withheld media, withheld attachment metadata, and the variable assignment in a wrappedexecute. With the media check or the attachment check removed, it fails.TestDescendantSecretQuestioncovers the computer-use refusal, the refusal while a message is queued, and the refusal of an ordinary question while the report of a secret answer is queued. With the queue check or the report check removed, it fails.TestSecretQuestionRefusesSubagentMessagecovers the refusedmessage_agentmessage, the refusedSendMessageandEditMessagewithout the report mark, a report without a stored answer, the report that passes, a late report after a newer secret question, and an allowed answer to an ordinary question.TestDescendantQuestionWaitAgentchecks both notes. Each fails with its check removed.TestStoreSecretAnswercovers a refused answer to an earlier question, a first answer, a replaced unreported answer, and a refused answer after the report is delivered. With the question check removed, it fails.gofmtandgo vetpass.