Skip to content

feat(schedule): preserve channel session identity for origin jobs - #170

Merged
senamakel merged 9 commits into
mainfrom
7964-tinyflows-channel-identity
Oct 21, 2026
Merged

senamakel merged 9 commits into
mainfrom
7964-tinyflows-channel-identity

Conversation

@senamakel

@senamakel senamakel commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Add a typed, opaque channel session identity to scheduled channel origins so durable jobs can retain their reply-routing context. The field is optional and omitted from legacy serialization when absent. Bump the schedule bus contract version to 8.

The identity carries tenant, agent, session, provider, account, and conversation fields. TinyFlows stores and forwards it without interpreting host policy.

Verification

  • cargo test -p tinyflows-bus --lib (89 passed)
  • cargo test -p tinyflows-module --lib (135 passed)
  • cargo clippy -p tinyflows-bus -p tinyflows-module --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • cargo doc -p tinyflows-bus -p tinyflows-module --no-deps

The module artifact verification script could not pass locally because TinyBus rejects the shared worktree path: an ancestor directory is group-writable (0775). The failure is environmental and occurs before artifact behavior is exercised; hosted CI should verify it on its runner.

Summary by CodeRabbit

  • New Features

    • Added serializable channel session and conversation identities for scheduled jobs.
    • Channel job origins can include tenant, agent, session, provider, account, conversation, thread, and topic details.
    • Optional identity data preserves compatibility with existing channel job formats.
  • Tests

    • Added coverage for identity serialization, deserialization, round trips, and legacy compatibility.
  • Chores

    • Updated the schedule contract version to 8.

senamakel and others added 8 commits October 21, 2026 16:37
…tinyflows-bus/src/schedule/iden

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…tinyflows-bus/src/schedule/mod_

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…crates/tinyflows-module/tests/m

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
….rs,crates/tinyflows-bus/src/sc

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
….rs,crates/tinyflows-bus/src/sc

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…s,crates/tinyflows-schedule/src

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…rt.rs

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb688e5b-3878-4aa1-b2ea-24f47e7fe470
📥 Commits

Reviewing files that changed from the base of the PR and between ae889c8 and ca20f75.

📒 Files selected for processing: 2
  • crates/tinyflows-schedule/src/lib.rs
  • crates/tinyflows-schedule/src/validation_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The scheduler contract now exposes channel-session and conversation identity types. Channel job origins can include this optional identity, which contains tenant, agent, session, provider, account, and conversation fields. The contract version changes from 7 to 8.

Changes: Channel session identity

Layer / File(s) Summary
Identity contract and wire format
crates/tinyflows-bus/src/schedule/identity.rs, crates/tinyflows-bus/src/schedule/mod.rs, crates/tinyflows-bus/src/schedule/types.rs, crates/tinyflows-bus/src/schedule/identity_tests.rs, crates/tinyflows-bus/src/schedule/wire_tests.rs
Adds public identity structs and an optional session_identity field to JobOrigin::Channel. Optional identity fields default to None when deserializing and are omitted when serializing. Tests cover identity round trips and channel origins without the new field.
Contract compatibility and public facade
crates/tinyflows-bus/src/schedule/mod_tests.rs, crates/tinyflows-bus/src/schedule/types_tests.rs, crates/tinyflows-drivers/src/schedule/test_support.rs, crates/tinyflows-module/tests/module_artifact_tests.rs, crates/tinyflows-schedule/src/lib.rs, crates/tinyflows-schedule/src/validation_tests.rs, crates/tinyflows-schedule/src/wire_tests.rs
Updates channel-origin fixtures, re-exports both identity types from tinyflows-schedule, and changes the contract-version assertions to 8.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related issues

  • tinyhumansai/chottu-core#158 — This change adds account and conversation identity to scheduled channel origins, but does not implement the account-linking flow described by the issue.
Merge Risk: ⚪ Minimal · up to ca20f

The changes add the stated public identity re-exports and update the optional-field fixture without an identified merge-blocking issue.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving channel session identity for scheduled origin jobs.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit carries identity through the scheduler lane
Tenant and session ride together again
Conversations keep their thread and scope
Old wire shapes still retain hope
Version eight marks the path ahead

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T16:47:23.796098Z ae889c8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae889c8a1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/tinyflows-bus/src/schedule/types.rs
@tinysweeper

tinysweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: ca20f759c38b621338832fa45cdb927feba953e0

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 12 of 12 files.
Pull request purpose (title): feat(schedule): pres…

Diagnostics and supporting details

Full summary

Pull request purpose (title): feat(schedule): preserve channel session identity for origin jobs. Purpose (from the pull-request title and description): preserve channel session identity for origin jobs, so durable scheduled channel jobs can retain the reply-routing context captured by the host, with an optional field that is omitted from legacy serialization and with the schedule bus contract bumped to 8. The pull request adds two typed identity structures in `crates/tinyflows-bus/src/schedule/identity.rs` — `ChannelSessionIdentity` (tenant, agent, session, provider, optional account, and a conversation) and `ChannelConversationIdentity` (kind, id, and optional scope/parent/thread/topic) — exposes them through the bus module and through the `tinyflows-schedule` facade, and adds an optional boxed `session_identity` to `JobOrigin::Channel` in `crates/tinyflows-bus/src/schedule/types.rs` gated by serde default plus skip-when-none so older origins keep their existing wire shape. `CONTRACT_VERSION` in `crates/tinyflows-bus/src/schedule/mod.rs` moves from 7 to 8 with matching assertion updates, and every existing `JobOrigin::Channel` construction site in the diff is updated.

Review snapshot

Change surface Files Review signal Count
Production 4 Active findings 0
Tests 8 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: Test coverage is assessed from changed tests and lane evidence; execution is not claimed without trusted check data.

What changed

Adds optional, serde-skipped channel session identity to channel job origins, re-exports the two identity types from the bus and the schedule facade, bumps the schedule contract version to 8, and updates existing origin construction sites and version assertions to match.

Features

  • Added — Typed channel session and conversation identity: Introduces `ChannelSessionIdentity` and `ChannelConversationIdentity` as serializable identity structures carrying tenant, agent, session, provider, optional account, and provider-scoped conversation detail (including optional scope, parent, thread, and topic), with optional members omitted from serialization when absent so hosts can store and forward routing context opaquely. (crates/tinyflows-bus/src/schedule/identity.rs)
  • Modified — Optional session identity on channel job origins: `JobOrigin::Channel` gains an optional boxed `session_identity` gated by serde default and skip-when-none, so origins that lack it deserialize and re-serialize with their previous wire shape while new origins can carry durable session context. (crates/tinyflows-bus/src/schedule/types.rs)
  • Added — Bus module exports for the identity types: The new identity module is registered and its two types are re-exported from the schedule module, making them available to bus consumers. (crates/tinyflows-bus/src/schedule/mod.rs)
  • Modified — Schedule contract version bumped to 8: `CONTRACT_VERSION` advances from 7 to 8 with documentation describing the added channel-session identity, and the version assertion in the module tests and the module artifact test move in step. (crates/tinyflows-bus/src/schedule/mod.rs, crates/tinyflows-bus/src/schedule/mod_tests.rs fn every() -> Schedule {, crates/tinyflows-module/tests/module_artifact_tests.rs async fn compiled_module_serves_validation_without_linking_engine_into_client())
  • Added — Facade re-export from the schedule crate: The `tinyflows-schedule` facade re-exports the two identity types so downstream users can name them without depending on the bus crate directly. (crates/tinyflows-schedule/src/lib.rs pub use store::{)

Tests

  • unit — Round-trips a fully populated session identity through JSON, asserting the exact serialized object including the nested conversation scope/thread/topic fields and equality after deserialization.: Pins both the field-level serialization shape and the serde round trip for the new identity types. (crates/tinyflows-bus/src/schedule/identity_tests.rs)
  • compatibility — Verifies a channel origin carrying a session identity serializes with the identity nested under `session_identity` and round-trips, and that a legacy channel origin JSON without the key parses to an origin with `session_identity: None` and re-serializes back to the identical legacy bytes.: Covers the omitted-when-absent compatibility contract for existing origins alongside the new populated shape. (crates/tinyflows-bus/src/schedule/identity_tests.rs)
  • contract — Asserts the schedule contract version is 8 alongside the exact advertised member set.: Keeps the bumped contract version pinned to the member-set invariant. (crates/tinyflows-bus/src/schedule/mod_tests.rs fn every() -> Schedule {)

Findings

No active actionable findings.

Before merge

None.

How this fits together

flowchart LR
  n0["every<br/>changed"]:::changed
  n1["JobOrigin<br/>changed"]:::changed
  n2["...nel_roundtrips_with_and_without_optionals<br/>changed"]:::changed
  n3["origin_wire_bytes<br/>changed"]:::changed
  n4["...ation_and_announce_can_reply_to_its_asker<br/>changed"]:::changed
  n5["assert_bytes"]:::impacted
  n6["Channel"]:::impacted
  n7["DeliveryConfig"]:::impacted
  n8["Schedule"]:::impacted
  n0 -->|uses| n8
  n2 -->|uses| n1
  n2 -->|uses| n6
  n3 -->|calls| n5
  n3 -->|tests| n5
  n3 -->|uses| n6
  n4 -->|uses| n6
  n4 -->|uses| n7
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The critique lane is answered and reported no findings.
  • Lane summary: Reviewed 3 files; 0 findings. _The code index is behind this pull request (indexed at `ae889c8a1d3b`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane is answered and reported no findings, with the identity documented as opaque host-supplied data that TinyFlows stores and forwards without interpreting host policy.
  • Lane summary: Reviewed 3 files; 0 findings. _The code index is behind this pull request (indexed at `ae889c8a1d3b`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change adds an optional, omitted-when-absent `session_identity` to `JobOrigin::Channel` plus two new identity types, with byte-exact wire tests that pin both the legacy shape (no `session_identity` key) and the new one, a full serde round-trip with JSON equality, and compile-level coverage of the new public re-exports; all construction sites of the changed variant are updated in the diff and the contract-version assertions move in step. The change looks sound and the tests earn their keep. _The code index is behind this pull request (indexed at `ae889c8a1d3b`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane is answered and reported no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `ae889c8a1d3b`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The description lane is answered and reported that the change description accurately covers the optional serde-gated identity, the contract bump, the updated construction sites and version assertions, the wire and round-trip tests, and the facade re-export.
  • Lane summary: The change adds an optional, serde-gated `ChannelSessionIdentity` to channel job origins, bumps the schedule contract to 8, updates every existing `JobOrigin::Channel` construction site and version assertion, and adds wire/round-trip tests plus a facade re-export; the description accurately covers all of this. No defects found in the introduced code. _The code index is behind this pull request (indexed at `ae889c8a1d3b`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.000997
  • Tokens: 263092 input · 10854 output · 52096 cached · 494 embedding
  • Updated: 2026-10-21T19:56:43Z
Head State Pass summary
ae889c8a1d3b incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-21T16:55:49Z)
ca20f759c38b ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-21T19:56:43Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper could not complete coverage (1 unanswered item(s)), so this is not an approval.

Diagnostics

Total spend: $0.0067

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 21, 2026
Co-authored-by: Medulla <medulla@tinyhumans.ai>

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0010

@senamakel
senamakel merged commit 9b5c028 into main Oct 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant