Skip to content

feat(core): add pluggable core runtime and fleet host#4791

Merged
senamakel merged 29 commits into
tinyhumansai:mainfrom
senamakel:docs/pluggable-core-plan
Jul 12, 2026
Merged

feat(core): add pluggable core runtime and fleet host#4791
senamakel merged 29 commits into
tinyhumansai:mainfrom
senamakel:docs/pluggable-core-plan

Conversation

@senamakel

@senamakel senamakel commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Introduces the embeddable CoreBuilder / CoreRuntime API with explicit ServiceSet controls.
  • Adds task-local CoreContext isolation and the first workspace-scoped people store.
  • Adds the openhuman-fleet process-per-user supervisor and authenticated reverse proxy.
  • Gates legacy bootstrap jobs by the selected services and preserves degraded startup when workspace configuration is unavailable.
  • Documents the staged pluggable-core and fleet architecture plan.

Problem

  • The core startup path coupled controller registration, global state, transports, and background services, which prevented clean in-process embedding and safe per-tenant isolation.
  • Fleet hosting also needed authenticated readiness and secure operator-token handoff without exposing tenant credentials.

Solution

  • Adds a staged runtime API that separates initialization from serving and makes background services explicit.
  • Carries workspace identity through CoreContext, scopes people-store access per context, and fails workspace-bound operations clearly in degraded mode.
  • Collapses controller registration to one registry source and removes the legacy dispatch tier.
  • Implements a fleet supervisor with authenticated probes, secure token delivery, and per-user routing.
  • Retains legacy desktop behavior through the desktop ServiceSet while allowing headless and harness-only embeddings to avoid detached bootstrap jobs.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage >= 80% - CI coverage gate is authoritative; focused runtime tests passed locally.
  • N/A: architecture/runtime refactor does not add or rename a user-facing coverage-matrix feature row.
  • N/A: no affected feature IDs because this is an architecture/runtime refactor.
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • N/A: no release manual smoke surface changed.
  • N/A: no linked issue was provided for this branch.

Impact

  • Desktop keeps its existing service selection and startup behavior.
  • CLI and embedders gain explicit transport/background-service control.
  • Fleet mode adds a new hosting binary and authenticated tenant routing.
  • Workspace configuration failures preserve core availability while workspace-bound store calls return a clear error.

Related

  • Closes: N/A - no linked issue provided.
  • Follow-up PR(s)/TODOs: remaining staged work is tracked in docs/plans/pluggable-core/.

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

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: docs/pluggable-core-plan
  • Commit SHA: 9d699e61b

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: cargo test --manifest-path Cargo.toml bootstrap_background_jobs_follow_background_service_flags; cargo test --manifest-path Cargo.toml --lib degraded_context_rejects_workspace_bound_stores
  • Rust fmt/check (if changed): cargo fmt --check --manifest-path Cargo.toml; cargo check --manifest-path Cargo.toml
  • Tauri fmt/check (if changed): pre-push pnpm rust:check

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: make core initialization embeddable and service-selectable while adding isolated fleet hosting.
  • User-visible effect: no intended desktop regression; headless runtimes can omit background jobs, and degraded workspace startup reports scoped store errors.

Parity Contract

  • Legacy behavior preserved: desktop selects the complete service set and retains controller, socket, and background worker startup.
  • Guard/fallback/dispatch parity checks: registry, ServiceSet, context isolation, degraded-context, fleet authentication, and token handoff tests cover the new boundaries.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): None found for senamakel:docs/pluggable-core-plan.
  • Canonical PR: This PR.
  • Resolution (closed/superseded/updated): N/A

Summary by CodeRabbit

  • New Features
    • Added an embeddable core runtime API for in-process initialization, invocation, and optional headless hosting (no ports bound).
    • Added configurable service presets (including headless/no-background mode).
    • Added openhuman-fleet to supervise per-tenant core processes behind a single token-authenticated JSON-RPC reverse-proxy endpoint.
    • Added a headless embedding example.
  • Documentation
    • Added phased plans for core embedding, context isolation, and fleet hosting.
  • Bug Fixes
    • Improved workspace-scoped isolation (including people store caching) and tightened controller/RPC routing behavior.
  • Tests
    • Updated/expanded validation to match the new runtime and registry behavior.

