The protocol and docs describe session-scoped event sequencing, but the typed wire structs have no event_seq field and the runtime never stamps one onto outbound envelopes. src/envelope.rs:56 and src/envelope.rs:185 define Envelope and RawEnvelope metadata without event_seq; src/runtime/server.rs:310 increments an internal emitted counter for ack flow control but sends the original envelope unchanged; and src/runtime/job.rs:200 exposes bump_event_seq even though the writer never calls it. As a result, clients cannot know what value to send in session.ack, JobSubscribedPayload.subscribed_from stays at zero for active jobs, history and from_event_seq cannot be implemented correctly, and README snippets that read env.event_seq do not match the API.
Fix prompt: Add an optional event_seq: u64 metadata field to both Envelope and RawEnvelope with serde defaults matching the other optional envelope fields. In the runtime writer, assign a strictly increasing session-scoped sequence to every MessageType::is_countable_event() envelope before persisting, publishing, and sending it, and update JobRegistry::bump_event_seq for job-scoped events so session.list_jobs and job.subscribed report the actual high-water mark. Add integration tests that assert countable events carry monotonic event_seq, non-countable session control messages do not, session.ack can use the observed value, and job subscription acknowledgements reflect the last emitted job event.
The protocol and docs describe session-scoped event sequencing, but the typed wire structs have no
event_seqfield and the runtime never stamps one onto outbound envelopes.src/envelope.rs:56andsrc/envelope.rs:185defineEnvelopeandRawEnvelopemetadata withoutevent_seq;src/runtime/server.rs:310increments an internalemittedcounter for ack flow control but sends the original envelope unchanged; andsrc/runtime/job.rs:200exposesbump_event_seqeven though the writer never calls it. As a result, clients cannot know what value to send insession.ack,JobSubscribedPayload.subscribed_fromstays at zero for active jobs,historyandfrom_event_seqcannot be implemented correctly, and README snippets that readenv.event_seqdo not match the API.Fix prompt: Add an optional
event_seq: u64metadata field to bothEnvelopeandRawEnvelopewith serde defaults matching the other optional envelope fields. In the runtime writer, assign a strictly increasing session-scoped sequence to everyMessageType::is_countable_event()envelope before persisting, publishing, and sending it, and updateJobRegistry::bump_event_seqfor job-scoped events sosession.list_jobsandjob.subscribedreport the actual high-water mark. Add integration tests that assert countable events carry monotonicevent_seq, non-countable session control messages do not,session.ackcan use the observed value, and job subscription acknowledgements reflect the last emitted job event.