Skip to content

fix(runtime): preserve entrypoint log across restarts (#110) - #1323

Open
ptone wants to merge 1 commit into
mainfrom
scion/sn-110-entrypoint-log-retention
Open

fix(runtime): preserve entrypoint log across restarts (#110)#1323
ptone wants to merge 1 commit into
mainfrom
scion/sn-110-entrypoint-log-retention

Conversation

@ptone

@ptone ptone commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Change .scion-entrypoint.log redirect from > (truncate) to >> (append) so restarts preserve the previous run's crash diagnostic
  • Add a timestamped run-delimiter line (--- entrypoint start <ISO8601> ---) at each start so appended runs are unambiguous
  • Update the entrypointLogFile constant comment to correctly describe the file's unique value and name Converge 'hub-native' naming to 'hub-managed' #110

Context

Discovered during #109 investigation: two agents died on the live instance (exit 127 and exit 1). The operator's natural recovery — restart the agent — would have truncated the only file that explains why the previous run failed. .scion-entrypoint.log captures shell-level errors, exec failures, and diagnostics written outside sciontool's logger. Those failures produce a bare exit code in the UI and nothing else.

The sister diagnostic agent.log already appends without rotation (O_APPEND at pkg/sciontool/log/log.go:144). Both files were introduced in the same commit (ea35abf), in the same directory, with opposite retention semantics and no comment referencing the other. The asymmetry was an unowned default, not a decision.

What this does NOT do

This fix does not help the current live instance (sn-harness-lab, image scion-omni:f99a818). Deploying new code requires a redeploy, which on this tier destroys every project and agent on the instance. This protects the next operator, not the current one.

Test plan

  • go vet ./pkg/runtime/... — clean
  • gofmt — clean
  • golangci-lint run ./pkg/runtime/... — 0 issues
  • go test ./pkg/runtime/... -count=1 — all pass
  • Manual: on a sandbox instance, start an agent, kill it, start again, verify .scion-entrypoint.log contains both runs with delimiter between them

Change the .scion-entrypoint.log redirect from > (truncate) to >>
(append) so that a restart preserves the previous run's diagnostic
output.  Add a timestamped run-delimiter line at the start of each
run to make boundaries unambiguous in appended output.

This file is the ONLY record of failures that occur before, around,
or outside sciontool's own logger — shell-level errors such as
"command not found", exec failures, and any diagnostic written to
stdout/stderr without going through log.go.  Those failures produce
a bare exit code in the UI and nothing else; this file is where the
explanation lives.  A truncating open on restart destroys that
explanation at the exact moment the operator retries.

The sister diagnostic agent.log (opened O_APPEND at
pkg/sciontool/log/log.go:144) already appends without rotation in
the same directory.  This change makes the two consistent.

Growth is unbounded across restarts, matching agent.log.  If disk
pressure from diagnostic logs becomes a concern, rotation should be
added to both files together — that data does not exist yet.

This fix does not help the current live instance (sn-harness-lab,
image scion-omni:f99a818, built 2026-08-26).  Deploying new code
requires a redeploy, which on this tier destroys every project and
agent — including the evidence this fix is designed to preserve.
This protects the next operator, not the current one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant