openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Triage request: 5 issues surfaced by remote-core attach-mode investigation (attach-mode silent, daemonlifecycle recurrence, configPersistence printer, cross-host path leak, active-user re-resolution)

Open leighstillard opened this issue 6 months ago • 9 comments

Summary

While trying to get a Windows desktop client (0.54.0) to attach to a remote openhuman-core over a private network, a multi-layer diagnostic surfaced five distinct issues. Filing as a single triage ask so a maintainer can split / prioritize / dedupe before any of them get worked on. I'm volunteering to take #A first if the maintainers concur, but want input before opening PRs.

Diagnostic context: Windows 0.54.0 installed via MSI, launched via openhuman://auth/?token=... deep link after web sign-in. Remote Linux openhuman-core 0.54.0 running with OPENHUMAN_CORE_HOST=0.0.0.0 OPENHUMAN_CORE_PORT=4000 on a Tailscale-only host. Bundle id on Windows is com.openhuman.app; logs live at %USERPROFILE%\.openhuman\logs\openhuman.<date>.log (Rust shell, sparse — only [app-update] heartbeats) and %USERPROFILE%\.openhuman\users\local\cef\chrome_debug.log (CEF renderer, 44 MB / 31 h session, all real activity).


A. Attach mode is silently inoperative when the app is launched via deep link

Severity: high — the entire "remote core" capability is unreachable for normal users.

Attach mode is configured only via env vars (OPENHUMAN_CORE_REUSE_EXISTING, OPENHUMAN_CORE_URL, OPENHUMAN_CORE_TOKEN). On Windows, the standard launch path is the Start Menu shortcut (no Arguments, no env) and the deep-link handler (openhuman://auth/... → invoked via DCOM/explorer, inherits the explorer.exe environment). Neither path can carry those env vars, so the app falls back to spawning its own in-process core regardless of what the user thinks they configured. There is no UI affordance to point at a remote core URL, no obvious failure mode in the renderer, and the renderer log doesn't reference attach state at all.

Confirmed in the diagnostic: [Environment]::GetEnvironmentVariables at User and Machine scope contain none of those names; the Start Menu shortcut has zero arguments and zero env; the running process was launched via deep link from explorer.

Proposal — discussion before code: make remote-core URL + token a first-class persisted setting (Settings → Advanced → Core), with an explicit "use remote core" toggle, plus a visible status indicator in the UI ("connected to remote core at … as user …"). Env vars stay as an override for dev. Possibly add a one-shot import command (openhuman://attach?url=…&token=…) so a user on the headless server can copy a single URL into the desktop to wire it.

B. [configPersistence] Stored RPC URL: [object Object] printer bug

Severity: low; impedes self-diagnosis.

At renderer init, configPersistence logs Stored RPC URL: [object Object] instead of the URL string. Almost certainly logging the wrapper object instead of .url. Trivial fix; mostly worth filing because it actively hid the cause of (A) in user-reported logs.

C. DaemonLifecycle setup/teardown loop has returned post-#2151

Severity: medium — sustained log spam and CPU; masks real lifecycle transitions.

Same symptom as issue #2151 (closed): [DaemonLifecycle] Setting up daemon lifecycle management / Cleaning up daemon lifecycle management alternating continuously, with [analytics] GA consent updated: enabled=true firing on each cycle. On the current Windows 0.54.0 session: 105,704 setup / 105,702 teardown / 52,831 GA-consent lines in 31 hours, i.e. one full cycle every ~1 s, indefinitely. Suggests the original fix did not hold (or the regression came in on a different code path). Worth either reopening #2151 or filing a fresh issue cross-referencing it.

D. Linux paths leak into Windows config (/home/leigh/OHvault on a Windows host)

Severity: high — cross-host config corruption.

Windows renderer log:

[ui-flow][vault-panel] create failed CoreRpcError: root_path is not a directory: /home/leigh/OHvault

That's a Linux absolute path being used as a vault root_path on a Windows machine. Either configPersistence is syncing filesystem paths across hosts via the backend without per-host scoping, or the backend stores absolute paths verbatim and replays them. Either way, any user who runs OpenHuman on more than one OS will hit this.

Proposal — discussion before code: filesystem paths should never be cloud-synced unscoped. Either store paths in a per-host bucket keyed by host id, or refuse to round-trip filesystem paths from the backend at all and treat them as device-local settings.

E. Active-user not re-resolved by long-running subsystems after store_session

Severity: medium — silent data fragmentation across user dirs.

On the Linux box, the openhuman-core process was started before any user had logged in. It opened its memory DB at ~/.openhuman/users/local/workspace/memory/memory.db and its CEF/etc. profiles under users/local/. Later, a sign-in over RPC triggered credentials::ops::store_session, which wrote ~/.openhuman/active_user.toml and created ~/.openhuman/users/<user_id>/. But the running process's open file handles never migrated — lsof / /proc/<pid>/fd still showed every DB under users/local/. config::schema::load::resolve_config_dirs only reads active_user.toml on each Config::load; long-lived subsystems (memory, channel runtime, scheduler) hold cached Config snapshots from startup and never re-resolve.

Effect: after first login, the user's data continues writing to users/local/, while a fresh restart would correctly route to users/<user_id>/. Telegram channel config saved post-login would land in a place the running core no longer reads. (Reported repro is fragile because most users restart soon after login; the bug only becomes visible on a long-lived headless deployment.)

Proposal — discussion before code: store_session should either (1) trigger a controlled subsystem reload (memory pool re-open, channel runtime restart, scheduler re-bind) against the new user dir, or (2) explicitly require a process restart and surface that requirement in the response. Quietly continuing on the wrong user dir is the worst of both worlds.


Triage ask

I would like maintainer input on:

  1. Should these be five separate issues or stay consolidated? I'll split if preferred.
  2. Priority order from the maintainers' perspective. From a user POV my order is A > E > D > C > B but maintainers may weigh differently.
  3. Should #C be a reopen of #2151 or a fresh issue?
  4. For #A specifically: is the desired direction "first-class remote-core setting in the UI", or is attach mode intended to remain a dev/internal capability? That decision changes the scope significantly.

I'm prepared to start on #A as soon as direction is agreed. Will not open PRs on #B–#E without explicit go-ahead.

Related

  • Issue #2151 (closed) — Daemon lifecycle loops between setup and cleanup. Symptom recurs as described in #C above.
  • PR #2266 (merged) — fix(security): replace wildcard CORS on core RPC with origin allowlist. Same investigation thread; this triage is the next pass.

Full Windows diagnostic transcript

Raw output from Windows-side diagnostic (CEF process tree, renderer log patterns, registry, env)
  • App install: C:\Users\leigh\AppData\Local\OpenHuman\OpenHuman.exe, ProductVersion 0.54.0, bundle id com.openhuman.app.
  • Logs: %USERPROFILE%\.openhuman\logs\openhuman.<date>.log (Rust shell, sparse) + %USERPROFILE%\.openhuman\users\local\cef\chrome_debug.log (44.5 MB renderer console).
  • Renderer pattern counts (31 h session): DaemonLifecycle 210,932 · [analytics] GA consent 52,831 · telegram / channels_config / store_session / attach / core_rpc / OPENHUMAN_CORE 0 · [core-state] poll failed 42 · auth_get_me timed out 30000 ms (repeated) · composio_list_connections → 502 Bad Gateway from api.tinyhumans.ai.
  • Startup excerpt:
    12:49:29 [cef-profile] honoring pre-set OPENHUMAN_CEF_CACHE_PATH=C:\Users\leigh\.openhuman\users\local\cef
    12:49:29 [webview_apis] server listening on 127.0.0.1:54216
    12:49:29 [tray] tray icon ready
    12:49:29 [analytics] GA initialized [object Object]
    12:49:29 [configPersistence] Stored RPC URL: [object Object]
    12:49:29 [memory] syncMemoryClientToken: entry (token_present=%s, is_tauri=%s) true true
    12:49:29 [memory] syncMemoryClientToken: payload → memory.init (local-only)
    12:49:29 [onboarding-gate] redirecting / -> /onboarding (onboarding incomplete)
    
  • URL scheme: HKCR/HKCU openhuman both present, point at the installed exe; deep-link launch works.
  • Process: main PID launched via openhuman://auth/?token=<JWT> (userId 6a0d…, iat 2026-05-19, exp 2026-08-17). Parent PID was explorer/DCOM (already gone). CEF remote debugging is live on 127.0.0.1:19222 and the webview_apis bridge on 127.0.0.1:54216.
  • Env vars OPENHUMAN_CORE_REUSE_EXISTING, OPENHUMAN_CORE_URL, OPENHUMAN_CORE_TOKEN are absent at both User and Machine scope; the Start Menu shortcut has no Arguments and no environment block.

leighstillard avatar May 21 '26 10:05 leighstillard

Concrete evidence for E (active-user not re-resolved after store_session)

Pulled /proc/<pid>/fd on a running openhuman-core on Linux (v0.54.0, started pre-login, signed in afterwards via the desktop). The process now holds two memory DBs open in parallel:

13 -> /home/leigh/.openhuman/users/local/workspace/memory/memory.db
14 -> /home/leigh/.openhuman/users/local/workspace/memory/memory.db-wal
15 -> /home/leigh/.openhuman/users/local/workspace/memory/memory.db-shm
26 -> /home/leigh/.openhuman/users/6a0d1e3731708656b3875ed2/workspace/memory/memory.db
29 -> /home/leigh/.openhuman/users/6a0d1e3731708656b3875ed2/workspace/memory/memory.db-shm
31 -> /home/leigh/.openhuman/users/6a0d1e3731708656b3875ed2/workspace/memory/memory.db
32 -> /home/leigh/.openhuman/users/6a0d1e3731708656b3875ed2/workspace/memory/memory.db-wal

So on login store_session did trigger something to open the new user dir (good — partial re-resolution exists), but the pre-login users/local/ handles were never closed. Net effect: writes can race / split across two databases, depending on which subsystem cached which Config snapshot. This is worse than "pinned to local forever" — it's silent data fragmentation.

The users/6a0d…/workspace/ tree also shows recent activity (memory_tree/ mtime 11:07 today, whatsapp_data/ mtime 10:31 today), so the auth'd user dir is being written to as well. Confirms the split is live, not just a stale handle.

Suggests two distinct fixes for E rather than one:

  1. Close the pre-login handles when transitioning local → user, not just open new ones.
  2. Audit which subsystems re-resolved and which didn't — three handles on local vs four on the auth'd user implies an inconsistent migration, not a clean swap.

I'll keep this branch parked until maintainer direction lands on the priority/scope question above.

leighstillard avatar May 21 '26 11:05 leighstillard

Two smaller observations from a Slack-sync session, raising as a separate comment so they don't get conflated with E

While diagnosing a [composio:slack] daily request budget exhausted log line, two adjacent annoyances surfaced. Posting for visibility — not asking either to be in scope for the triage, just noting them in case maintainers want to spin separate issues.

F. The interval-vs-budget ratio is unreachable from config.

  • DEFAULT_DAILY_REQUEST_LIMIT = 500 (src/openhuman/composio/providers/sync_state.rs:32)
  • Slack SYNC_INTERVAL_SECS = 15 * 60 (src/openhuman/composio/providers/slack/provider.rs:104)

Neither is exposed as an env var, RPC, or config field. The provider records requests at five separate call sites per sync, so any moderately-active Slack workspace burns ≥10/tick × 96 ticks/day ≫ 500 budget → guaranteed mid-day exhaustion on day one, every day. There's no way to widen the budget or slow the interval without recompiling. Either field would be a one-line addition to ChannelsConfig (or a new ComposioConfig section).

G. No "budget reset" log line at date rollover.

There's the daily request budget exhausted, skipping sync log (slack/provider.rs:406, plus the identical lines in gmail/provider.rs:235, notion/provider.rs:161, clickup/provider.rs:169), but no symmetric "budget reset, N requests available" line when today_str() changes inside DailyBudget::record_requests (sync_state.rs:129–136). Hard to tell from logs alone whether sync actually resumed the next day vs is still wedged on yesterday's is_exhausted() == true cached read. Tiny instrumentation gap; a one-line tracing::info! in the reset branch would fix it.

Both are low-priority. If maintainers want them split out as issues I'm happy to. F probably wants design input (where in config does it belong, does it get a per-provider override, etc.); G is essentially a one-liner.

leighstillard avatar May 21 '26 11:05 leighstillard

I checked the current main branch (de2a78a) against item G from the Slack-sync follow-up. This still reproduces from source:

  • DailyBudget::record_requests resets a stale budget date back to today and clears requests_used before recording new requests.
  • The provider paths log when the daily request budget is exhausted, but the rollover branch itself does not emit a corresponding reset/resume log.
  • That means logs can show daily request budget exhausted, skipping sync without a clear later signal that the next UTC day reopened the budget.

I did not find an open PR covering this small instrumentation gap. If maintainers are okay with it, I’m going to take a narrowly scoped pass for item G only: add a non-sensitive reset log around the rollover branch and keep the broader attach-mode / config / lifecycle questions out of scope.

sunilkumarvalmiki avatar May 26 '26 08:05 sunilkumarvalmiki

Follow-up for item G: PR #2672 is open with the scoped fix.

What changed:

  • DailyBudget::record_requests now logs [composio:sync-state] daily request budget reset when the stored budget date rolls over to the current UTC day.
  • The log includes only non-sensitive counters/date fields: old_date, new_date, requests_used, and limit.
  • No budget math, persistence schema, provider scheduling, or dispatch behavior changed.

Validation:

  • cargo fmt --manifest-path Cargo.toml --check passed.
  • cargo test --manifest-path Cargo.toml --lib sync_state::tests passed: 13 tests.
  • The broader non---lib Cargo invocation hit unrelated existing integration/bin compile issues before this test surface; details are in the PR validation notes.

PR: #2672

sunilkumarvalmiki avatar May 26 '26 09:05 sunilkumarvalmiki

Item B (the [configPersistence] Stored RPC URL: [object Object] printer bug) is already fixed on main — commit 3e22ffee shipped via PR #2480 ("fix(app): normalize cloud core RPC URLs") on 2026-05-22, one day after this triage was filed.

The original call site (introduced in #948) used:

console.debug('[configPersistence] Stored RPC URL:', { url: url.trim() });

which the CEF renderer's console.debug formatter stringified as [object Object] in the log file. The current code at app/src/utils/configPersistence.ts:96 is:

log('Stored RPC URL: %s', redactRpcUrlForLog(normalized));

which routes through the debug package with an explicit %s placeholder and a string argument — no more [object Object], and the URL is also PII-redacted now.

The 0.54.0 install reproducing this is on a release cut from before #2480 landed, so a fresh build from current main (or the next public release that includes #2480) should resolve B without further code work.

Leaving the other items (A / C / D / E / F) untouched per your "no PRs without explicit go-ahead" note.

YOMXXX avatar May 29 '26 08:05 YOMXXX

Triage note for item B ([configPersistence] Stored RPC URL: [object Object] printer): this was already fixed by PR #2459 — fix(config): log RPC URL and core mode as strings, not object wrappers (commit 333bd528). app/src/utils/configPersistence.ts:96 now uses redactRpcUrlForLog(normalized) (string return, %s-formatted).

Items A, C, D, E look like they're still open. Happy to defer to @leighstillard on the order they get split / picked up.

hemanth1999k avatar May 30 '26 21:05 hemanth1999k

Status summary (audit against current main, 2026-06-14)

Walked each item against main to figure out whether this triage can be closed. Net: A, C, and parts of E are still open — the rest has shipped. Suggest splitting the open items into focused follow-ups before closing this one.

Item Status Reference
A — Attach mode silently inoperative when launched via deep link (no UI for remote-core URL/token) ❌ Open No PR found. Env-var-only configuration is still the only path; no Settings → Advanced → Core UI, no openhuman://attach?url=…&token=… import command, no visible status indicator.
B — [configPersistence] Stored RPC URL: [object Object] printer ✅ Fixed #2438, #2459, #2480
C — DaemonLifecycle setup/teardown loop returned post-#2151 ⚠️ Unconfirmed #2177 ("stabilize daemon lifecycle setup") merged 2026-05-20, one day before this triage was filed against 0.54.0. Whether the in-the-wild recurrence reproduces on a build that includes #2177 isn't established in this thread. Worth a retest on a current build before closing.
D — Linux paths leak into Windows config (/home/leigh/OHvault) ✅ Fixed #2445 — vault rows now carry host_os, list/get/files surfaces filter cross-host rows and legacy cross-platform path shapes.
E — Active-user not re-resolved by long-running subsystems after store_session ⚠️ Partial #2445 rebinds the global MemoryClient and the conversation persistence subscriber after login. The original report named memory + channel runtime + scheduler as cached-Config holders — only memory + conversation persistence got the rebind. Channel runtime and scheduler re-resolution remain unaddressed.
F — DAILY_REQUEST_LIMIT / SYNC_INTERVAL_SECS unconfigurable ✅ Fixed #3314
G — No "budget reset" log at date rollover ✅ Fixed #2672

Recommendation

Keep #2437 open until A/C/E are split out. Concretely:

  • A — file a fresh issue: "First-class remote-core URL/token setting + status indicator", carrying forward the proposal in this triage. Needs maintainer direction on whether attach mode is intended as a user-facing feature or dev-only before code lands.
  • C — comment on this issue (or open a fresh one) asking @leighstillard to retest on a main build that includes #2177. If the loop persists, that's a fresh regression; if not, this item closes.
  • E — file a follow-up: "Re-resolve active-user Config in channel runtime + scheduler after store_session", referencing #2445 as the memory/conversation-persistence half of the fix.

Once those three are tracked separately and B/D/F/G are confirmed in the next release the reporter installs, this triage can be closed cleanly.

CodeGhost21 avatar Jun 13 '26 19:06 CodeGhost21

Triage split done. Re-verified the items against current main:

  • A (attach-mode remote-core unreachable via deep link) — split to #4396. Open; needs product direction (first-class setting vs dev-only). No code yet.
  • B (Stored RPC URL: [object Object] log) — resolved on main: app/src/utils/configPersistence.ts now logs redactRpcUrlForLog(normalized) (a redacted string), not the wrapper object.
  • C (DaemonLifecycle setup/teardown loop recurrence) — split to #4397. Needs retest on a build incl. #2177 before any change.
  • D (Linux vault paths leak into Windows config) — reported as handled previously; not re-opened here.
  • E (active-user not re-resolved after store_session) — split to #4398. This is the concrete coding follow-up: store_session_inner already rebinds memory + conversation persistence (#2445), but channel runtime (channels::runtime::startup::start_channels) and scheduler (cron::scheduler::run) still hold their startup Config snapshot and keep writing under users/local/. Implementing E now.

Splitting per the triage ask so each can be prioritized independently.

M3gA-Mind avatar Jul 01 '26 20:07 M3gA-Mind

Automated triage: closing as completed.

This triage issue surfaced 5+2 sub-items from a remote-core attach-mode investigation. All have been resolved:

  • A (attach mode silently inoperative via deep link) — split to #4396, now CLOSED.
  • B ([configPersistence] Stored RPC URL: [object Object] printer) — FIXED by #2438, #2459, #2480 (confirmed in comments).
  • C (DaemonLifecycle setup/teardown loop recurrence) — split to #4397, now CLOSED.
  • D (Linux vault paths leak into Windows config) — FIXED by #2445 (confirmed in comments).
  • E (active-user not re-resolved after store_session) — split to #4398, now CLOSED.
  • F (DAILY_REQUEST_LIMIT/SYNC_INTERVAL_SECS unconfigurable) — FIXED by #3314 (confirmed in comments).
  • G (no budget reset log at date rollover) — FIXED by #2672 (confirmed in comments).

The triage served its purpose: each issue was identified, tracked, and resolved or split into scoped follow-ups that have since been closed. Reopen if any of the resolved items re-surface with evidence on a current build.

senamakel avatar Jul 23 '26 12:07 senamakel