feat(agent): report skipped and canceled script outcomes
Send startup-script outcomes to coderd and the Build Timeline, completing
the agent-side support for #30875.
- Report one zero-duration timing for scripts skipped or canceled before
starting. Interrupted startup scripts report `canceled` instead of
`exit_failure`, including on templates without ordering.
- Add cancellation logs for ordered scripts waiting on dependencies or
running. Completed outcomes, timeouts, exit codes, and stop/cron
reporting remain unchanged.
- Give reports an independent timeout and make `Runner.Close` wait for
in-flight executions so shutdown does not discard cancellation timings.
Synchronize cron startup with `Close` to prevent shutdown hangs.
- Dial Agent API v2.15; agents now require coderd supporting that version.
Tests cover skips, cancellation, duplicate prevention, and shutdown races.
Race-detector tests and all 14 manual scenarios passed.
Refs https://linear.app/codercom/issue/PLAT-550/phase-3-expose-skipped-and-canceled-script-outcomes
feat(agent): enforce lifecycle script ordering
Honor `coder_script_order` dependencies for startup and shutdown scripts
using the existing outcome-aware unit manager. Cron, legacy scripts,
and scripts without dependencies retain their existing behavior.
- Wait for all prerequisites before running. `success` requires a
successful prerequisite; `completion` also accepts failure, timeout,
or skip. Skip dependents as soon as a required success becomes
impossible, preserving the original failure as the lifecycle error.
- Reject invalid dependency graphs before any scripts start and write
the reason to every selected script's log.
- Log unmet dependencies every 30 seconds and explain skips. Populate
display names in the manifest so skip messages use readable names,
falling back to Terraform addresses.
- Exclude dependency waits from script timeouts, record an outcome on
every exit, and use fresh state per execution. Cancellation stops
waiters without starting dependents or emitting skip messages.
Add regression coverage for ordering, skip propagation, timeouts,
cancellation, invalid graphs, and unchanged unordered execution.
Refs https://linear.app/codercom/issue/PLAT-549/phase-3-enforce-lifecycle-script-ordering