fix: keep open and foreground capture in one session lifetime

Closed
TH
2mo ago
+6104-2760

Summary

Reopening an app now updates the latest record of its admitted session lifetime. One publication helper preserves resources, recording, claims, creation time and script-authoring behavior; retirement or daemon shutdown refuses a late open result.

Provisional publication retains its existing before-dispatch timing. Final publication follows artifact-directory and response construction. Foreground snapshot composition carries the exact published ref, so it cannot capture or mutate a successor at the same address.

Eleven files changed. Part of #3116, stacked on #3144.

Validation

Validated 52ec7ebd05: 70 focused tests through daemon handlers and the request router. Seven planted regressions fail, then restored source passes. Quick and Fallow checks pass; pnpm check:affected --base fix/replay-observation-lifetimes --run passes all selected runnable gates and 1,628 related tests across 265 files.

Controls cover held native launch, same-lifetime rebuild, retirement with record reuse, provisional replacement, cancellation, shutdown admission, a real blocked artifact directory, and foreground composition after publication. Independent review found no remaining findings. CI and live-provider evidence remain pending on the published head.