Skip to content

perf(core): consolidate boot polls, silence per-snapshot log spam - #5075

Merged
senamakel merged 22 commits into
tinyhumansai:mainfrom
senamakel:chore/app-cleanup
Jul 21, 2026
Merged

perf(core): consolidate boot polls, silence per-snapshot log spam#5075
senamakel merged 22 commits into
tinyhumansai:mainfrom
senamakel:chore/app-cleanup

Conversation

@senamakel

@senamakel senamakel commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Fold component health into app_state_snapshot and delete the separate health_snapshot poller — the daemon-health store now hydrates from the same poll.
  • Drive the local-AI download snackbar off the folded runtime.localAi state: zero inference polls when idle, fast poll only during an active download.
  • Back off the expensive app_state_snapshot poll from a permanent 2s to 5s once booted + authenticated (bootstrapping/unauthenticated stays 2s).
  • Coalesce the StrictMode-doubled harness_init_status boot poll; dedupe/retire redundant health_snapshot pollers.
  • Silence per-boot log spam: change-gate keyring_consent cache init, treat empty OPENHUMAN_SHELL_HIDE_WINDOW as unset, and gate the CEF helper's [cef-helper-*] diagnostic prints behind OPENHUMAN_CEF_HELPER_VERBOSE.

Problem

Boot and steady-state logs were flooded with redundant, high-frequency RPCs and warnings: health_snapshot, app_state_snapshot, and inference_status/inference_downloads_progress each ran on their own 2s pollers (some duplicated across concurrent React mounts), and app_state_snapshot — which rebuilds the runtime snapshot and reloads config + local state (observed up to ~2s) — polled every 2s for the entire session. Each snapshot also re-emitted [keyring_consent] initialize at INFO and an OPENHUMAN_SHELL_HIDE_WINDOW unrecognized value warning (from a bare = env value). The CEF helper printed unconditional [cef-helper-*] lines on every subprocess spawn.

Solution

  • Fold-in over parallel polls. AppStateSnapshot now carries a snake_case health field (health::snapshot()); daemonHealthService becomes an ingestion sink (ingestHealthSnapshot: parse + store update + 30s disconnect watchdog) fed by CoreStateProvider. The snackbar reads runtime.localAi.state to decide when to run its fast poll, so idle issues no inference calls. Older cores that omit health degrade gracefully.
  • Adaptive cadence. app_state_snapshot backs off to 5s once stable; event-driven refreshes (deep-link, settings toggles) still fire immediately.
  • Change-gating + parsing fixes. keyring_consent::initialize writes/logs only on an actual consent transition; empty/whitespace OPENHUMAN_SHELL_HIDE_WINDOW is treated as unset (no warning); the CEF helper's diagnostic prints are gated behind an env flag (silent by default).
  • Concurrency correctness. harness_init_status boot poll is coalesced across StrictMode's double-mount; the worktrees/ gitignore rule was corrected (worktree/*worktrees/*).

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage ≥ 80% — every behavior change ships a matching Vitest/Rust test (daemon ingest, harness-init coalescing, snackbar idle/active, keyring change-gate, env parse, folded-health e2e)
  • N/A: behaviour/perf-only change — no feature rows added/removed in docs/TEST-COVERAGE-MATRIX.md
  • N/A: no matrix feature IDs affected
  • No new external network dependencies introduced (no new network calls; folds/removes existing ones)
  • N/A: no release-cut smoke surface changed (internal polling/logging only)
  • N/A: no tracking issue for this cleanup

Impact

  • Desktop/CLI (Rust core + React shell). Steady-state idle boot noise collapses to a single app_state_snapshot every 5s (now also carrying health + local-AI state); idle inference and standalone health polls are eliminated. No user-facing behavior change; daemon-disconnect detection retains its 30s watchdog. OPENHUMAN_CEF_HELPER_VERBOSE=1 restores the CEF helper traces for debugging.
  • Rust-core + build-affecting: the core must be rebuilt (and the vendored tauri-cli reinstalled for the CEF-helper commit) for the change to take effect in a running app.

Related

  • Closes:
  • Follow-up PR(s)/TODOs: relocate LocalModelDebugPanel's standalone inference poll onto the folded state; consider lowering residual health/app-state RPC logs to DEBUG.

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

Linear Issue

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

Commit & Branch

  • Branch: chore/app-cleanup
  • Commit SHA: dea9ee5

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: Vitest (daemonHealthService, HarnessInitOverlay, LocalAIDownloadSnackbar, CoreStateProvider, App.boot); Rust (keyring_consent::policy, config env_overlay, json_rpc_app_state_snapshot_returns_runtime_shape)
  • Rust fmt/check (if changed): GGML_NATIVE=OFF cargo check --manifest-path Cargo.toml
  • Tauri fmt/check (if changed): pnpm rust:check (via pre-push hook)

Validation Blocked

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

Behavior Changes

  • Intended behavior change: consolidate/retire redundant pollers and silence per-boot log spam; no user-facing feature change.
  • User-visible effect: none functional — quieter logs, lower steady-state CPU; daemon status still updates (from folded health) with the same 30s disconnect watchdog.

Parity Contract

  • Legacy behavior preserved: daemon-health store shape + disconnect semantics unchanged; snackbar UI unchanged; health_snapshot RPC still exists for CLI/other callers.
  • Guard/fallback/dispatch parity checks: older cores lacking the folded health field are ignored gracefully; OPENHUMAN_CEF_HELPER_VERBOSE restores prior verbose output.

Duplicate / Superseded PR Handling

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

Summary by CodeRabbit

  • New Features
    • Added daemon health information (uptime and per-component status) to application status updates.
    • Folded orchestration into the Brain area with legacy deep-link redirects to the new location.
  • Bug Fixes
    • Improved health monitoring by ingesting health updates from application state and using a longer disconnect watchdog window.
    • Prevented duplicate startup initialization requests caused by React StrictMode double-mounting.
    • Improved local AI download snackbar polling to be state-driven and automatically stop when finished.
    • Treat empty/whitespace SHELL_HIDE_WINDOW values as unset, and only update keyring consent when it changes.
  • Tests
    • Expanded coverage for health reporting, orchestration routing, startup overlay behavior, local AI snackbar rendering, and configuration parsing.

senamakel added 12 commits July 21, 2026 11:36
useDaemonHealth mounts in several places at once (SocketProvider via
useDaemonLifecycle; ServiceBlockingGate directly + via useDaemonLifecycle).
setupHealthListener awaited the first poll before assigning pollingIntervalId,
so all concurrent callers raced past the singleton guard and each spawned their
own setInterval — emitting multiple openhuman.health_snapshot RPCs per tick.

Assign the interval id synchronously and reference-count consumers: the shared
loop starts on the first consumer and is torn down only when the last releases,
so one component unmounting can't stop polling for the rest. Adds a regression
test covering concurrent setup and partial release.
LocalAIDownloadSnackbar (mounted app-wide) polled inference_status +
inference_downloads_progress every 2s forever, even with no download active.
Make the poll self-scheduling: 2s while a download is in flight, 15s when idle.
React.StrictMode double-mounts HarnessInitOverlay in dev (effect → cleanup →
effect); each setup fires an immediate poll, booting two harness_init_status
RPCs at the same instant. Coalesce overlapping status fetches onto one in-flight
request (cleared once settled, so ongoing sequential polling is unaffected).
Also guards a genuine remount during the boot window.
…valid

A bare `OPENHUMAN_SHELL_HIDE_WINDOW=` (empty/whitespace-only, common when a
.env or launcher exports the key with no value) fell through to the
"unrecognized value ignored" warn arm and logged a warning on every boot.
Treat an empty value as absent — silently keep the current setting. Extends the
existing env-override test to cover the empty and whitespace-only cases.
…shot log spam

policy::initialize() is documented as a once-at-startup call but is wired into
build_app_state_snapshot, so it runs on every app_state_snapshot RPC — logging
`[keyring_consent] initialize` at INFO each time (several per boot as the
frontend polls the snapshot). Hold the write lock across a compare-and-set and
return early when the persisted consent is unchanged, so it writes + logs only
on a genuine transition. Adds PartialEq/Eq to ConsentPreference and a
change-gating regression test.
Points the tauri-cef submodule at fix/cef-helper-verbose-logging, which gates
the per-subprocess [cef-helper-*] eprintln! traces behind
OPENHUMAN_CEF_HELPER_VERBOSE (silent by default).

Note: takes effect in bundled builds only after reinstalling the vendored
tauri-cli (cargo install --locked --path app/src-tauri/vendor/tauri-cef/crates/tauri-cli).
CoreStateProvider polled the expensive app_state_snapshot RPC every 2s for the
life of the session, only slowing on repeated bootstrap failure. Once booted and
authenticated the snapshot changes rarely and mostly via event-driven refreshes,
so steady state now polls at STABLE_POLL_MS (5s); bootstrapping/unauthenticated
stays at 2s so boot/login transitions still surface promptly.
…lth poll

The frontend ran a second dedicated health_snapshot poller (daemonHealthService)
alongside the app_state_snapshot poll. Fold the core's health snapshot into
app_state_snapshot (new snake_case `health` field) and hydrate the daemon-health
store from that one poll instead:

- core: AppStateSnapshot carries HealthSnapshot; ComponentHealth/HealthSnapshot
  gain Deserialize. json_rpc_e2e asserts the folded health shape.
- frontend: daemonHealthService drops all polling and becomes an ingestion sink
  (ingestHealthSnapshot: parse + store update + 30s disconnect watchdog);
  CoreStateProvider feeds each snapshot's health payload to it; useDaemonHealth
  no longer starts a poll. Older cores that omit `health` degrade gracefully.

Supersedes the earlier health_snapshot poller dedupe (d34101f) — there is now
no separate health poll at all. Regression tests rewritten for the sink API.
…e inference poll

LocalAIDownloadSnackbar polled inference_status + inference_downloads_progress on
its own timer even when idle. inference_status returns the same LocalAiStatus the
app_state_snapshot already carries as runtime.localAi, so detect download activity
from core state instead: when idle the snackbar issues ZERO inference calls; only
once runtime.localAi.state reports loading/downloading/installing does it run the
fast 2s poll for granular progress/speed/ETA (downloads-progress detail the 2-5s
snapshot cadence can't provide), stopping when the download settles.

LocalModelDebugPanel (settings-only, opt-in) keeps its own live poll.
The rule referenced `worktree/*` (singular) but the directory is `worktrees/`,
so local `git worktree` checkouts under worktrees/ were never ignored and
showed as untracked. Match the real directory name; keep the .gitkeep negation.
@senamakel
senamakel requested a review from a team July 21, 2026 09:33
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change embeds daemon health in app-state snapshots, updates frontend polling, coalesces initialization requests, folds orchestration into Brain, adjusts configuration and consent behavior, and updates repository maintenance scripts and references.

Changes

Health and polling flows

Layer / File(s) Summary
Health snapshot contract and watchdog
src/openhuman/health/..., app/src/services/..., tests/json_rpc_e2e.rs
Health is emitted in app-state snapshots, ingested by the daemon service, and covered by watchdog and runtime-shape tests.
Provider ingestion and polling cadence
app/src/providers/CoreStateProvider.tsx, app/src/hooks/useDaemonHealth.ts
Snapshot health is ingested during refreshes, polling uses stable and backoff intervals, and the hook no longer creates a listener.
Initialization and local AI polling
app/src/components/InitProgressScreen/..., app/src/components/LocalAIDownloadSnackbar.tsx, app/src/components/__tests__/LocalAIDownloadSnackbar.test.tsx
Overlapping initialization requests share one promise, while local AI polling follows active core state and cancellable timeouts.

Brain orchestration surface

Layer / File(s) Summary
Embedded orchestration view
app/src/components/orchestration/OrchestrationView.tsx, app/src/components/orchestration/__tests__/...
Orchestration routing, panel selection, access fallbacks, session handling, and nested network navigation are implemented and tested.
Brain routing and legacy redirects
app/src/pages/Brain.tsx, app/src/AppRoutes.tsx, app/src/config/..., app/src/components/settings/..., app/test/e2e/...
The orchestration tab is embedded under Brain, retired routes redirect to Brain query parameters, and navigation expectations are updated.
Orchestration labels and cleanup
app/src/lib/i18n/*, app/src/pages/OrchestrationPage.tsx, app/src/pages/__tests__/OrchestrationPage.test.tsx, app/src/components/orchestration/...
Translation keys and comments are updated, and the former page implementation and tests are removed.

Configuration and repository maintenance

Layer / File(s) Summary
Environment and consent behavior
src/openhuman/config/schema/..., src/openhuman/keyring_consent/...
Unset shell-window values are ignored, consent initialization skips identical values, and KeyringStatus gains equality derives.
Pre-push checks and tracking references
.husky/pre-push, .gitignore, app/src-tauri/vendor/tauri-cef, .github/tauri-cef-expected-sha
Interrupt-aware check execution, ignore rules, and tauri-cef revision references are updated.

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

Sequence Diagram(s)

sequenceDiagram
  participant Brain
  participant OrchestrationView
  participant Browser
  Brain->>OrchestrationView: render orchestration tab
  OrchestrationView->>Browser: read ov, sub, session query parameters
  OrchestrationView->>Browser: update query parameters on navigation
Loading

Possibly related PRs

Suggested labels: rust-core, bug

Suggested reviewers: m3ga-mind

Poem

A rabbit hops through Brain’s bright door,
Health arrives with snapshots galore.
One request serves mounts in flight,
Polling rests when states turn right.
Old routes find their new domain—
“Ship it!” sings the bunny train.

🚥 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 matches the main core polling consolidation and log-noise reduction work in the PR.
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.

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.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

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

ℹ️ 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 app/src/components/LocalAIDownloadSnackbar.tsx 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: 8

🧹 Nitpick comments (1)
app/src/services/daemonHealthService.ts (1)

26-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the required debug diagnostics for the folded-health flow.

  • app/src/services/daemonHealthService.ts#L26-L37: log accepted versus ignored payloads and watchdog re-arms using non-sensitive metadata only.
  • app/src/providers/CoreStateProvider.tsx#L295-L300: log health-ingestion outcomes, including stale-response suppression.
  • app/src/providers/CoreStateProvider.tsx#L540-L555: log the selected polling cadence and its branch reason.

As per coding guidelines, changed TS flows require “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 `@app/src/services/daemonHealthService.ts` around lines 26 - 37, In
app/src/services/daemonHealthService.ts lines 26-37, add non-sensitive,
grep-friendly diagnostics to ingestHealthSnapshot for payload acceptance or
rejection and each watchdog re-arm. In app/src/providers/CoreStateProvider.tsx
lines 295-300, log health-ingestion outcomes and stale-response suppression. In
app/src/providers/CoreStateProvider.tsx lines 540-555, log the selected polling
cadence together with the branch reason, covering the relevant flow transitions
without exposing payload contents.

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 `@app/src-tauri/vendor/tauri-cef`:
- Line 1: Synchronize the tauri-cef submodule pointer with the pin guard by
updating it to SHA 11ef51edbeadcca4517b18a037fff858a5dfae0f, or update the
corresponding expected SHA configuration to match the current pointer; then
rerun the pin-guard checks.

In `@app/src/components/InitProgressScreen/HarnessInitOverlay.tsx`:
- Around line 28-47: Add namespaced, privacy-safe debug diagnostics to both
polling flows: in app/src/components/InitProgressScreen/HarnessInitOverlay.tsx
lines 28-47, log coalesced request creation, in-flight sharing, settlement, and
failure around fetchHarnessInitStatusCoalesced; in
app/src/components/LocalAIDownloadSnackbar.tsx lines 76-118, log activation, RPC
poll results and failures, continuation, cancellation, and timeout scheduling.
Keep logs grep-friendly and avoid sensitive payload data.

In `@app/src/components/LocalAIDownloadSnackbar.tsx`:
- Around line 88-118: The snackbar’s downloading state can remain active after
polling is cancelled when coreDownloadActive becomes false. Update the
isDownloading derivation in LocalAIDownloadSnackbar to require
coreDownloadActive, while preserving the existing detailed status/download
checks when the folded state is active.
- Around line 93-110: Update the poll function in LocalAIDownloadSnackbar so
transient RPC failures continue scheduling retries when coreDownloadActive
remains true, rather than leaving active false. Preserve stopping behavior only
after a successful terminal status/progress response, while keeping cancellation
checks intact.

In `@app/src/providers/CoreStateProvider.tsx`:
- Around line 295-300: The health ingestion in the CoreStateProvider snapshot
refresh must occur only after mount/request freshness validation and committing
the new identity, so stale or invalidated responses cannot update health. Move
the daemonHealthService.ingestHealthSnapshot call after the request-id guard and
identity commit, and pass the incoming snapshot’s resolved user ID so both the
health store update and watchdog use that identity instead of
getCoreStateSnapshot().

In `@app/src/services/coreStateApi.ts`:
- Around line 77-91: Update the component timestamp fields in RawHealthSnapshot
so last_ok and last_error accept string, null, or undefined, matching the
nullable values emitted by the Rust health serialization contract while
preserving their optional status.

In `@src/openhuman/config/schema/load_tests.rs`:
- Around line 238-261: The tests in
src/openhuman/config/schema/load_tests.rs:238-261 must capture tracing output or
inspect parser classification to assert empty and whitespace-only
OPENHUMAN_SHELL_HIDE_WINDOW values emit no warning, not only preserve state. The
repeated-consent test in src/openhuman/keyring_consent/policy.rs:265-292 must
verify no log or cache update occurs on repeated consent, rather than checking
only the final cache value.

In `@src/openhuman/config/schema/load/env_overlay.rs`:
- Around line 124-128: Add stable trace-level events to both intentional no-op
paths: in src/openhuman/config/schema/load/env_overlay.rs lines 124-128, trace
when an empty or whitespace-only shell-window value is treated as absent; in
src/openhuman/keyring_consent/policy.rs lines 27-45, trace when cached consent
remains unchanged. Keep both paths silent at higher log levels and preserve
their existing behavior.

---

Nitpick comments:
In `@app/src/services/daemonHealthService.ts`:
- Around line 26-37: In app/src/services/daemonHealthService.ts lines 26-37, add
non-sensitive, grep-friendly diagnostics to ingestHealthSnapshot for payload
acceptance or rejection and each watchdog re-arm. In
app/src/providers/CoreStateProvider.tsx lines 295-300, log health-ingestion
outcomes and stale-response suppression. In
app/src/providers/CoreStateProvider.tsx lines 540-555, log the selected polling
cadence together with the branch reason, covering the relevant flow transitions
without exposing payload contents.
🪄 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: c0dd43dd-b046-4d69-b05e-8ca1744aa22f

📥 Commits

Reviewing files that changed from the base of the PR and between 00708c3 and dea9ee5.

📒 Files selected for processing (19)
  • .gitignore
  • app/src-tauri/vendor/tauri-cef
  • app/src/components/InitProgressScreen/HarnessInitOverlay.test.tsx
  • app/src/components/InitProgressScreen/HarnessInitOverlay.tsx
  • app/src/components/LocalAIDownloadSnackbar.tsx
  • app/src/components/__tests__/LocalAIDownloadSnackbar.test.tsx
  • app/src/hooks/useDaemonHealth.ts
  • app/src/providers/CoreStateProvider.tsx
  • app/src/services/__tests__/daemonHealthService.test.ts
  • app/src/services/coreStateApi.ts
  • app/src/services/daemonHealthService.ts
  • src/openhuman/app_state/ops.rs
  • src/openhuman/config/schema/load/env_overlay.rs
  • src/openhuman/config/schema/load_tests.rs
  • src/openhuman/health/core.rs
  • src/openhuman/keyring_consent/policy.rs
  • src/openhuman/keyring_consent/types.rs
  • tests/json_rpc_e2e.rs
  • worktrees/.gitkeep

Comment thread app/src-tauri/vendor/tauri-cef
Comment thread app/src/components/InitProgressScreen/HarnessInitOverlay.tsx
Comment thread app/src/components/LocalAIDownloadSnackbar.tsx
Comment thread app/src/components/LocalAIDownloadSnackbar.tsx
Comment thread app/src/providers/CoreStateProvider.tsx
Comment thread app/src/services/coreStateApi.ts
Comment thread src/openhuman/config/schema/load_tests.rs
Comment thread src/openhuman/config/schema/load/env_overlay.rs Outdated
Updates .github/tauri-cef-expected-sha to match the tauri-cef submodule bump
(11ef51ed), which gates the CEF helper's per-subprocess diagnostic prints behind
OPENHUMAN_CEF_HELPER_VERBOSE. 11ef51ed is a direct child of the prior pin
5ec3d883, so the Linux AppImage glibc/NSS library-exclusion fixes the pin guards
(tinyhumansai#1996, tinyhumansai#2032, tinyhumansai#2154/tinyhumansai#2088) are preserved. Submodule commit pushed to
tinyhumansai/tauri-cef (branch fix/cef-helper-verbose-logging) so CI can resolve
the pin.

@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: 758694bc42

ℹ️ 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 app/src/components/LocalAIDownloadSnackbar.tsx
Comment thread app/src/providers/CoreStateProvider.tsx Outdated
- LocalAIDownloadSnackbar: gate isDownloading on coreDownloadActive so a
  download the core no longer reports active can't leave the overlay stuck
  visible; on a transient poll error keep retrying while core state is active
  (previously one blip permanently stopped progress polling for the download).
- CoreStateProvider: ingest folded health AFTER the snapshot is committed and
  only when the refresh is still current, so daemon health is written under the
  freshly-committed identity, not a stale/pre-commit/superseded token.
- coreStateApi: type health last_ok/last_error as string | null to match the
  Rust Option<String> wire contract.
- keyring_consent::initialize now returns whether it applied a change, so the
  change-gate's suppressed write/log is asserted directly (not just unchanged
  state); config shell-hide-window parsing extracted into a testable classifier
  that distinguishes Unset (empty → silent) from Unrecognized (warns).
- Add trace-level diagnostics to the no-op env/keyring paths and namespaced
  debug logging to the harness-init coalescing + snackbar poll lifecycles.
@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. and removed bug labels Jul 21, 2026
…pshots

Folding health into app_state_snapshot coupled the 30s disconnect watchdog to an
RPC allowed to run up to 90s (first-launch snapshots take 30–40s), so a slow-but-
alive core could be marked `disconnected` mid-boot. Widen HEALTH_TIMEOUT_MS to
120s to cover one worst-case slow snapshot plus poll cadence; genuine
disconnection (snapshots stop succeeding) is still detected. Addresses Codex
review P2.
@senamakel

Copy link
Copy Markdown
Member Author

Addressed all review threads (CodeRabbit + Codex) in 999e3a0d4 and 782180629:

  • Snackbar stuck-visible (CR/Codex): isDownloading now gated on coreDownloadActive, so a download the core no longer reports active can't keep the overlay up.
  • Snackbar transient-failure stops polling (CR/Codex): a poll error no longer marks the download settled — polling continues while core state reports active.
  • Health ingest timing (CR): moved after commitState and gated on request-id currency, so health is written under the freshly-committed identity, not a stale/pre-commit/superseded token.
  • Watchdog false-fire on slow snapshots (Codex P2): HEALTH_TIMEOUT_MS widened 30s→120s so a slow-but-alive first-launch snapshot (30–40s) isn't marked disconnected.
  • last_ok/last_error type (CR): now string | null to match the Rust Option<String> wire contract.
  • Tests assert suppressed side effects (CR): keyring_consent::initialize returns whether it applied a change (asserted directly); shell-hide-window parsing extracted into a testable 3-way classifier distinguishing Unset (silent) from Unrecognized (warns).
  • Diagnosability (CR): trace-level logs on the env/keyring no-op paths; namespaced debug logging on the harness-init coalescing + snackbar poll lifecycles.
  • Pin guard (CR): already resolved — .github/tauri-cef-expected-sha bumped to the pushed submodule SHA.

@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

🤖 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 `@app/src/providers/CoreStateProvider.tsx`:
- Around line 354-363: Add privacy-safe, namespaced debug/trace diagnostics
throughout the health refresh and polling branches in CoreStateProvider,
covering health presence, request freshness, the
daemonHealthService.ingestHealthSnapshot call, selected poll delay, and whether
the delay reason is bootstrap, authenticated, or failure-backoff. Include branch
decisions, external calls, state transitions, retries/timeouts, and errors
without logging payloads, tokens, or PII; anchor the changes to the existing
refresh logic and ingestion call.
🪄 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: 0c4ad905-709f-41eb-a94c-80cdcc57e5cc

📥 Commits

Reviewing files that changed from the base of the PR and between dea9ee5 and 999e3a0.

📒 Files selected for processing (8)
  • .github/tauri-cef-expected-sha
  • app/src/components/InitProgressScreen/HarnessInitOverlay.tsx
  • app/src/components/LocalAIDownloadSnackbar.tsx
  • app/src/providers/CoreStateProvider.tsx
  • app/src/services/coreStateApi.ts
  • src/openhuman/config/schema/load/env_overlay.rs
  • src/openhuman/config/schema/load_tests.rs
  • src/openhuman/keyring_consent/policy.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/src/components/InitProgressScreen/HarnessInitOverlay.tsx
  • app/src/components/LocalAIDownloadSnackbar.tsx
  • src/openhuman/config/schema/load/env_overlay.rs
  • app/src/services/coreStateApi.ts

Comment thread app/src/providers/CoreStateProvider.tsx
Per the repo's verbose-diagnostics guideline, log privacy-safe namespaced events
for the folded-health ingest branch (request freshness, health presence,
component count — never payload/tokens) and the poll-delay selection (delay +
reason: bootstrap / authenticated / failure-backoff). Addresses CodeRabbit.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 21, 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: 779a344299

ℹ️ 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 app/src/components/LocalAIDownloadSnackbar.tsx

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

ℹ️ 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 app/src/services/daemonHealthService.ts Outdated
…tructure

- Added `OrchestrationRedirect` component to handle legacy `/orchestration` route, redirecting to `/brain?tab=orchestration` with query parameter mapping.
- Updated `AppRoutes` to use the new redirect and removed the direct route to `OrchestrationPage`.
- Modified `Brain` component to include `orchestration` as a sub-tab, ensuring legacy deep links are correctly routed.
- Enhanced documentation for clarity on routing changes and tab structure.
…cution

- Improved the pre-push hook to handle abort signals (Ctrl+C/SIGTERM) more effectively, ensuring that the script exits with the correct status code.
- Introduced a `run_check` function to encapsulate command execution and error handling, allowing for cleaner and more maintainable code.
- Removed the `OrchestrationPage` component and its associated tests, as part of a broader refactor to streamline the application structure.
…gest

The refactor armed the disconnect watchdog only inside a successful health
parse, so a core whose app_state_snapshots never carry parseable health (repeated
timeouts, after the one-shot agent probe already set `running`) would never arm a
watchdog and stick at `running`. Arm a baseline watchdog when tracking starts
(CoreStateProvider → ensureWatchdogArmed, idempotent) and treat any arriving
snapshot as liveness that re-arms it — even a health-less/older-core payload —
while only updating the store on a valid parse. Addresses Codex review P2.
Remove the top-level Orchestration sidebar tab and surface it as a Brain
sub-tab (/brain?tab=orchestration) via the new OrchestrationView, whose
top-level views (Overview/Chat/Agent graph/Tasks/Network) become an
in-content chip row so Brain keeps a single sidebar.

- navConfig: drop the orchestration NAV_TABS entry (6 tabs now)
- settings + legacy /orchestration deep links redirect to the Brain tab,
  mapping ?tab=/?sub= onto the ?ov=/?sub= scheme
- i18n: rename brain.tabs.tinyplaceOrchestration → brain.tabs.orchestration
  with real translations across all locales
- tests: OrchestrationView unit tests, updated navConfig/Brain/nav-rail/e2e
@coderabbitai coderabbitai Bot added bug and removed feature Net-new user-facing capability or product behavior. labels Jul 21, 2026
@senamakel
senamakel merged commit 684ad0d into tinyhumansai:main Jul 21, 2026
9 of 14 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Team Openhuman Jul 21, 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: 7b4c5764c2

ℹ️ 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 on lines +117 to +120
if (!cancelled && !settled) {
timerRef.current = setTimeout(poll, ACTIVE_POLL_INTERVAL);
} else if (settled) {
log('fast poll: download settled, stopping');

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 Keep polling until the folded state goes idle

If one local-AI download reaches a terminal status and another starts before CoreStateProvider's snapshot observes the idle gap, coreDownloadActive stays true the whole time. This branch stops the only fast-poll timer, and because the effect depends only on that boolean (truetrue), the next download never restarts inference_status / progress polling, so its snackbar can remain hidden or stale. Keep a retry armed while the folded state is still active, or key the effect on a changing generation/state rather than only the boolean.

Useful? React with 👍 / 👎.

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

Caution

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

⚠️ Outside diff range comments (1)
app/src/features/conversations/Conversations.tsx (1)

245-254: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard the new Redux maps before indexing them.

If a legacy or narrow chatRuntime state omits turnTranscriptsByThread or interruptedAssistantByThread, the selected-thread paths index undefined and crash during render. EMPTY_TURN_TRANSCRIPTS only covers a missing per-thread entry; add stable top-level empty maps in the selectors as well.

Also applies to: 414-419, 1858-1860, 1898-1900

🤖 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 `@app/src/features/conversations/Conversations.tsx` around lines 245 - 254,
Update the selected-thread selectors and related paths using
turnTranscriptsByThread and interruptedAssistantByThread to fall back to stable
top-level empty maps when those Redux fields are absent, before indexing by
thread ID. Preserve EMPTY_TURN_TRANSCRIPTS for missing per-thread entries and
apply the same guard to the additional usages around the affected selectors and
render paths.
🧹 Nitpick comments (2)
app/src/components/orchestration/OrchestrationView.tsx (1)

123-129: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using the namespaced debug() package instead of console.debug for consistency.

Sibling files in this same orchestration/ folder (e.g. AgentChatPanel.tsx's "debug('steering review: trigger')"-style calls and useOrchestrationSessions.ts's "debug('[orchestration:sessions] contact-sessions refresh: entry')") use the namespaced debug package rather than console.debug. Using console.debug here always logs and can't be selectively toggled via DEBUG, unlike the established convention in this domain.

As per coding guidelines, "New or changed flows must include verbose, grep-friendly diagnostics... Use... namespaced debug logging in the app."

🤖 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 `@app/src/components/orchestration/OrchestrationView.tsx` around lines 123 -
129, Replace the console.debug call in OrchestrationView with the established
namespaced debug logger used by neighboring orchestration components. Preserve
the existing mount diagnostic message and arguments, while ensuring it can be
toggled through the DEBUG environment convention.

Source: Coding guidelines

app/src/store/__tests__/chatRuntimeSlice.thunk.test.ts (1)

46-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use PersistedTranscriptItem[] for the transcript fixture. Array<Record<string, unknown>> drifts from PersistedTurnState.transcript and makes it easier for invalid transcript shapes to slip into the test data.

🤖 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 `@app/src/store/__tests__/chatRuntimeSlice.thunk.test.ts` around lines 46 - 51,
Update the persistedTurn fixture’s transcript parameter to use
PersistedTranscriptItem[] instead of Array<Record<string, unknown>>, importing
the established type if needed, so test data matches
PersistedTurnState.transcript and enforces valid transcript shapes.
🤖 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 `@app/src/AppRoutes.tsx`:
- Around line 38-68: Add grep-friendly console.debug diagnostics within
OrchestrationRedirect, logging the incoming legacy search parameters and the
selected mapping branch, including network-sub, orchestration-view, and unmapped
cases, plus session passthrough when present. Keep the existing redirect
behavior unchanged and log the final Brain destination before returning
Navigate.

In `@app/src/pages/Brain.tsx`:
- Around line 38-45: Update the intelligence.session_orchestration how_to
mapping in catalog_data.rs from Intelligence > Orchestration to Brain >
Orchestration, and add E2E coverage that directly navigates to
/brain?tab=orchestration and verifies the orchestration tab is shown. Preserve
existing /brain navigation coverage.

In `@app/src/services/daemonHealthService.ts`:
- Around line 33-64: Add namespaced, grep-friendly debug logs in
ensureWatchdogArmed and ingestHealthSnapshot for watchdog arm versus
already-armed, snapshot receipt and timeout re-arm, valid health application,
and ignored missing or invalid health. Do not log payload contents or user IDs;
preserve the existing watchdog and store-update behavior while covering the
relevant branches and state transitions.

---

Outside diff comments:
In `@app/src/features/conversations/Conversations.tsx`:
- Around line 245-254: Update the selected-thread selectors and related paths
using turnTranscriptsByThread and interruptedAssistantByThread to fall back to
stable top-level empty maps when those Redux fields are absent, before indexing
by thread ID. Preserve EMPTY_TURN_TRANSCRIPTS for missing per-thread entries and
apply the same guard to the additional usages around the affected selectors and
render paths.

---

Nitpick comments:
In `@app/src/components/orchestration/OrchestrationView.tsx`:
- Around line 123-129: Replace the console.debug call in OrchestrationView with
the established namespaced debug logger used by neighboring orchestration
components. Preserve the existing mount diagnostic message and arguments, while
ensuring it can be toggled through the DEBUG environment convention.

In `@app/src/store/__tests__/chatRuntimeSlice.thunk.test.ts`:
- Around line 46-51: Update the persistedTurn fixture’s transcript parameter to
use PersistedTranscriptItem[] instead of Array<Record<string, unknown>>,
importing the established type if needed, so test data matches
PersistedTurnState.transcript and enforces valid transcript shapes.
🪄 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: 68e5443c-fc97-4545-843d-9cdcb9d6a9a7

📥 Commits

Reviewing files that changed from the base of the PR and between 999e3a0 and 7b4c576.

📒 Files selected for processing (37)
  • .husky/pre-push
  • app/src/AppRoutes.tsx
  • app/src/components/layout/shell/CollapsedNavRail.test.tsx
  • app/src/components/orchestration/AgentChatPanel.tsx
  • app/src/components/orchestration/ConnectionsPanel.tsx
  • app/src/components/orchestration/OrchestrationView.tsx
  • app/src/components/orchestration/__tests__/OrchestrationView.test.tsx
  • app/src/components/settings/settingsRouteElements.tsx
  • app/src/config/__tests__/navConfig.test.ts
  • app/src/config/navConfig.ts
  • app/src/features/conversations/Conversations.tsx
  • app/src/features/conversations/components/InterruptedAnswer.tsx
  • app/src/lib/i18n/ar.ts
  • app/src/lib/i18n/bn.ts
  • app/src/lib/i18n/de.ts
  • app/src/lib/i18n/en.ts
  • app/src/lib/i18n/es.ts
  • app/src/lib/i18n/fr.ts
  • app/src/lib/i18n/hi.ts
  • app/src/lib/i18n/id.ts
  • app/src/lib/i18n/it.ts
  • app/src/lib/i18n/ko.ts
  • app/src/lib/i18n/pl.ts
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/ru.ts
  • app/src/lib/i18n/zh-CN.ts
  • app/src/pages/Brain.tsx
  • app/src/pages/OrchestrationPage.tsx
  • app/src/pages/__tests__/Brain.test.tsx
  • app/src/pages/__tests__/OrchestrationPage.test.tsx
  • app/src/providers/CoreStateProvider.tsx
  • app/src/services/__tests__/daemonHealthService.test.ts
  • app/src/services/daemonHealthService.ts
  • app/src/store/__tests__/chatRuntimeSlice.thunk.test.ts
  • app/src/store/chatRuntimeSlice.test.ts
  • app/test/e2e/specs/navigation.spec.ts
  • tests/json_rpc_e2e.rs
💤 Files with no reviewable changes (4)
  • app/src/components/layout/shell/CollapsedNavRail.test.tsx
  • app/src/pages/tests/OrchestrationPage.test.tsx
  • app/src/pages/OrchestrationPage.tsx
  • tests/json_rpc_e2e.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/providers/CoreStateProvider.tsx

Comment thread app/src/AppRoutes.tsx
Comment on lines +38 to +68
/**
* Redirects the retired `/orchestration` route to its new home under Brain
* (`/brain?tab=orchestration`), mapping the legacy `?tab=`/`?sub=` query onto
* Brain's `?ov=`/`?sub=` scheme so old deep links land on the same view:
* - `?tab=connections|discover|usage` → `?ov=network&sub=<that>`
* - `?tab=agent|overview|tasks|network|medulla` → `?ov=<that>`
* - `?session=` is preserved for the agent chat.
*/
const NETWORK_SUBS = ['connections', 'discover', 'usage'];
const ORCH_VIEWS = ['medulla', 'agent', 'overview', 'tasks', 'network'];

function OrchestrationRedirect() {
const { search } = useLocation();
const legacy = new URLSearchParams(search);
const tab = legacy.get('tab');

const next = new URLSearchParams();
next.set('tab', 'orchestration');
if (tab && NETWORK_SUBS.includes(tab)) {
next.set('ov', 'network');
next.set('sub', tab);
} else {
if (tab && ORCH_VIEWS.includes(tab)) next.set('ov', tab);
const sub = legacy.get('sub');
if (sub && NETWORK_SUBS.includes(sub)) next.set('sub', sub);
}
const session = legacy.get('session');
if (session) next.set('session', session);

return <Navigate to={`/brain?${next.toString()}`} replace />;
}

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add grep-friendly diagnostics to OrchestrationRedirect.

This is a new flow with real branching (network-sub vs. orchestration-view mapping, session passthrough) but has no logging at all, unlike the analogous legacy-redirect effect in Brain.tsx (console.debug('[brain] legacy tinyplace-orchestration deep link → ...')) and the mount log in OrchestrationView.tsx. Add an entry/decision log so misrouted legacy deep links (/orchestration?tab=...) are diagnosable in the field.

🩹 Proposed diagnostic logging
 function OrchestrationRedirect() {
   const { search } = useLocation();
   const legacy = new URLSearchParams(search);
   const tab = legacy.get('tab');

   const next = new URLSearchParams();
   next.set('tab', 'orchestration');
   if (tab && NETWORK_SUBS.includes(tab)) {
     next.set('ov', 'network');
     next.set('sub', tab);
   } else {
     if (tab && ORCH_VIEWS.includes(tab)) next.set('ov', tab);
     const sub = legacy.get('sub');
     if (sub && NETWORK_SUBS.includes(sub)) next.set('sub', sub);
   }
   const session = legacy.get('session');
   if (session) next.set('session', session);

+  console.debug('[app-routes] legacy /orchestration redirect: tab=%s sub=%s → %s', tab, legacy.get('sub'), next.toString());
   return <Navigate to={`/brain?${next.toString()}`} replace />;
 }

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

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Redirects the retired `/orchestration` route to its new home under Brain
* (`/brain?tab=orchestration`), mapping the legacy `?tab=`/`?sub=` query onto
* Brain's `?ov=`/`?sub=` scheme so old deep links land on the same view:
* - `?tab=connections|discover|usage` `?ov=network&sub=<that>`
* - `?tab=agent|overview|tasks|network|medulla` `?ov=<that>`
* - `?session=` is preserved for the agent chat.
*/
const NETWORK_SUBS = ['connections', 'discover', 'usage'];
const ORCH_VIEWS = ['medulla', 'agent', 'overview', 'tasks', 'network'];
function OrchestrationRedirect() {
const { search } = useLocation();
const legacy = new URLSearchParams(search);
const tab = legacy.get('tab');
const next = new URLSearchParams();
next.set('tab', 'orchestration');
if (tab && NETWORK_SUBS.includes(tab)) {
next.set('ov', 'network');
next.set('sub', tab);
} else {
if (tab && ORCH_VIEWS.includes(tab)) next.set('ov', tab);
const sub = legacy.get('sub');
if (sub && NETWORK_SUBS.includes(sub)) next.set('sub', sub);
}
const session = legacy.get('session');
if (session) next.set('session', session);
return <Navigate to={`/brain?${next.toString()}`} replace />;
}
function OrchestrationRedirect() {
const { search } = useLocation();
const legacy = new URLSearchParams(search);
const tab = legacy.get('tab');
const next = new URLSearchParams();
next.set('tab', 'orchestration');
if (tab && NETWORK_SUBS.includes(tab)) {
next.set('ov', 'network');
next.set('sub', tab);
} else {
if (tab && ORCH_VIEWS.includes(tab)) next.set('ov', tab);
const sub = legacy.get('sub');
if (sub && NETWORK_SUBS.includes(sub)) next.set('sub', sub);
}
const session = legacy.get('session');
if (session) next.set('session', session);
console.debug('[app-routes] legacy /orchestration redirect: tab=%s sub=%s → %s', tab, legacy.get('sub'), next.toString());
return <Navigate to={`/brain?${next.toString()}`} replace />;
}
🤖 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 `@app/src/AppRoutes.tsx` around lines 38 - 68, Add grep-friendly console.debug
diagnostics within OrchestrationRedirect, logging the incoming legacy search
parameters and the selected mapping branch, including network-sub,
orchestration-view, and unmapped cases, plus session passthrough when present.
Keep the existing redirect behavior unchanged and log the final Brain
destination before returning Navigate.

Source: Coding guidelines

Comment thread app/src/pages/Brain.tsx
Comment on lines +38 to +45
type BrainTab =
| 'welcome'
| 'graph'
| 'goals'
| 'sources'
| 'sync'
| 'subconscious'
| 'orchestration';

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether about_app docs mention the Brain orchestration tab / old top-level orchestration destination
fd . src/openhuman/about_app -e md -e mdx --exec grep -l -i "orchestration" {} \;

# Check whether navigation E2E specs cover the new /brain?tab=orchestration destination or the legacy redirects
rg -n "orchestration" app/test/e2e/specs/navigation.spec.ts

Repository: tinyhumansai/openhuman

Length of output: 470


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "about_app files:"
git ls-files 'src/openhuman/about_app/**'

echo
echo "orchestration mentions in about_app:"
rg -n -i "orchestration|brain" src/openhuman/about_app || true

echo
echo "navigation spec context:"
sed -n '1,120p' app/test/e2e/specs/navigation.spec.ts

Repository: tinyhumansai/openhuman

Length of output: 5669


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "about_app README:"
sed -n '1,220p' src/openhuman/about_app/README.md

echo
echo "Brain page references in about_app:"
rg -n -i "brain|tab|route|orchestration" src/openhuman/about_app/{README.md,catalog_data.rs,mod.rs,types.rs,schemas.rs,ops.rs,catalog.rs} || true

Repository: tinyhumansai/openhuman

Length of output: 17244


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "E2E mentions of brain tab params:"
rg -n "tab=orchestration|orchestration.*tab|brain\\?tab|tinyplace-orchestration|Brain > Orchestration|orchestration folded under Brain" app/test/e2e || true

echo
echo "Brain page test file context:"
sed -n '1,260p' app/src/pages/Brain.test.tsx

Repository: tinyhumansai/openhuman

Length of output: 838


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1818,1842p' src/openhuman/about_app/catalog_data.rs

echo
echo "related Brain how_to entries:"
rg -n 'how_to: "Brain >|how_to: "Intelligence >' src/openhuman/about_app/catalog_data.rs

Repository: tinyhumansai/openhuman

Length of output: 3099


Update the Session Orchestration mapping and add direct tab coverage

  • src/openhuman/about_app/catalog_data.rs still points intelligence.session_orchestration at Intelligence > Orchestration; update that how_to text to Brain > Orchestration so the catalog matches the UI.
  • Add an E2E check for /brain?tab=orchestration; current navigation coverage exercises /brain, but not the tab-specific entry point.
🤖 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 `@app/src/pages/Brain.tsx` around lines 38 - 45, Update the
intelligence.session_orchestration how_to mapping in catalog_data.rs from
Intelligence > Orchestration to Brain > Orchestration, and add E2E coverage that
directly navigates to /brain?tab=orchestration and verifies the orchestration
tab is shown. Preserve existing /brain navigation coverage.

Source: Path instructions

Comment on lines +33 to 64
/**
* Arm the disconnect watchdog once when daemon-health tracking starts, if it
* isn't already armed. Without this, a core whose `app_state_snapshot`s never
* succeed (repeated timeouts) — after `useDaemonHealth`'s one-shot agent probe
* has set the status to `running` — would never arm a watchdog and stick at
* `running` forever. The baseline watchdog guarantees a fallback to
* `disconnected` if no snapshot ever arrives, and is re-armed by each ingest.
*/
ensureWatchdogArmed(): void {
if (this.healthTimeoutId === null) {
this.startHealthTimeout();
}
}

const pollOnce = async () => {
try {
const payload = await callCoreRpc<unknown>({ method: 'openhuman.health_snapshot' });
const healthSnapshot = this.parseHealthSnapshot(payload);
if (healthSnapshot) {
this.updateDaemonStoreFromHealth(healthSnapshot);
this.startHealthTimeout();
}
} catch {
// The health endpoint can fail while the sidecar is starting.
}
};

await pollOnce();
this.pollingIntervalId = setInterval(() => {
void pollOnce();
}, this.POLL_MS);
/**
* Ingest a health payload carried by an `app_state_snapshot` refresh.
*
* The snapshot arriving at all is proof the core is alive, so the disconnect
* watchdog is re-armed unconditionally — even when the payload is missing or
* unparseable (an older core that doesn't fold health, or a partial payload) —
* otherwise a live-but-health-less core would eventually be marked
* `disconnected`. The daemon store is only updated when a valid health
* snapshot is present; otherwise it keeps its last-known state.
*/
ingestHealthSnapshot(payload: unknown): void {
// Called by CoreStateProvider only after a successful snapshot → liveness.
this.startHealthTimeout();

return () => this.cleanup();
const healthSnapshot = this.parseHealthSnapshot(payload);
if (healthSnapshot) {
this.updateDaemonStoreFromHealth(healthSnapshot);
}
}

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add diagnostics for watchdog and ingestion branches.

The new flow logs only timeout/errors. Add namespaced debug logs for watchdog arm/already-armed, snapshot receipt/re-arm, valid health application, and ignored invalid/missing health—without logging payloads or user IDs.

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 `@app/src/services/daemonHealthService.ts` around lines 33 - 64, Add
namespaced, grep-friendly debug logs in ensureWatchdogArmed and
ingestHealthSnapshot for watchdog arm versus already-armed, snapshot receipt and
timeout re-arm, valid health application, and ignored missing or invalid health.
Do not log payload contents or user IDs; preserve the existing watchdog and
store-update behavior while covering the relevant branches and state
transitions.

Source: Coding guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant