You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(logging): remove the --log-file JSONL run log (#795)
* refactor(logging): remove the --log-file JSONL run log
The detector wrote a structured JSONL run log to a separate artifact, but
almost every record duplicated something already on stderr/stdout: the
degraded-input annotations, the config/engine/prompt-build errors, the
verdict (= the result JSON), and the terminal status line. In `conclude`
the duplication was total — every logger call sat next to a `c.info` twin.
Drop the sink entirely (flag, THREAT_DETECTION_LOG_FILE, the derived
`detection-runlog.jsonl` default, the path-collision checks, and the
`pkg/runlog` package) and fold the genuinely log-only diagnostics onto
stderr so the job log is the single place a run is diagnosed:
- run configuration: version, engine, model, retry budget
- the recursive artifact inventory (TD-17b), bounded and sanitized
- prompt metadata: byte count and framework-scaffolding detection
- the per-attempt trace and whether each recorded a verdict
- the engine subprocess argv (stderr previously had only the arg count)
- each degraded-input finding's field and required-input classification,
which the "::warning::" text alone cannot convey in warn mode
Untrusted values stay confined to one physical line and listings stay
bounded, so neither model-authored text nor a hostile filename can forge
a workflow command or flood the job log.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: David Slater <12449447+davidslater@users.noreply.github.com>
* fix(logging): close diagnostic injection vectors and stale spec refs
Review follow-ups on the run-log removal.
Two values reached a diagnostic line unescaped:
- The engine ID is echoed on the run-start line before engine.New
validates it, and Canonical only lowercases, so an arbitrary --engine
value flowed through verbatim. Sanitize it (and the version, for
consistency) as the model already was.
- The engine-invoke line composes its command description from
nodeCommand(), which reads GH_AW_NODE_BIN, and emitted it raw. Quote it
with %q as argv and the model already are.
Both are now covered by tests that fail without the fix.
Three spec/doc claims were stale or wrong:
- TD-18b still required a `prompt_analysis_degraded` run-log event and
TD-22-flags still required workflow context on `prompt_built`; both
reference a sink TD-20a now forbids. Reduce each to its job-log
requirement.
- TD-20a's escaping rule read as covering forwarded engine output, which
runCLIEnvWithSink tees verbatim by design. Scope the requirement to
detector-authored diagnostics and state that forwarded engine output is
a separate, non-attested stream; mirror this in the README.
- The README trace showed `kind=prompt` and a `<system>` scaffolding
marker; artifactKind emits `file` and `<system>` is never a marker.
Restore two guarantees the deleted logfile_test.go was the sole cover for:
the TD-18b ERR_VALIDATION warning, and the TD-20a inventory bound,
omission label, and path escaping. Finally, retain the source run's
detection.log as `original-detection.log` in the replay artifact, which
usage-spec U-27 requires and the runlog removal had dropped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: David Slater <12449447+davidslater@users.noreply.github.com>
---------
Co-authored-by: GitHub Ace <githubnext@users.noreply.github.com>
Co-authored-by: David Slater <12449447+davidslater@users.noreply.github.com>
lines) have control characters escaped so each stays on one line and cannot
@@ -319,7 +320,7 @@ engine runs. Findings about other artifacts stay advisory warnings in both
319
320
modes.
320
321
321
322
Every file below the artifacts directory is recorded with its size and consumed
322
-
status in the JSONL `artifacts_loaded` event. Only an allowlisted, size-bounded subset of
323
+
status in the artifact inventory printed to stderr. Only an allowlisted, size-bounded subset of
323
324
`aw_info.json` is added to the detection prompt, and all of its values are
324
325
explicitly treated as untrusted runtime data.
325
326
@@ -336,7 +337,7 @@ explicitly treated as untrusted runtime data.
336
337
337
338
### Replay workflow
338
339
339
-
Maintainers can manually run **Replay Threat Detection** from the Actions tab to rerun detection against artifacts from a prior workflow run. Provide the source repository and run ID; the workflow downloads the `agent`, `activation`, optional experiment, and optional original `detection` artifacts, normalizes them into the CLI input contract above, runs `threat-detect`, and uploads a sanitized `replay-detection-<run_id>` artifact with the manifest, file inventory, free-form replay log, replay result, and original-result comparison. Detectors that support structured logging also produce `detection-runlog.jsonl`; when available, the source run's structured log is retained separately as `original-detection-runlog.jsonl`.
340
+
Maintainers can manually run **Replay Threat Detection** from the Actions tab to rerun detection against artifacts from a prior workflow run. Provide the source repository and run ID; the workflow downloads the `agent`, `activation`, optional experiment, and optional original `detection` artifacts, normalizes them into the CLI input contract above, runs `threat-detect`, and uploads a sanitized `replay-detection-<run_id>` artifact with the manifest, file inventory, free-form replay log, replay result, and original-result comparison.
340
341
341
342
Replay uses the dispatching repository's `GITHUB_TOKEN`; no extra replay token is required. The selected source run must be accessible to that token.
0 commit comments