Skip to content

feat: epic 7964 — channel v2 integration - #179

Merged
senamakel merged 9 commits into
tinyhumansai:mainfrom
senamakel:epic/7964-channel-v2
Oct 25, 2026
Merged

senamakel merged 9 commits into
tinyhumansai:mainfrom
senamakel:epic/7964-channel-v2

Conversation

@senamakel

@senamakel senamakel commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Epic-integration compatibility with the channel/delivery changes plus upstream-main sync.

Rolled-up work

2 fork PRs merged into senamakel/tinyflows:epic/7964-channel-v2: https://github.com/senamakel/tinyflows/pulls?q=is%3Apr+is%3Amerged+base%3Aepic%2F7964-channel-v2

The branch already contains the current upstream default branch (merge commit, no rebase), so it merges cleanly.

Gates

Per-PR hosted CI on the fork passed (or the bypassed check is named on the fork PR). Local gates run: build, clippy -D warnings, focused tests, fmt. Cross-repo integration evidence: senamakel/openhuman#678 and docs/handoffs/7964/upstream-merge-receipts.md.

Part of tinyhumansai/openhuman#7964

Summary by CodeRabbit

  • Compatibility
    • Channel-origin session bindings are now serialized as channel_session. Existing data using session_identity remains accepted when read.
  • Documentation
    • Clarified that channel-session identity is opaque to TinyFlows and validated by the host.

senamakel and others added 9 commits October 20, 2026 08:10
Introduces `ChannelSessionIdentity` and `ChannelConversationIdentity` structs to carry host-derived context for channel-origin jobs. This allows the receiving host to validate the job's origin against its trusted dispatch context.

Auto-committed-on: dragonfly
This updates the contract version to 8 and adds ChannelConversationIdentity and ChannelSessionIdentity to the exported types. This allows for more granular tracking of job origins within the scheduling system.

Auto-committed-on: dragonfly
This commit updates the expected contract version to 8 across several test modules. Additionally, it introduces tests to handle `channel_session` in various schedule-related contexts to improve test coverage for channel interactions.

Auto-committed-on: dragonfly
This change updates the `channel_session` field in `JobOrigin` to use `Option<Box<ChannelSessionIdentity>>` instead of `Option<ChannelSessionIdentity>`. This adjustment is made to correctly handle ownership when serializing and deserializing job data.

Auto-committed-on: dragonfly
This adds a new test case to verify the behavior when the channel_session field is explicitly set to None in the wire structure.

Auto-committed-on: dragonfly
feat(schedule): carry durable channel identity for channel-origin jobs
Merge upstream main into epic/7964-channel-v2
@tinysweeper

tinysweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Findings

  • critical: Do not gate run_preflight_with_observer behind test/mock (crates/tinyflows/src/engine/api.rs:70)
    Problem: `crates/tinyflows/src/preflight.rs` unconditionally calls `crate::engine::run_preflight_with_observer(&compiled, input, &caps, &observer_dyn, nesting)` — that call site carries no
    Suggested fix:
    pub(crate) async fn run_preflight_with_observer(
    
  • high: Keep the migration from deleting rows no step touched (crates/tinyflows-storage/src/schema/migrations.rs:138)
    Problem: The original condition deleted only rows that were (a) in a different collection than the step's item, or (b) in the step's own collection, still below `step.to`, and not among thi
    Suggested fix:
                        if (source != step.item || row.meta.schema < step.to)
                            && (source != step.item
                                || !output_ids.contains(&(step.item.to_owned(), row.id.clone())))
    

Verdict: Incomplete · Priority: critical
Coverage: Reviewed 11 of 11 files.
Lane gaps: The description reviewer did not respond.

Diagnostics and supporting details

Full summary

Pull request purpose (title): feat: epic 7964 — channel v2 integration. Tiny Sweeper completed its review; deterministic results follow.

Review snapshot

Change surface Files Review signal Count
Production 5 Active findings 2
Tests 6 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 1

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

Features

  • Modified — Channel job-origin session binding renamed to `channel_session` with `session_identity` wire alias: Wire payloads for channel origins now carry the binding under `channel_session`; producers still sending `session_identity` deserialize into the renamed field, preserving compatibility, while origins without a binding serialize exactly as before. (crates/tinyflows-bus/src/schedule/types.rs pub enum JobOrigin {, crates/tinyflows-bus/src/schedule/mod.rs pub const CALLBACK_INTERFACE: &str = "ai.tinyhumans.tinyflows.ScheduleHost";)
  • Modified — Rewritten page-purge condition in storage schema migrations: The delete predicate is restructured so rows are removed based on source/item mismatch combined with schema-version and output-id checks. Per the tests-lane finding, the new predicate deletes source rows that the migration step did not touch. (crates/tinyflows-storage/src/schema/migrations.rs impl Schema {)
  • Internal refactor — Test fixtures and wire expectations updated to the renamed field: Fixture constructors and serialized-byte assertions in the bus, drivers, and schedule crates now use `channel_session`, keeping test helpers aligned with the public wire name. (crates/tinyflows-drivers/src/schedule/test_support.rs pub(super) fn channel_origin() -> JobOrigin {, crates/tinyflows-bus/src/schedule/wire_tests.rs fn origin_wire_bytes() {, crates/tinyflows-schedule/src/wire_tests.rs fn origin_wire_bytes() {, crates/tinyflows-schedule/src/validation_tests.rs fn origin_requires_conversation_and_announce_can_reply_to_its_asker() {)

Tests

  • wire_format_test — Wire-byte fixtures for channel origins now expect the binding under `channel_session`, with the bus and schedule crates asserting the exact serialized JSON.: Byte-level expectations are updated to match the new serialized name; whether the fixtures were executed is not stated in the evidence. (crates/tinyflows-bus/src/schedule/wire_tests.rs fn origin_wire_bytes() {, crates/tinyflows-schedule/src/wire_tests.rs fn origin_wire_bytes() {)

Before merge

  • Address Do not gate run_preflight_with_observer behind test/mock (crates/tinyflows/src/engine/api.rs).
  • Address Keep the migration from deleting rows no step touched (crates/tinyflows-storage/src/schema/migrations.rs).
  • Complete the description review.

How this fits together

flowchart LR
  n0["JobOrigin<br/>changed"]:::changed
  n1["...nel_roundtrips_with_and_without_optionals<br/>changed"]:::changed
  n2["origin_wire_bytes<br/>changed"]:::changed
  n3["...ation_and_announce_can_reply_to_its_asker<br/>changed"]:::changed
  n4["origin_wire_bytes<br/>changed"]:::changed
  n5["assert_bytes"]:::impacted
  n6["assert_bytes"]:::impacted
  n7["Channel"]:::impacted
  n8["Value"]:::impacted
  n9["DeliveryConfig"]:::impacted
  n1 -->|uses| n0
  n1 -->|uses| n7
  n2 -->|calls| n5
  n2 -->|tests| n5
  n2 -->|uses| n7
  n3 -->|uses| n7
  n3 -->|uses| n9
  n4 -->|calls| n6
  n4 -->|tests| n6
  n4 -->|uses| n7
  n7 -->|uses| n8
  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 with no findings across 11 reviewed files, including line-for-line verification of the mechanical `session_identity` to `channel_session` rename.
  • Positive: The critique lane notes the code index lags the pull request, so retrieved context may be stale; the lane status is answered, not pending.
  • Lane summary: Reviewed 8 files; 0 findings. 4 file(s) are the mechanical rename `session_identity` → `channel_session`, verified line for line; one of them was read to judge the substitution itself, the rest were not sent to a model. _The code index is behind this pull request (indexed at `2cc31cbc9125`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane is answered with no findings on the rename and doc-comment wording, which now describes the binding as opaque and host-validated.
  • Lane summary: Reviewed 7 files; 0 findings. 4 file(s) are the mechanical rename `session_identity` → `channel_session`, verified line for line; one of them was read to judge the substitution itself, the rest were not sent to a model. _The code index is behind this pull request (indexed at `2cc31cbc9125`), so retrieved context may be out of date._

tests

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Positive: Two blocking findings are recorded: the preflight observer gate compiles out a function still referenced in production builds, and the rewritten purge condition deletes untouched source rows.
  • Lane summary: This change renames the `session_identity` field on channel job origins to `channel_session` (keeping the old name as a serde alias), gates `run_preflight_with_observer` behind `cfg(any(test, feature = "mock"))`, and rewrites the page-purge condition in the storage migrations. The rename is covered by both wire-byte tests and a new alias test. Two problems block merge: the `run_preflight_with_observer` gating leaves `preflight.rs` calling a function that is not compiled for production builds, and the rewritten purge condition deletes source rows that the migration step did not touch. _The code index is behind this pull request (indexed at `2cc31cbc9125`), so retrieved context may be out of date._
  • Evidence: crates/tinyflows/src/engine/api.rs — Do not gate run_preflight_with_observer behind test/mock
  • Evidence: crates/tinyflows-storage/src/schema/migrations.rs — Keep the migration from deleting rows no step touched

commits

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

description

  • Conclusion: Neutral
  • Scope reviewed: no lane response
  • Lane summary: No reviewer produced a usable response.
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.001016
  • Tokens: 572496 input · 9736 output · 11264 cached · 373 embedding
  • Updated: 2026-10-25T03:17:41Z
Head State Pass summary
5953af948106 incomplete 2 active finding(s), 0 resolved finding(s) (at 2026-10-25T03:17:41Z)

tinysweeper 0.1.2

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 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 ⚠️ Failed 2026-10-25T03:17:50.459363Z
We couldn’t complete this review. Comment @codex review to try again.
5953af9 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.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e49ecb58-3541-43fa-a3f0-1e041090c308
Commits

Reviewing files that changed from the base of the PR and between 739a068 and 5953af9.

Files selected for processing: 11
  • crates/tinyflows-bus/src/schedule/identity_tests.rs
  • crates/tinyflows-bus/src/schedule/mod.rs
  • crates/tinyflows-bus/src/schedule/types.rs
  • crates/tinyflows-bus/src/schedule/types_tests.rs
  • crates/tinyflows-bus/src/schedule/wire_tests.rs
  • crates/tinyflows-drivers/src/schedule/test_support.rs
  • crates/tinyflows-schedule/src/validation_tests.rs
  • crates/tinyflows-schedule/src/wire_tests.rs
  • crates/tinyflows-storage/src/schema/migrations.rs
  • crates/tinyflows/src/engine.rs
  • crates/tinyflows/src/engine/api.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 channel-origin session field is now channel_session, with session_identity retained as a deserialization alias. Test fixtures use the new field. The migration condition is regrouped without behavioral change, and the preflight observer helper is gated to test or mock builds.

Changes: Channel session contract

Layer / File(s) Summary
Channel field and wire contract
crates/tinyflows-bus/src/schedule/types.rs, crates/tinyflows-bus/src/schedule/mod.rs, crates/tinyflows-bus/src/schedule/identity_tests.rs, crates/tinyflows-bus/src/schedule/types_tests.rs, crates/tinyflows-bus/src/schedule/wire_tests.rs
The channel-origin field and its documentation use channel_session. Deserialization accepts session_identity as an alias. Tests cover the new field and legacy wire key.
Channel-origin fixture updates
crates/tinyflows-drivers/src/schedule/test_support.rs, crates/tinyflows-schedule/src/validation_tests.rs, crates/tinyflows-schedule/src/wire_tests.rs
Driver and schedule test fixtures initialize channel_session.

Migration row-deletion condition

Layer / File(s) Summary
Migration condition rewrite
crates/tinyflows-storage/src/schema/migrations.rs
The row-deletion condition is regrouped. Its behavior remains unchanged.

Preflight helper compilation gate

Layer / File(s) Summary
Preflight helper compilation gate
crates/tinyflows/src/engine/api.rs, crates/tinyflows/src/engine.rs
The helper and its re-export are compiled only for tests or when the mock feature is enabled.

Priority: Normal

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

Change: Feature

Possibly related issues

  • tinyhumansai/openhuman#7964: The issue includes channel-session work in the channel contract migration. This change updates the schedule contract’s channel-session field; the supplied summary does not describe turn-context changes.
Merge Risk: Minimal · up to 5953a

This change renames the channel session field while still accepting the old wire name, makes a migration condition easier to read without changing its behavior, and limits a preflight helper to test and mock builds, where its only caller is also compiled. No remaining merge-blocking issue was found.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 11 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 identifies the primary change as channel v2 integration and matches the pull request objectives.
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
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit hops past fields renamed,
channel_session now is named.
Old wire keys still find their way,
While fixtures match the new array.
I nibble greens and thump hooray!

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

@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.

Requesting changes: 1 lane(s) blocking, worst finding is critical.

Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.

Diagnostics

Total spend: $0.0010

Comment on lines +70 to 71
#[cfg(any(test, feature = "mock"))]
pub(crate) async fn run_preflight_with_observer(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority critical tests confident

Do not gate run_preflight_with_observer behind test/mock

`crates/tinyflows/src/preflight.rs` unconditionally calls `crate::engine::run_preflight_with_observer(&compiled, input, &caps, &observer_dyn, nesting)` — that call site carries no `#[cfg]`. With this gate the function (and the re-export in `engine.rs`) only exists when `cfg(test)` or `feature = "mock"` is set, so a default `cargo build` of the `tinyflows` crate fails with `E0425: cannot find function run_preflight_with_observer in module crate::engine`. `mock` is `default = []`, so the production build is exactly the one that loses the symbol. Either drop the gate or gate the `preflight.rs` call site identically.

Suggested change
#[cfg(any(test, feature = "mock"))]
pub(crate) async fn run_preflight_with_observer(
pub(crate) async fn run_preflight_with_observer(

[RULE] cfg-gated-symbol-used-in-production ·

Comment on lines +138 to +140
if source != step.item
|| (row.meta.schema < step.to
&& !output_ids.contains(&(step.item.to_owned(), row.id.clone())))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority high tests likely

Keep the migration from deleting rows no step touched

The original condition deleted only rows that were (a) in a different collection than the step's item, or (b) in the step's own collection, still below `step.to`, and not among this batch's outputs — i.e. rows the step left behind. The rewritten form first disjunct is `source != step.item`, with no `row.meta.schema < step.to` requirement, so when a step reads from another collection every row in the page is now deleted unconditionally after the outputs are written. Concretely: any step with `step.source = Some(other)` (the `if source != step.item` branch at `let source = step.source.unwrap_or(step.item);` exists precisely for this) wipes the entire source collection as it pages through it, even rows the step did not touch or preserve via `output_ids`. Restore the previous structure, or at minimum require `row.meta.schema < step.to` on the `source != step.item` branch as well.

Suggested change
if source != step.item
|| (row.meta.schema < step.to
&& !output_ids.contains(&(step.item.to_owned(), row.id.clone())))
if (source != step.item || row.meta.schema < step.to)
&& (source != step.item
|| !output_ids.contains(&(step.item.to_owned(), row.id.clone())))

[RULE] unnecessary-delete ·

@tinysweeper tinysweeper Bot added the priority: p0 Drop what you are doing. Data loss, a live break, or an exploitable hole. label Oct 25, 2026
@senamakel
senamakel merged commit f65e069 into tinyhumansai:main Oct 25, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p0 Drop what you are doing. Data loss, a live break, or an exploitable hole.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant