Skip to content

feat(desktop): add the state of the local serve to the model - #1095

Merged
ajianaz merged 1 commit into
developfrom
feat/desktop-serve-state
Nov 21, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/desktop-serve-state

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What

tole-desktop-model gains ServeState and ServeFailure: what the desktop knows about the local tole serve it starts or attaches to, with the plain-language strings and the owner action each failure calls for.

Why

Part of #1029. The supervisor (the next changes of this series) produces a small state, and the window renders it through the string table without deciding on its own what a failure means. The model crate has no GUI toolkit and no tole dependency (desktop-check.sh enforces both), so the state lives here and the supervisor in tole-desktop only produces values of it. Nothing shows the state yet.

Changes

  • serve_state.rs (new): ServeState (Starting, Attached, Running, Restarting, Stopping, Stopped, Failed) and ServeFailure (no local socket transport on this platform, no tole binary, a socket directory that is not the owner's, a serve of another protocol version, no credential the serve accepts, something on the socket that is not a tole serve, a serve that did not start, one that gave up after repeated stops, one that could not be stopped). is_ready, version, owner_action (restart the serve, or retry) and connection_status (the shell's status for a state).
  • Fail closed: only Attached and Running are ready and connected; every other state, every failure included, is unreachable, and a failure that needs a change of environment (a missing binary, a directory that is not private, an unsupported platform) calls for no button.
  • strings.rs: plain-language wording for each state and failure, and for each owner action.
  • CHANGELOG.md.

Callers checked with grep: ServeState, ServeFailure and OwnerAction are new, and nothing outside this crate uses them yet; the only change to existing code is additions to the string table.

Testing

  • cargo test -p tole-desktop-model -p tole-desktop: 44 and 1 tests pass (the state and its strings are tested without a window).
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo clippy -p tole-cli --no-default-features --all-targets -- -D warnings: pass. bash scripts/test-desktop-check.sh (all cases) and bash scripts/desktop-check.sh all: pass. cargo check -p tole-desktop --features gpui: pass.
  • cora review --no-llm --base origin/develop after cora index: no issues. scripts/review-local.sh not run (no LLM key); the CI Cora Review is the gate.
  • Not run: a full cargo test --workspace.

Part of #1029.

ServeState is what the supervisor of the local serve reports and the window
renders: starting, attached, running, restarting, stopping, stopped, and the
failures (no tole binary, directory not private, protocol version mismatch, no
credential the serve accepts, not a tole serve, did not start, gave up, could
not stop), each with a plain-language string and the button it calls for.

Part of #1029.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit c4edfa1 into develop Nov 21, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant