Skip to content

Re-resolve active-user Config in channel runtime + scheduler after store_session (from #2437-E) #4398

Description

@M3gA-Mind

Split from the #2437 triage meta-issue (item E). The one concrete coding follow-up. Mirrors the memory/conversation rebind already done in #2445.

Problem

When openhuman-core starts before any user has logged in, it opens its DBs/profiles under ~/.openhuman/users/local/. A later sign-in over RPC calls credentials::ops::store_session, which writes ~/.openhuman/active_user.toml and creates ~/.openhuman/users/<user_id>/. But long-lived subsystems hold a cached Config snapshot from startup and never re-resolve, so they keep writing under users/local/ until a process restart. config::schema::load::resolve_config_dirs only reads active_user.toml on each Config::load.

Current state (verified on main)

store_session_inner (src/openhuman/credentials/ops.rs, ~L426-439) already rebinds after activation:

  • memory → memory::global::init(effective_config.workspace_dir)
  • conversation persistence → register_conversation_persistence_subscriber(...)

Not rebound (this issue):

  • Channel runtimechannels::runtime::startup::start_channels(config: Config) (src/openhuman/channels/runtime/startup.rs:80) captures config.workspace_dir at boot into many long-lived holders; started once, never re-resolved on login.
  • Schedulercron::scheduler::run(config: Config) (src/openhuman/cron/scheduler.rs:164), started via scheduler::start(config) (src/openhuman/memory_queue/worker.rs:265); ops read config.workspace_dir (cron/ops.rs:111,175). At login store_session_inner only calls scheduler_gate::set_signed_out(false) (un-pause) — it does not rebind the workspace.

Fix direction

Add a workspace re-resolve/restart seam to the channel runtime and the scheduler, invoked from store_session_inner's rebind block against effective_config.workspace_dir — mirroring the memory rebind. Both subsystems are currently "start-once with a Config snapshot" and need a restart/re-bind entry point added.

Acceptance

  • After first login on a long-lived (pre-login-started) core, channel config and scheduled jobs route to users/<user_id>/, not users/local/.
  • Regression test asserting channel-runtime + scheduler re-resolve to the new workspace after store_session.

Ref: #2437 (parent triage), #2445 (memory/conversation rebind precedent).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions