Skip to content

refactor(runtime): un-bundle non-channel bootstrap jobs from ServiceSet.channels (#5028) - #5079

Merged
senamakel merged 4 commits into
tinyhumansai:mainfrom
oxoxDev:refactor/5028-serviceset-unbundle
Jul 23, 2026
Merged

refactor(runtime): un-bundle non-channel bootstrap jobs from ServiceSet.channels (#5028)#5079
senamakel merged 4 commits into
tinyhumansai:mainfrom
oxoxDev:refactor/5028-serviceset-unbundle

Conversation

@oxoxDev

@oxoxDev oxoxDev commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Un-bundles four non-channel background jobs from the ServiceSet.channels switch by giving them their own runtime flags — integrations, memory_sync, orchestration.
  • A build that wants memory/integrations but not chat channels no longer silently loses Composio sync, workspace memory sync, orchestration drain, and the one-shot source reconcile.
  • Desktop is byte-identical (all flags on); core/runtime-composition only.

Problem

start_bootstrap_jobs gated four jobs behind if services.channels — none of which is channel-specific:

  • composio::start_periodic_sync — Composio integration connection sync
  • memory_sync::workspace::start_workspace_periodic_sync — workspace memory sources (repos, folders, RSS, web pages)
  • orchestration::start_message_drain_supervisor — relay-mailbox drain supervisor
  • memory_sources::reconcile::ensure_composio_sources — one-shot source reconcile

They shipped alongside channel startup as a historical grab-bag (the else log even blurs it as "channel/integration pollers"). An embedder composing channels OFF + memory/integrations ON lost all four with only a debug log; conversely a channels-ON build dragged in orchestration and sync loops it never asked for.

Solution

  • Three new ServiceSet flags (integrations, memory_sync, orchestration), not one — the four jobs span three distinct concerns, so a single coarse flag would reproduce the bug one level down. The Composio pair (start_periodic_sync + ensure_composio_sources) legitimately shares integrations: both no-op without active Composio connections. Not folded into existing flags — memory_queue gates ingestion workers, not outbound source polling.
  • Presets preserve every current job set exactly. The jobs previously ran iff channels, which is true only in desktop(); so desktop() sets all three new flags true, headless_api() and none() set them false. Desktop stays byte-identical; headless/none stay job-free.
  • bootstrap_job_plan(&ServiceSet) -> BootstrapJobPlan — a pure, PartialEq mapping struct is the single source of truth for flag→job; start_bootstrap_jobs computes it then spawns each job behind its plan bool, replacing the if services.channels block with three concern blocks each carrying its own precise disabled-by-ServiceSet log. After this, services.channels gates no bootstrap job — its only remaining meaning is spawn_channels_service (the realtime listeners), which is the point of the issue.
  • Only the three presets construct ServiceSet { … } literals; every other site uses a preset ± field mutation, so no other code changes to compile. Fields stay pub; no #[non_exhaustive] (matches DomainSet convention).

Submission Checklist

  • Tests added: pure-plan tests — desktop-equivalence (all jobs on), job-free presets (none/headless_api), single-flag independence in both directions, and the ServiceSet::channels bundles non-channel bootstrap jobs (composio sync, memory sync, orchestration drain) #5028 regression (channels alone gates zero bootstrap jobs; channels=false + the new flags on loses nothing). The boot_jobs_are_independent_from_runtime_service_flags preset test is extended for the three new fields. (Jobs spawn detached global-state loops, so the pure plan — not start_bootstrap_jobs — is what's exercised.)
  • Diff coverage ≥ 80% — the changed lines are the flag fields + bootstrap_job_plan, all exercised by the new tests. Enforced on merge by CI.
  • N/A: behaviour-preserving refactor — no coverage-matrix feature rows added/removed/renamed.
  • No matrix feature IDs affected — see ## Related.
  • No new external network dependencies introduced.
  • N/A: does not touch a release-cut manual-smoke surface (desktop job set byte-identical).
  • Linked issue closed via Closes #5028 in ## Related.

Impact

  • Platform: core / runtime composition. Desktop unchanged — desktop() runs the identical four jobs.
  • Embedders: a channels-off host can now run integrations / workspace memory sync / orchestration independently instead of losing all four.
  • Binary size / migration / wire: none. No schema or RPC change.
  • Risk: low. Verified: cargo check + gates-off check pass, fmt/clippy -D warnings clean (0 new), cargo test --lib core::runtime 17/17.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

Commit & Branch

  • Branch: refactor/5028-serviceset-unbundle
  • Commit SHA: 50720c61e

Validation Run

  • N/A: pnpm typecheck / format:check — no TypeScript or frontend files changed
  • cargo fmt --check clean; cargo check clean; cargo clippy -- -D warnings clean (0 new)
  • Gates-off compiles: GGML_NATIVE=OFF cargo check --no-default-features --features tokenjuice-treesitter
  • Focused tests: cargo test --lib core::runtime (17)

Behavior Changes

  • Intended behavior change: bootstrap jobs are selectable independently of the channels service flag; channels no longer gates non-channel jobs.
  • User-visible effect: none on desktop (all flags on). Embedders composing a subset gain the four jobs without enabling channels.

Parity Contract

  • Legacy behavior preserved: desktop() runs the exact same four jobs as before; headless_api()/none() stay job-free.
  • Guard/fallback/dispatch parity checks: bootstrap_job_plan maps each preset to its prior job set (pinned by tests).

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this
  • Resolution: N/A

Summary by CodeRabbit

  • New Features
    • Added separate service-selection toggles for integrations, workspace memory synchronization, and orchestration.
    • Updated service presets so Desktop enables these by default, while headless API/none keep them disabled.
  • Bug Fixes
    • Fixed startup behavior where channel-related settings could unintentionally trigger unrelated background services by unbundling bootstrap-job enablement.
    • Improved the bootstrap start logic so each background job is controlled independently by its corresponding toggle.

@oxoxDev
oxoxDev requested a review from a team July 21, 2026 10:17

@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: 50720c61e6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/core/runtime/services.rs
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b1314114-5a7a-4925-a1be-0a328a82639f

📥 Commits

Reviewing files that changed from the base of the PR and between bccc45b and 83a7dac.

📒 Files selected for processing (3)
  • .github/workflows/ci-lite.yml
  • src/core/runtime/builder.rs
  • src/core/runtime/services.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/ci-lite.yml
  • src/core/runtime/builder.rs
  • src/core/runtime/services.rs

📝 Walkthrough

Walkthrough

ServiceSet adds independent flags for integrations, memory synchronization, and orchestration. Bootstrap startup now derives a five-job plan from those flags instead of bundling jobs under channels, with expanded preset, regression, and CI gate tests.

Changes

Bootstrap service selection

Layer / File(s) Summary
Service flags and presets
src/core/runtime/builder.rs
ServiceSet adds integrations, memory_sync, and orchestration; presets and assertions define their enabled states.
Bootstrap job planning and execution
src/core/runtime/services.rs, .github/workflows/ci-lite.yml
BootstrapJobPlan independently controls five bootstrap jobs, tests cover per-flag behavior and channels isolation, and CI includes the runtime gate tests and allowlist entry.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: rust-core, feature

Poem

I toggled three flags beneath the moon,
And freed each bootstrap job its tune.
Channels no longer pull the thread,
Memory, sync, and drains are spread.
— A hopping rabbit, pleased instead 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main runtime refactor and matches the implemented unbundling change.
Linked Issues check ✅ Passed The PR splits composio sync, memory sync, and orchestration drain away from ServiceSet.channels as requested in #5028.
Out of Scope Changes check ✅ Passed The CI workflow tweak is ancillary support for the new test scope and does not appear unrelated to the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
.github/workflows/ci-lite.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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

@coderabbitai coderabbitai Bot added the rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. label Jul 21, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/core/runtime/services.rs (1)

236-278: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add enabled-path bootstrap diagnostics.

Only disabled branches log today. Log the selected plan, each enabled external dispatch, Composio reconcile start/completion, and function dispatch completion with a stable namespace such as [runtime.bootstrap].

As per coding guidelines, “New or changed flows must include verbose, grep-friendly diagnostics covering entry/exit, branches, external calls, retries/timeouts, state transitions, and errors.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/runtime/services.rs` around lines 236 - 278, Add verbose,
grep-friendly diagnostics under the stable [runtime.bootstrap] namespace in
start_bootstrap_jobs: log the selected bootstrap plan, each enabled service
dispatch, Composio reconcile start and completion, and completion of the
function’s dispatch sequence. Preserve the existing disabled-branch logs and add
diagnostics at the corresponding enabled paths and function exit.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/runtime/builder.rs`:
- Around line 60-65: Move the integrations, memory_sync, and orchestration
bootstrap configuration from src/core/runtime/builder.rs lines 60-65 into a
dedicated src/openhuman/<domain>/ coordinator, preserving their behavior. Move
the corresponding flag-to-domain-job mapping from src/core/runtime/services.rs
lines 215-222 into that coordinator, leaving src/core focused only on transport
concerns.

---

Outside diff comments:
In `@src/core/runtime/services.rs`:
- Around line 236-278: Add verbose, grep-friendly diagnostics under the stable
[runtime.bootstrap] namespace in start_bootstrap_jobs: log the selected
bootstrap plan, each enabled service dispatch, Composio reconcile start and
completion, and completion of the function’s dispatch sequence. Preserve the
existing disabled-branch logs and add diagnostics at the corresponding enabled
paths and function exit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 83bd16b2-6f37-44d6-a8ea-17e7a893c062

📥 Commits

Reviewing files that changed from the base of the PR and between 9420a29 and 50720c6.

📒 Files selected for processing (2)
  • src/core/runtime/builder.rs
  • src/core/runtime/services.rs

Comment thread src/core/runtime/builder.rs
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 21, 2026
@oxoxDev

oxoxDev commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed review + fixed the red CI lane.

CIRust Feature-Gate Smoke (gates off) was failing on the self-maintaining guard: #5028 added a #[cfg(test)] mod tests to core/runtime/services.rs (which #[cfg(feature = "flows")]-gates at L131), so it entered the gated-test set and had to be acknowledged. Added it to the EXPECTED allowlist and appended core::runtime:: to the scoped cargo test filter so the smoke lane actually runs the new ServiceSet plan tests gates-off. Guard now diff-clean (19 == 19); scoped gates-off run green (247 passed). — 6b1741e5

Diagnostics (CodeRabbit, services.rs:236-278) — valid, matches the repo debug-logging rule. Added [runtime.bootstrap] grep-friendly logs on the enabled paths (selected plan, each dispatch, Composio reconcile start/completion, function exit); the disabled branches already logged. — bccc45b2b

Move bootstrap policy out of src/core/ (CodeRabbit) and guard channel-startup duplicates (Codex) — replied inline. Both are out of scope for this un-bundle: the ServiceSet/start_bootstrap_jobs mechanism already lives in src/core/runtime/ (this PR extends it in place), and the start_channels duplication is pre-existing + intentionally idempotent/no-op-without-connections. Flagged as follow-up rather than expanding scope here.

Gates local: fmt ✓, clippy -D warnings ✓, gates-off check ✓, cargo test --lib core::runtime 17/17 ✓.

@oxoxDev

oxoxDev commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the feature Net-new user-facing capability or product behavior. label Jul 21, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 21, 2026

@senamakel senamakel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated technical review: approved for the inspected head commit (83a7dac).

Summary of review

This PR un-bundles four non-channel bootstrap jobs (Composio integration sync, workspace memory-source periodic sync, orchestration message drain supervisor, and Composio source reconcile) from ServiceSet.channels by adding three new concern flags (integrations, memory_sync, orchestration) and a pure bootstrap_job_plan() mapping function. Desktop is byte-identical; headless/none stay job-free.

Correctness

  • The bootstrap_job_plan() flag-to-job mapping is correct: each of the four jobs previously gated by services.channels is now independently gated by the appropriate new flag. The memory_queue and proactive_task_pollers mappings are unchanged.
  • All three presets preserve the exact prior job set: desktop() (all on), headless_api() and none() (all off). Verified by tests.
  • No other site constructs ServiceSet via struct literal, so the new fields cause no downstream compile break.
  • The services.channels field now gates only spawn_channels_service() (the realtime channel listeners), which is the stated intent.

Test coverage (6 new tests in services.rs)

  • desktop_plan_enables_every_job — regression: desktop is byte-identical
  • job_free_presets_enable_nothing — none/headless stay job-free
  • each_concern_flag_enables_exactly_its_job — 3 sub-tests, single-flag independence from none()
  • disabling_one_concern_disables_only_its_job — 3 sub-tests, single-flag isolation from desktop()
  • channels_flag_gates_no_bootstrap_job — explicit #5028 regression: channels alone enables zero sync jobs; channels=false with new flags on loses nothing
  • Extended boot_jobs_are_independent_from_runtime_service_flags in builder.rs for all three presets

CI

  • All checks green including PR CI Gate, Rust Feature-Gate Smoke (gates off), Rust Core Coverage, Rust Quality (fmt, clippy), Feature Forwarding Gate.
  • CI Lite diff adds core::runtime:: to the gates-off cargo test filter and core/runtime/services.rs to the gated-test allowlist — both correct and minimal.

Observations (non-blocking)

  • Pre-existing concern: spawn_channels_service() -> start_channels() still calls composio::start_periodic_sync(), task_sources::start_periodic_poll(), and start_board_poller() directly (startup.rs:184-192), bypassing the new flags. This is documented, idempotent (no-op without active Composio connections), and out of scope for this un-bundle PR. A channels-on host that wants integrations off still sees the redundant idle ticks. Worth a follow-up to thread ServiceSet into start_channels() so the flags control all paths uniformly. The unresolved Codex review thread on this issue is acknowledged.

@senamakel
senamakel merged commit e780277 into tinyhumansai:main Jul 23, 2026
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Net-new user-facing capability or product behavior. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ServiceSet::channels bundles non-channel bootstrap jobs (composio sync, memory sync, orchestration drain)

2 participants