Skip to content

refactor(flows): run capabilities take the turn origin from the run's context (#7801) - #7919

Merged
senamakel merged 6 commits into
tinyhumansai:mainfrom
senamakel:fu-7801g-2
Oct 16, 2026
Merged

senamakel merged 6 commits into
tinyhumansai:mainfrom
senamakel:fu-7801g-2

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

A saved flow run now acts under a context that carries its own trusted Workflow origin (new DispatchCtx::with_turn_origin), built in flows_run and flows_resume. gate_call_for_tier, the nested agent runner and the memory adapter read the origin from that context instead of DispatchCtx::ambient_turn().

Total production DispatchCtx::ambient* + load_config_with_timeout( sites: 44 -> 41 (ambient 39 -> 36, load_config_with_timeout 5 -> 5).

Tests

  • New in memory_adapter_tests: the run's context wins over a different flow's origin scoped on the task, and a context without a Workflow origin refuses flow scope inside someone else's workflow scope. Existing adapter tests now bind the run's context.
  • cargo test -p openhuman --lib flows:: 582 passed; saas_mode_e2e 19, saas_profile_isolation_e2e 3 passed.

Gates

cargo check (--no-default-features, e2e-test-support all-targets, app), openhuman-core bin build, rust:layout, check-agent-runtime-boundary, check-saas-ambient, check-process-statics all pass. Full lib suite and embed saas_profiles not run this round.

Refs #7801, #7523

…ctors

Capability constructors now take the memory adapter explicitly instead of
reaching for it internally, so each cap receives its dependencies from the
caller. This keeps construction consistent across the agent, code, http, ops,
tier, and tool caps and makes the wiring in memory_adapter explicit.

Auto-committed-on: dragonfly
Flow execution and resume now take a dispatch context so that
downstream operations can access runtime state consistently. The
memory adapter tests were updated to match the new signatures.

Auto-committed-on: dragonfly
Adds unit tests covering the tinyflows memory adapter, exercising its
read and write paths against the in-memory store. The tests were missing
from the module and are needed to guard the adapter's behaviour as the
flow engine evolves.

Auto-committed-on: dragonfly
Adds coverage for the tinyflows memory adapter, exercising the
conversion between flow memory and the core memory store so that
regressions in that boundary are caught by the test suite.

Auto-committed-on: dragonfly
Reformat several tinyflows capability files and add a test helper that
builds a memory adapter bound to a run's turn origin. The tests now set
the adapter context explicitly so flow scoping is exercised without
relying on ambient origin state.

Auto-committed-on: dragonfly
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T09:31:32.353503Z d4369e8 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 16, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5213140f-1ead-4879-b058-c44561b7aca3
📥 Commits

Reviewing files that changed from the base of the PR and between 352eae8 and d4369e8.

📒 Files selected for processing: 12
  • crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
  • crates/openhuman-core/src/flows/ops/execution.rs
  • crates/openhuman-core/src/flows/ops/resume.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/agent.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/code.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/http.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/ops.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/tier.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs
  • crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs
  • crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs
  • crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
+---------------------+
| sync; sync; review; |
+---------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@tinysweeper

tinysweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 5 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: none
Reviewed head: 9a1b8b45ac59
Updated: 2026-10-16T09:47:01Z

Review snapshot

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

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

  • Unreviewed: tinysweeper/tests

Findings

No active actionable findings.

Could not review: crates/openhuman-core/src/flows/tinyflows/caps/code.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs, crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs, tinysweeper/tests

Before merge

  • Complete the critique review for crates/openhuman-core/src/flows/tinyflows/caps/code.rs.
  • Complete the security review for crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs.
  • Complete the tests review for tinysweeper/tests.

How this fits together

flowchart LR
  n0["DispatchCtx<br/>changed"]:::changed
  n1["run_flow_body_inner<br/>changed"]:::changed
  n2["flows_resume<br/>changed"]:::changed
  n3["OpenHumanAgentRunner<br/>changed"]:::changed
  n4["OpenHumanCode<br/>changed"]:::changed
  n5["OpenHumanHttp<br/>changed"]:::changed
  n6["build_capabilities<br/>changed"]:::changed
  n7["ComposioToolBackend<br/>changed"]:::changed
  n8["NativeToolBackend<br/>changed"]:::changed
  n9["Result"]:::impacted
  n10["with_origin"]:::impacted
  n11["ToolBackend"]:::impacted
  n12["ToolCallCtx"]:::impacted
  n13["ApprovalTurnContext"]:::impacted
  n1 -->|uses| n0
  n1 -->|calls| n6
  n1 -->|uses| n9
  n1 -->|calls| n10
  n2 -->|uses| n0
  n2 -->|calls| n6
  n2 -->|uses| n9
  n2 -->|calls| n10
  n3 -->|uses| n0
  n3 -->|uses| n13
  n4 -->|uses| n13
  n5 -->|uses| n0
  n5 -->|uses| n13
  n6 -->|uses| n0
  n6 -->|uses| n3
  n6 -->|uses| n4
  n6 -->|uses| n5
  n6 -->|uses| n13
  n7 -->|implements| n11
  n8 -->|implements| n11
  n11 -->|uses| n9
  n11 -->|uses| n12
  n12 -->|uses| n0
  n12 -->|uses| n13
  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: incomplete; unanswered: crates/openhuman-core/src/flows/tinyflows/caps/code.rs
  • Lane summary: Reviewed 11 files; 0 findings. 1 file could not be reviewed: crates/openhuman-core/src/flows/tinyflows/caps/code.rs. _The code index is behind this pull request (indexed at `319ff382023d`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: incomplete; unanswered: crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs
  • Lane summary: Reviewed 9 files; 0 findings. 3 files could not be reviewed: crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs. _The code index is behind this pull request (indexed at `319ff382023d`), so retrieved context may be out of date._

tests

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/tests
  • Lane summary: No reviewer produced a usable response.

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: _The code index is behind this pull request (indexed at `319ff382023d`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, glm-5.3-flash, deepseek-v4.1-flash
  • Spend: $0.005776
  • Tokens: 568223 input · 28992 output · 8704 cached · 517 embedding
Head State Pass summary
9a1b8b45ac59 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-16T09:47:01Z)

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 found nothing blocking, but could not review everything, so this is not an approval: crates/openhuman-core/src/flows/tinyflows/caps/code.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs, crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs, crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs, tinysweeper/tests.

             $0.0058 · 568,223 in / 28,992 out · 8,704 cached (2%) · ladder/vectors-oai3, glm-5.3-flash, deepseek-v4.1-flash · 517 embedded
critique:    $0.0030 · 316,996 in / 14,782 out · 8,704 cached (3%) · glm-5.3-flash, deepseek-v4.1-flash
security:    $0.0022 · 220,550 in / 7,256 out  · 0 cached (0%)     · glm-5.3-flash
tests:       $0.0002 · 16,739 in  / 245 out    · 0 cached (0%)     · glm-5.3-flash
description: $0.0001 · 8,215 in   / 83 out     · 0 cached (0%)     · glm-5.3-flash

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 16, 2026
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