Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions docs/contributing/runtime-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,90 @@ The post-run output scan skips `<runDir>/skills/` and
origins and warnings are documented in
[Configuring with Skills § The persona list file](../guides/user/customizing-with-skills.md#the-persona-list-file).

### The post-run output scan

`scanOutputFiles` runs the output pipeline (Unicode normalization, then secret
redaction) over every file under the run directory (`<runDir>/`, including
`iteration-N/` transcripts) except the skips above, any directory named
`security` (which holds `findings.jsonl`), and the telemetry JSONL.

A file whose content is one JSON document — or two or more newline-delimited
ones — is sanitized structurally, so redaction never changes its syntax. The
document is rewritten by a token-preserving walk rather than decoded into a map
and re-encoded: member order and duplicate keys survive, so an earlier value that
map decoding would drop is still scanned. Each object key and string value is
scanned on its own; a value whose member name marks it sensitive (key, token,
secret, password, credential, auth) is masked even when the value matches no
pattern, and a sanitized key name that would collide with a different member is
disambiguated (`<key>_<N>`). A leading UTF-8 BOM is stripped before the walk and
restored on write, and a clean document comes back byte for byte.

After the rewrite the serialized bytes are scanned once more, but only for
whole-value secrets — registered runtime values and private-key blocks — because
those are the only matches a leaf scan cannot see once a member value is masked.
Every other pattern has already been applied to the decoded key or value, so a
match on the serialized bytes would be a redaction placeholder plus JSON escape
characters, not a secret (#5705).

A private-key block can also span members or records: one string holds the BEGIN
marker, another the body, a third the END marker. Masking any of them would hide
the marker from every later scan, so such a block is detected on a decoded view
of the document or stream before anything is rewritten, and handled where it
lives. The members the match starts and ends in carry marker text, so they are
always masked — even when a marker is split across two members and neither

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW] documentation: count-only logging is framed as quiet-mode behavior

This passage says that in quiet mode the printed log counts unscannable files, but the code now counts at every verbosity without a per-file StepWarn; the counters increment regardless and the warning is quiet-gated per finding.

Is the doc describing the old behavior, or is the intent that counting stays quiet only? Either the doc needs an update or the quiet gating returns; worth aligning the two. (fullsend)

fragment looks like one alone. A member in between is masked when it carries a
block marker, a run that looks like body material (16+ base64 characters mixing
upper case, lower case and a digit, and not hex only), or when the joined text of
consecutive members does, which is what catches a body split into short chunks. An
object key keeps its name unless the name itself is block content, so a document
that merely quotes the PEM header in one finding and the footer in another keeps
the shape `review-result.schema.json` accepts, including its enum-valued fields.
A body split so that one-character and longer chunks alternate is a known
residual; uniform chunks and complete body lines are masked. Records that carry
part of a block across a record boundary are replaced with a fail-closed marker
instead, because the framing itself cannot be rewritten.

Some content cannot be redacted in place. A JSON document or JSONL record is
replaced with a valid fail-closed marker instead — never with corrupted
syntax — when a redaction would invalidate the JSON or a match spans record
boundaries. Markers look like `{"error":"output removed because …"}` and are
logged as findings in `security/findings.jsonl`. Because a replaced file loses
everything the agent wrote into it and the run still exits 0, the reason a
marker states is also emitted as a `::error::` workflow command whenever the job
sets `GITHUB_ACTIONS=true`. GitHub Actions renders it as an error annotation.
Forgejo Actions also sets `GITHUB_ACTIONS=true`, so its runner writes the same
line, but Forgejo has no annotation view: the line appears in the step log and
the exit status stays 0. On GitLab the line is not written at all.

A file that cannot be read, sanitized or written does not stop the walk: every
remaining file is still scanned and redacted, and the run fails closed afterwards
with all failures joined. The unredacted file is replaced with the fail-closed
marker so its bytes do not reach the uploaded artifact when the filesystem allows
it; if the marker write and the fallback removal both fail, that failure is added
to the joined error rather than left unreported. In `quiet` mode the printed log
counts the affected paths instead of naming them (ADR 0163); the run error and
telemetry keep the path and the wrapped cause at every level, and only the
printed line is trimmed. The completion comment counts them too: an output file
name is the agent's to choose and Actions log masking does not apply to a
comment, so at `quiet` a failed scan posts how many files it could not handle
instead of naming one. The scan failure is the only run error the comment
rewrites today; applying the level to the rest is tracked in #9627.

A failed scan fails the run but does not silence the agent's own result. The
post-script runs after the scan, so when the run failed with a scan error the gate
skips it — unless that scan failure is the run's only failure and the result file
the harness names (`agent-result.json` by default) survived the scan and still
holds a JSON object. Then the post-script runs, posts the result, and the run
still fails, so one unreadable or unwritable file somewhere else under the run
directory cannot turn a completed report into silence. A run that also timed out,
broke its audit chain or reported a transcript error keeps that cause's outcome:
the scan does not turn it into a post-script run, and each cause is kept separate
in the run error (`postScanError`) rather than flattened into one join, so the gate
can tell a scan-only failure from a joined one. A result file the scan replaced
with a fail-closed marker does not count — the marker is valid JSON, but it is not
the agent's result — and neither does one the scan failed on, whose unredacted
bytes may still parse.

## Agent rule layering

When `fullsend run` executes an agent, Claude Code loads instructions from
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/dev/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ cut can take the `@` that marks a password and the tail cut the `https://`
before it (`promptHidesAlterations`) — is recorded `***` whole; the
prompt the agent is sent is not changed, and the mask the first
scan leaves for a connection-string password of ten or more bytes matches
its own pattern and counts a finding —
its own pattern, counts a finding, and is itself masked `***` —
and sets `gen_ai.input.messages` on the span
before the runtime starts, so each finalize path carries it. Its findings
join the iteration's, and its encoded size is charged against
Expand Down
18 changes: 17 additions & 1 deletion docs/guides/user/run-artifacts-and-private-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,23 @@ Tool results in those files can quote what the agent read, such as the text
of a private Jira issue. On a public repository, any signed-in user can
download the artifact until it expires. The output scan masks secret
literals; it does not remove personal data, customer names or other private
business text.
business text. A secret that cannot be localized replaces the whole JSON
document, or the JSONL record that carries it, with a JSON error marker, and a
file whose redacted content cannot be read, written or computed is replaced by
such a marker and fails the run. If the marker cannot be written and the file
cannot be removed either, the run's error says the unredacted file is still on
disk. A private-key block that spans JSON members is handled in place instead:
object keys keep their names unless a key name is itself a line of the key body,
and each string value — or key name — that carries block text or base64 key
material becomes `[REDACTED PRIVATE KEY]`. When a
replacement happens in a run that still exits 0, the job log says so. On GitHub
Actions this is an error annotation: fullsend writes a `::error::` workflow
command whenever the job sets `GITHUB_ACTIONS=true`, and GitHub Actions renders
it. Forgejo Actions also sets `GITHUB_ACTIONS=true`, so the same `::error::`
line is written there, but Forgejo has no annotation view: its runner prints the
line in the step log and the exit status stays 0. On GitLab the line is not
written at all, so the run's log is the signal. A read, write or sanitize
failure needs no annotation because the run itself fails.

`fullsend run` leaves `output/` untouched. At the end of the job,
`fullsend prepare-artifacts` builds a filtered copy at the level you set, and
Expand Down
4 changes: 3 additions & 1 deletion docs/reference/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,9 @@ At `quiet`:
A setup error before that, such as a config or provider error, prints in
full. The level covers the job log only: the status comment on the issue or
pull request still carries the full run error
([#9627](https://github.com/fullsend-ai/fullsend/issues/9627)).
([#9627](https://github.com/fullsend-ai/fullsend/issues/9627)), except that a
failed output scan posts how many files it could not handle rather than a
name the agent chose.

**Agent CLI stderr at `quiet`.** The agent CLI (Claude Code, pi, Codex or
OpenCode) writes its own diagnostics to stderr, and they can quote what the
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/content_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ func attachContent(span trace.Span, res contentResult) {
// values, once more after the fold, which can spell out a value that pass
// saw in compatibility forms. The mask that first scan leaves for a
// connection-string password of ten or more bytes ("abcd...") matches its
// own pattern again, so such a prompt counts a finding here; a shorter
// password is masked "***", which does not.
// own pattern again, so such a prompt counts a finding here and the
// placeholder is masked "***"; a shorter password is masked "***", which
// does not match.
// The pipeline also folds compatibility characters the agent received
// unfolded. Findings join the iteration's and surface through Result.
//
Expand Down
Loading
Loading