senamakel added 11 commits July 11, 2026 14:16
…it, drop dead dispatch tier

Pure motion, no behavior change:
- Delete always-None tier-3 dispatch shim (src/rpc/dispatch.rs) and its call site
- Convert src/core/runtime.rs to a directory module
- Extract workspace-bound store init into runtime::context::init_stores
- Extract the four background service spawns into runtime::services::spawn_*

Groundwork for the CoreBuilder/ServiceSet composition in Phase 1.
See docs/plans/pluggable-core/phase-0-defusion.md.

Claude-Session: https://claude.ai/code/session_012NkuU4PTNL7HuUkRodxyxg
Introduce a first-class library API for hosting the core:
- CoreBuilder::build() runs init only (controllers, master key, RPC token,
  workspace stores, bootstrap_core_runtime) — no port bound.
- CoreRuntime::invoke() dispatches RPC in-process; ::serve() binds the HTTP
  listener + spawns ServiceSet-selected background services.
- ServiceSet presets: desktop() / headless_api() / none(); TokenSource:
  Fixed(in-memory handoff) / EnvOrFile.
- run_server_inner is now a thin shim over the builder (behavior-identical:
  ServiceSet::desktop, socketio per flag, legacy embedded_core→HostKind).
- Re-export CoreBuilder/CoreRuntime/ServiceSet/TokenSource/HostKind from lib.rs.
- Add examples/embed_headless.rs (library embedding via ServiceSet::none()).

The Tauri shell and CLI keep calling run_server_embedded_with_ready /
run_server, which now route through the builder, so all hosts share one path.
See docs/plans/pluggable-core/phase-1-corebuilder.md.

Claude-Session: https://claude.ai/code/session_012NkuU4PTNL7HuUkRodxyxg
Introduce CoreContext, which owns the load-bearing init order (controllers,
master key, RPC bearer, workspace stores, bootstrap_core_runtime) previously
inlined in CoreBuilder::build. CoreRuntime now holds an Arc<CoreContext> and
exposes it via .context() (host_kind + resolved workspace_dir accessors).

Stage A is a facade: store init still targets process globals. This centralizes
the sequence as the seam for Stage B (handler-threaded context) and per-context
stores. See docs/plans/pluggable-core/phase-2-corecontext.md.

Claude-Session: https://claude.ai/code/session_012NkuU4PTNL7HuUkRodxyxg
…, single-source schemas

Stage B goal (handlers reach a per-dispatch CoreContext) via a tokio task_local
ambient context instead of a 846-site fn-pointer signature sweep:
- CoreContext::init registers the first context as the process DEFAULT_CONTEXT.
- try_invoke_registered_rpc scopes each handler future to CoreContext::current()
  (active scope if any, else default); handlers read it via CoreContext::current().
- Controller handlers stay bare fn pointers — zero per-handler churn.
- Tests assert the isolation primitive (scope_sets_current_context,
  nested_scope_overrides_then_restores) — the Phase 3 exit-criterion mechanism.
- Re-box the scoped future + raise recursion_limit to 256 (deep axum→tinyagents
  Send auto-trait solving overflowed with the extra future layer).

Registry collapse (drift-elimination half):
- all_controller_schemas() now derives from the registered controllers; the
  parallel build_declared_controller_schemas() and validate_registry's
  declared-vs-registered cross-check are deleted (drift impossible by
  construction). Duplicate/empty/required-input checks retained. Obsolete drift
  tests removed.

Rationale for the deviation from the plan's explicit-signature sweep is recorded
in docs/plans/pluggable-core/phase-2-corecontext.md. Store-trait per-domain
migration (2.c) remains the incremental follow-up.

Claude-Session: https://claude.ai/code/session_012NkuU4PTNL7HuUkRodxyxg
…r + reverse proxy

New self-contained binary (src/bin/fleet.rs, [[bin]] openhuman-fleet) that hosts
one openhuman-core per user and fronts them behind one endpoint — the 'manage
teams' host. Separate compile target: zero weight on the desktop/lib build.

- Process-per-user: spawns 'openhuman-core run --jsonrpc-only' per tenant with a
  per-user OPENHUMAN_WORKSPACE + minted OPENHUMAN_CORE_TOKEN + channel listeners
  off (the ServiceSet::headless_api shape from Phase 1); waits on /health.
- Reverse proxy: axum POST /{user_id}/rpc forwards the JSON-RPC body verbatim to
  the tenant core, swapping the client edge token for the tenant core bearer —
  wire contract unchanged, so CloudHttpTransport works against the fleet URL.
- Isolation: distinct EdgeToken (client) vs CoreBearer (fleet-only); proxy
  rejects token/path-user mismatch; user ids validated as safe path segments.
- 7 unit tests over the pure logic (ports, workspace derivation, id validation,
  provisioning, edge-token round-trip, bearer parsing) — all green.

MVP vs production follow-ups (sequential ports, backend membership sync, admin
API for tokens, Docker packaging) documented in
docs/plans/pluggable-core/phase-4-fleet-host.md.

Claude-Session: https://claude.ai/code/session_012NkuU4PTNL7HuUkRodxyxg
…le) + isolation test

Turn the ambient-context mechanism into real cross-context isolation for the
first domain:
- people::store::for_workspace(dir) opens/caches a PeopleStore per workspace
  (distinct from the single active-user GLOBAL slot), so multiple workspaces'
  stores coexist in one process.
- CoreContext::people() resolves the store for the context's workspace —
  additive alongside the legacy people::store::get(), so the ~40 existing people
  handlers are untouched and migrate to CoreContext::current()?.people()
  incrementally.
- Exit test people_store_is_isolated_per_context_workspace: two contexts over
  distinct workspaces resolve isolated stores; one context resolves the same
  cached store. Realizes the Phase 3 exit criterion for the first domain.

Remaining domains (memory/config/attachments) + RPC_TOKEN/subscriber relocation
tracked in docs/plans/pluggable-core/phase-3-multi-context.md.

Claude-Session: https://claude.ai/code/session_012NkuU4PTNL7HuUkRodxyxg
…tiple packages

This commit updates the Cargo.lock file to replace instances of windows-sys version 0.61.2 and 0.59.0 with 0.60.2, ensuring compatibility and stability across the project. Additionally, the tinyagents package version is updated from 1.7.1 to 1.8.0.
@senamakel
senamakel requested a review from a team July 11, 2026 23:46
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change adds an embeddable CoreBuilder/CoreRuntime API, context-aware dispatch and workspace stores, extracted runtime services, registry cleanup, a headless embedding example, and an openhuman-fleet supervisor for tenant-scoped JSON-RPC proxying.

Changes

Pluggable core and fleet hosting

Layer / File(s) Summary
Pluggable-core architecture plan
docs/plans/pluggable-core/*
Documents phased builder, context, storage, multi-context, and fleet-hosting designs.
CoreBuilder and CoreRuntime composition
src/core/runtime/*, src/lib.rs, examples/embed_headless.rs
Adds configurable runtime construction, token sources, selectable services, in-process invocation, HTTP serving, and a headless embedding example.
Context initialization and workspace stores
src/core/runtime/context.rs, src/openhuman/people/store.rs, tests/memory_golden_parity_e2e.rs
Adds ambient CoreContext scoping, ordered initialization, workspace-bound store setup, cached per-workspace people stores, and context-based store validation.
Server shim and background services
src/core/cli.rs, src/core/jsonrpc.rs, src/core/runtime/services.rs, src/openhuman/orchestration/ops.rs
Adds headless CLI startup, routes server boot through CoreBuilder, and gates background services through ServiceSet.
Context-aware registry dispatch cleanup
src/core/all.rs, src/core/all_tests.rs, src/core/dispatch.rs, src/rpc/mod.rs
Derives schemas from registered controllers, scopes handler futures with context, removes legacy dispatch fallback, and updates validation tests.
People context migration and test updates
src/openhuman/people/*, tests/raw_coverage/*
Resolves people stores through CoreContext and updates tool-memory store construction.
Fleet provisioning and reverse proxy
Cargo.toml, src/bin/fleet.rs
Registers and implements a fleet binary that provisions tenant cores, performs readiness checks, authenticates edge tokens, and proxies JSON-RPC traffic.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Host
  participant CoreBuilder
  participant CoreContext
  participant CoreRuntime
  participant JSONRPC
  Host->>CoreBuilder: configure services and token
  CoreBuilder->>CoreContext: build()
  CoreContext-->>CoreBuilder: initialized context
  CoreBuilder-->>Host: CoreRuntime
  Host->>CoreRuntime: invoke(method, params)
  CoreRuntime->>JSONRPC: dispatch RPC method
  JSONRPC-->>Host: result
Loading
sequenceDiagram
  participant Client
  participant Fleet
  participant EdgeAuth
  participant TenantCore
  Client->>Fleet: POST tenant RPC request
  Fleet->>EdgeAuth: validate edge bearer
  EdgeAuth-->>Fleet: tenant identity
  Fleet->>TenantCore: forward body with core bearer
  TenantCore-->>Fleet: JSON-RPC response
  Fleet-->>Client: HTTP response
Loading

Possibly related PRs

Suggested labels: feature, rust-core

Poem

I’m a rabbit in a runtime burrow,
Building cores without a furrow.
Tokens hop and tenants fleet,
JSON-RPC makes paths meet.
Context stores stay snug and bright—
I nibble tests and bid goodnight. 🐇

🚥 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 change: a pluggable core runtime plus a fleet host.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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

@coderabbitai coderabbitai Bot added feature Net-new user-facing capability or product behavior. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. labels Jul 11, 2026

@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: ddafc44637

ℹ️ 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 src/bin/fleet.rs
Comment thread src/bin/fleet.rs
Comment thread src/core/runtime/builder.rs Outdated

@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: 17

🤖 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 `@docs/plans/pluggable-core/phase-1-corebuilder.md`:
- Around line 11-17: Update the module-tree fenced code block in the phase-1
core builder plan to declare the text language on its opening fence, preserving
the existing tree content unchanged.
- Around line 21-25: Align the TokenSource documentation with the implemented
API by replacing the planned Env and GeneratedToFile variants with the exposed
EnvOrFile and Fixed variants, while preserving the documented token precedence
and one-time auth::init_rpc_token* initialization behavior.
- Around line 33-41: Update the phase-1 corebuilder guidance to use the
implementation’s actual lifecycle: replace CoreRuntime::start references with
CoreRuntime::serve, and describe readiness as an argument supplied to serve
rather than a CoreBuilder::ready(...) method. Apply the same terminology to the
related examples and consumer instructions, while preserving the documented bind
and readiness timing.

In `@docs/plans/pluggable-core/phase-2-corecontext.md`:
- Around line 119-125: Replace the obsolete old-signature ripgrep check in the
Verification section with validation of the ambient scope at
all::try_invoke_registered_rpc, and require tests that verify
CoreContext::current() propagation through registered RPC invocation.

In `@docs/plans/pluggable-core/phase-4-fleet-host.md`:
- Around line 56-69: Update the architecture diagram’s fenced code block in the
fleet-host plan to specify the text language after the opening fence, preserving
the diagram content unchanged.
- Around line 26-29: Introduce distinct EdgeToken and CoreBearer newtypes, then
replace the raw String representations in EdgeAuth and CoreInstance.core_bearer
and propagate those types through provisioning, lookup, and proxy forwarding.
Add only the conversions or accessors required at external boundaries, ensuring
edge tokens cannot be passed to core-bearer APIs without an explicit conversion.

In `@docs/plans/pluggable-core/README.md`:
- Around line 1-3: Update the status declaration in the Pluggable Core README to
accurately reflect that CoreBuilder, runtime, context, and fleet implementations
already exist, while clearly distinguishing completed work from remaining
planned work.
- Around line 71-84: Update the opening fenced code block in the architecture
overview around CoreBuilder::build and CoreRuntime::start to specify the text
language, preserving the existing diagram content and formatting.
- Around line 160-171: Update the Stage B strategy in the CoreContext plan to
use the implemented ambient task-local context approach instead of adding an
Arc<CoreContext> parameter to ControllerHandler. Remove or revise the associated
plain-function-pointer migration wording, and keep the strategy consistent with
phase-2-corecontext.md as the single authoritative design.

In `@src/bin/fleet.rs`:
- Around line 392-396: Remove the token-printing loop over minted in the daemon
startup flow so bearer credentials are never written to stdout; deliver the edge
tokens only through an authenticated administrative flow or an explicitly
configured restricted secret file.
- Around line 8-15: Update the fleet supervisor and per-tenant core launch flow
around the process-per-user design so each tenant runs under a distinct OS
security identity, such as a dedicated OS user or isolated container, with a
tenant-owned workspace mount. Ensure child processes cannot access other
tenants’ workspaces, and revise the surrounding isolation documentation to
describe the enforced boundary accurately.
- Around line 331-345: Update the tenant startup flow around CoreRuntime::serve
so registration waits for an identity-bearing readiness signal from a healthy
child containing its actual bound port. Use that reported port when constructing
CoreInstance, and only then insert into instances, edge_auth, and minted; ensure
failed spawns or missing/invalid readiness do not leave any tenant registration
behind.
- Around line 201-206: Update the upstream response handling in the match on
upstream so the response created from `(status, bytes).into_response()`
preserves the upstream Content-Type header. Capture the header from resp before
consuming it with resp.bytes().await, then apply it to the returned Axum
response before returning, while keeping the existing status and body behavior
unchanged.
- Around line 245-257: The tenant processes spawned in the Fleet supervisor are
not terminated or removed when the server stops or a child exits. Update the
child process management around the `tokio::process::Command` spawn and the
`Fleet::instances` lifecycle to enable shutdown cleanup via `kill_on_drop(true)`
or explicit kill/wait handling, and remove exited tenants from routing state so
requests are not sent to dead cores.

In `@src/core/runtime/builder.rs`:
- Around line 207-216: Update serve and the background-service helper methods to
accept a child cancellation token, return join handles for every spawned cron,
channel, update, and login-gated task, and retain those handles locally. On
shutdown and before serve returns—including the no-transport path—cancel the
child token and await all handles, ensuring repeated serve calls do not leave
detached or duplicated services.
- Around line 193-199: Update the runtime’s invoke method to execute
jsonrpc::invoke_method inside CoreContext::scope using self.ctx.clone(). Apply
equivalent per-request CoreContext scoping to the HTTP router dispatch so both
RPC entry points use this runtime’s context rather than the global default.

In `@src/core/runtime/context.rs`:
- Around line 109-120: Update the CoreContext initialization flow around
init_stores and Config::load_or_init so configuration is loaded exactly once.
Pass the resulting workspace configuration or resolved path into init_stores,
then reuse that same value for workspace_dir and context construction,
preserving the existing fallback/error behavior consistently.
🪄 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: 777fe9e4-854b-49a1-9d44-c6f45f8cdae3

📥 Commits

Reviewing files that changed from the base of the PR and between a1eb4e5 and ddafc44.

⛔ Files ignored due to path filters (1)
  • app/src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (21)
  • Cargo.toml
  • docs/plans/pluggable-core/README.md
  • docs/plans/pluggable-core/phase-0-defusion.md
  • docs/plans/pluggable-core/phase-1-corebuilder.md
  • docs/plans/pluggable-core/phase-2-corecontext.md
  • docs/plans/pluggable-core/phase-3-multi-context.md
  • docs/plans/pluggable-core/phase-4-fleet-host.md
  • examples/embed_headless.rs
  • src/bin/fleet.rs
  • src/core/all.rs
  • src/core/all_tests.rs
  • src/core/dispatch.rs
  • src/core/jsonrpc.rs
  • src/core/runtime/builder.rs
  • src/core/runtime/context.rs
  • src/core/runtime/mod.rs
  • src/core/runtime/services.rs
  • src/lib.rs
  • src/openhuman/people/store.rs
  • src/rpc/dispatch.rs
  • src/rpc/mod.rs
💤 Files with no reviewable changes (2)
  • src/rpc/dispatch.rs
  • src/rpc/mod.rs

Comment thread docs/plans/pluggable-core/phase-1-corebuilder.md Outdated
Comment thread docs/plans/pluggable-core/phase-1-corebuilder.md
Comment thread docs/plans/pluggable-core/phase-1-corebuilder.md Outdated
Comment thread docs/plans/pluggable-core/phase-2-corecontext.md Outdated
Comment thread docs/plans/pluggable-core/phase-4-fleet-host.md
Comment thread src/bin/fleet.rs
Comment thread src/bin/fleet.rs Outdated
Comment thread src/core/runtime/builder.rs
Comment thread src/core/runtime/builder.rs
Comment thread src/core/runtime/context.rs Outdated

@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: 4

🤖 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/bin/fleet.rs`:
- Around line 358-360: Require edge_token_output in the CLI argument definition
or validate it before any tenants/cores are spawned, so startup fails when no
credential handoff path is provided. Update the edge-token handling around the
existing args.edge_token_output logic to write directly to the required path and
remove the warning-only branch.
- Around line 176-183: Update bearer_from_headers to recognize the Authorization
scheme case-insensitively, accepting “bearer” and “BEARER” while preserving the
existing token trimming and empty-token filtering; add coverage for a lowercase
scheme if tests for this parser exist.
- Around line 427-445: Update the edge-token output handling in the Unix branch
to explicitly set the opened file’s permissions to 0o600 after opening, covering
existing files as well as newly created ones. For the non-Unix branch, add
equivalent restrictive permission/ACL hardening where supported, or fail closed
rather than writing without enforcing private access.

In `@src/core/runtime/context.rs`:
- Around line 117-128: Update the Config::load_or_init error branch in the
context initialization flow to propagate the configuration error instead of
returning default_root_openhuman_dir() as a fallback workspace. Ensure the
surrounding context construction remains fallible so people() cannot open a
store from an unverified path, while preserving the existing diagnostic log.
🪄 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: a4294178-a82c-45a2-805b-a8005b2dcd8c

📥 Commits

Reviewing files that changed from the base of the PR and between ddafc44 and 87dd04f.

📒 Files selected for processing (7)
  • docs/plans/pluggable-core/README.md
  • docs/plans/pluggable-core/phase-1-corebuilder.md
  • docs/plans/pluggable-core/phase-2-corecontext.md
  • docs/plans/pluggable-core/phase-4-fleet-host.md
  • src/bin/fleet.rs
  • src/core/runtime/builder.rs
  • src/core/runtime/context.rs
✅ Files skipped from review due to trivial changes (4)
  • docs/plans/pluggable-core/phase-4-fleet-host.md
  • docs/plans/pluggable-core/phase-1-corebuilder.md
  • docs/plans/pluggable-core/phase-2-corecontext.md
  • docs/plans/pluggable-core/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/runtime/builder.rs

Comment thread src/bin/fleet.rs Outdated
Comment thread src/bin/fleet.rs Outdated
Comment thread src/bin/fleet.rs Outdated
Comment thread src/core/runtime/context.rs

@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: f574fe8650

ℹ️ 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 src/core/runtime/context.rs Outdated
Comment thread src/bin/fleet.rs
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026

@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: 268bcb671f

ℹ️ 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 src/core/runtime/context.rs Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026

@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: 9d699e61bf

ℹ️ 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 src/bin/fleet.rs Outdated
Comment thread src/bin/fleet.rs Outdated

@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: 72dd3ff0d7

ℹ️ 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 src/core/runtime/services.rs Outdated

@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: 7cf59cbf58

ℹ️ 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 src/bin/fleet.rs
Comment thread src/bin/fleet.rs Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026

@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: 4eba1e60aa

ℹ️ 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 src/bin/fleet.rs
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026

@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: 79dd32fb9e

ℹ️ 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 src/core/runtime/context.rs Outdated
Comment thread src/core/runtime/context.rs Outdated

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

🧹 Nitpick comments (2)
src/core/runtime/builder.rs (1)

385-399: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: reuse self.config for shutdown cleanup instead of reloading.

serve() already holds self.config; the shutdown path re-runs Config::load_or_init().await.unwrap_or_default() purely to clean up owned Ollama, which can diverge from the runtime's resolved workspace config. Consider reusing self.config (falling back only when None).

🤖 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/builder.rs` around lines 385 - 399, The shutdown cleanup in
serve() should reuse the already-resolved self.config instead of always calling
Config::load_or_init().await. Pass self.config to shutdown_owned_ollama when
available, and only load the default configuration when self.config is None,
preserving the existing timeout and cleanup behavior.
src/core/jsonrpc.rs (1)

1767-1802: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stale comment now misdescribes a generic function.

The comment block says run_server_inner is now a thin shim over the CoreBuilder/CoreRuntime composition and that it reproduces the legacy behavior exactly: all background services on (ServiceSet::desktop), Socket.IO per the caller flag. That description matches run_server_inner, but it's now attached to run_server_with_services, which is the generic path also used by run_server_headless (ServiceSet::headless_api()) and any other future ServiceSet. Leaving this comment here misleadingly implies the function always uses the desktop service set.

✏️ Suggested comment fix
-    // `run_server_inner` is now a thin shim over the CoreBuilder/CoreRuntime
-    // composition (Phase 1). It reproduces the legacy behavior exactly: all
-    // background services on (`ServiceSet::desktop`), Socket.IO per the caller
-    // flag, and the legacy `embedded_core` → `HostKind` mapping (embedded ==
-    // Tauri shell; standalone splits CLI / Docker via `detect_standalone`).
-    // See `docs/plans/pluggable-core/phase-1-corebuilder.md`.
+    // Shared CoreBuilder/CoreRuntime composition path (Phase 1) used by both
+    // the legacy `run_server_inner` (desktop `ServiceSet`, caller-controlled
+    // Socket.IO) and `run_server_headless` (`ServiceSet::headless_api()`).
+    // Applies the legacy `embedded_core` → `HostKind` mapping (embedded ==
+    // Tauri shell; standalone splits CLI / Docker via `detect_standalone`).
+    // See `docs/plans/pluggable-core/phase-1-corebuilder.md`.
🤖 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/jsonrpc.rs` around lines 1767 - 1802, Update the comment above
run_server_with_services to describe its generic CoreBuilder/CoreRuntime
composition and caller-provided ServiceSet, rather than claiming it always uses
ServiceSet::desktop or legacy Socket.IO behavior. Remove the stale
run_server_inner-specific and desktop-only statements while retaining accurate
context about host-kind and token handling.
🤖 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.

Nitpick comments:
In `@src/core/jsonrpc.rs`:
- Around line 1767-1802: Update the comment above run_server_with_services to
describe its generic CoreBuilder/CoreRuntime composition and caller-provided
ServiceSet, rather than claiming it always uses ServiceSet::desktop or legacy
Socket.IO behavior. Remove the stale run_server_inner-specific and desktop-only
statements while retaining accurate context about host-kind and token handling.

In `@src/core/runtime/builder.rs`:
- Around line 385-399: The shutdown cleanup in serve() should reuse the
already-resolved self.config instead of always calling
Config::load_or_init().await. Pass self.config to shutdown_owned_ollama when
available, and only load the default configuration when self.config is None,
preserving the existing timeout and cleanup behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 905b368d-4e34-4482-b062-f15340cdecba

📥 Commits

Reviewing files that changed from the base of the PR and between fbb1660 and cbf6951.

📒 Files selected for processing (10)
  • src/bin/fleet.rs
  • src/core/cli.rs
  • src/core/jsonrpc.rs
  • src/core/runtime/builder.rs
  • src/core/runtime/context.rs
  • src/core/runtime/services.rs
  • src/openhuman/orchestration/ops.rs
  • src/openhuman/people/schemas.rs
  • src/openhuman/people/tools.rs
  • tests/raw_coverage/memory_threads_raw_coverage_e2e.rs

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026

@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: cbf6951b2a

ℹ️ 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 src/openhuman/people/schemas.rs

@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: 0a9616e411

ℹ️ 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 src/bin/fleet.rs
.arg("--port")
.arg(instance.port.to_string())
.env("OPENHUMAN_WORKSPACE", &instance.workspace_dir)
.env("OPENHUMAN_ACTION_DIR", &instance.action_dir)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Set a tenant-scoped projects root for fleet cores

Fresh evidence after the earlier action-dir fix is that this spawn sets only OPENHUMAN_ACTION_DIR; the child still inherits the supervisor's OPENHUMAN_PROJECTS_DIR/HOME, and SecurityPolicy::from_config always injects default_projects_dir() (~/OpenHuman/projects by default) as a ReadWrite trusted root that bypasses workspace_only. In fleet deployments, agents can therefore use absolute paths under that shared projects root and read/write another tenant's project files despite the per-tenant action dir. Set OPENHUMAN_PROJECTS_DIR per tenant (or disable that default trusted root) when spawning.

Useful? React with 👍 / 👎.

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.

1 participant