Skip to content

Replay subscription history from job history instead of the subscriber session #28

@nficano

Description

@nficano

Historical subscription replay is keyed to the subscriber session id rather than the job's recorded history. JobManager#publish_event, publish_result, and publish_error append envelopes under the submitter session id, while lib/arcp/runtime/session_actor.rb:240 through lib/arcp/runtime/session_actor.rb:242 replays @runtime.event_log.replay(@session_id, ...) for the observer session handling the subscribe request. A second session that calls subscribe_job(job_id: running.job_id, history: true, from_event_seq: 0) therefore gets no previous events even though the event log contains them under another session id.

Fix prompt: Rework event history lookup so job.subscribe history replay reads the requested job's event stream rather than the subscribing session's buffer. A minimal fix can index EventLog entries by job id in addition to the current session id, then have handle_subscribe replay from that job id while still enforcing SubscriptionManager#attach ownership checks. Add integration coverage where one client emits several events before a second client subscribes with history: true, and assert that the second client receives the prior events in order followed by live events and the terminal result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:mediumMedium severity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions