Skip to content

The deployment recorder's internal _recorder_finished event leaks into event_log and SSE streams #3062

Description

@dawsontoth

Part of #641.

Problem

DeploymentRecorder.finish() (components/deploymentRecorder.ts) emits an internal sentinel, _recorder_finished, on the deploy's progress emitter. It does this so that get_deployment's live tail can stop waiting. The sentinel goes out before the recorder sets finished and unsubscribes, so it also leaks into places it doesn't belong:

  • The record. The recorder's own subscriber (appendEvent) appends the sentinel to event_log, and the terminal write stores it. Every finished deployment's history therefore ends with an _recorder_finished entry, and Studio's deployment detail shows that entry in its activity list.
  • A streamed deploy_component. The SSE writer (server/serverHelpers/progressEmitter.ts) forwards every emitter event, so clients receive an _recorder_finished event before done.
  • The live tail. get_deployment's live tail (components/deploymentOperations.ts) calls sse.emit before it checks whether the event is terminal, so the tail forwards the sentinel too.

I found this by reading the code and haven't reproduced it.

Proposal

Signal the end of a deployment to the live tail some other way, such as a promise the recorder settles, or a finished status the tail already reads. Failing that, emit the sentinel after the recorder unsubscribes, and have both SSE writers drop event names that start with _.

Done when

A finished deployment's event_log contains no _recorder_finished entry. Neither a streamed deploy_component nor a get_deployment tail sends one, and the tail still ends when the deploy does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    P3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions