Skip to content

Surface an operator-visible marker when script log output is truncated

Placeholder ppxd requested to merge feat/log-truncation-marker into main

Summary

  • When a single script's output exceeded the in-memory retention buffer, HalibutScriptObserver dropped the oldest entries with only a Serilog/Seq warning — the operator's task log silently jumped, with no indication anything was lost.
  • Insert an operator-visible gap marker at the head of the retained log on truncation, and stream it via the output sink so it persists even in streaming mode (where the bulk persist is skipped) — landing exactly once in either mode. Anchored to the oldest-retained entry's timestamp (stays at the head under Occurred-ordering); StdOut so it reads as an informational notice, not a false error.
  • TruncateIfExceeded is marker-aware: a marker already at the head doesn't count toward the cap, so re-truncating an unchanged buffer never emits a duplicate marker.

Scope decisions (the rest of #5 (closed)/#6, after investigation)

  • SuccessWithWarning rollup — deliberately NOT added. ServerTask.State is a string; a new terminal value would force every State-consuming caller (incl. the frontend) to change (semi-breaking) for no concrete need. The Warning log category already surfaces warnings.
  • #6 publish-success assertion — already implemented. success = completeResponse.ExitCode == 0 is a positive assertion from the agent's CompleteScript RPC (same model as Octopus/Calamari), not an inference. No change needed.

Non-breaking

Private signature change only (TruncateIfExceeded void → returns the marker). No public API, schema, or response-shape change. Consumers of LogLines see at most one extra informational line on truncation (rare — only above the 100k-entry default buffer).

Test plan

  • HalibutScriptObserverStreamingTests: marker at head + oldest dropped (bulk path); marker streamed as informational (not stderr/Error); no marker when under cap
  • Updated HalibutScriptObserverTests.ObserveAndCompleteAsync_VerboseOutput_TruncatesOldestLogs to assert the marker is present + the cap holds within +1
  • Full unit suite: 5844/5844 green
  • Full solution build: 0 errors

Merge request reports

Loading