Skip to content

Comments

feat(graphql): add sessions.active query and fix chat service binding#210

Open
penso wants to merge 7 commits intomainfrom
graphql-fix
Open

feat(graphql): add sessions.active query and fix chat service binding#210
penso wants to merge 7 commits intomainfrom
graphql-fix

Conversation

@penso
Copy link
Collaborator

@penso penso commented Feb 22, 2026

Summary

  • Ports the useful GraphQL changes from ethiebaut/graphQL onto current main (post crate-extraction refactors)
  • Adds sessions.active GraphQL query to check whether a session has an active LLM run
  • Fixes GraphQL chat methods to use late-bound state.chat() instead of s.chat, ensuring GraphQL shares the same LiveChatService instance as WebSocket/RPC callers
  • Fixes SessionEntry.id type from i64 to String to match actual RPC data
  • Accepts "message" as alias for "text" param in chat.send
  • Adds "ok": true to send/delete responses for consistency

Validation

Completed

  • cargo check passes
  • Reviewed original ethiebaut/graphQL changes for security (no supply chain concerns found)
  • Intentionally omitted AgentIdentity field change (themecreature+vibe) since main consolidated in the opposite direction

Remaining

  • cargo +nightly-2025-11-30 fmt --all -- --check
  • cargo +nightly-2025-11-30 clippy -Z unstable-options --workspace --all-features --all-targets --timings -- -D warnings
  • cargo test
  • ./scripts/local-validate.sh

Manual QA

  1. Start gateway with GraphQL enabled (default)
  2. Open GraphiQL at /graphql
  3. Run { sessions { active(sessionKey: "test") { active } } } — should return { "active": false }
  4. Send a chat message, then query sessions.active — should return true while LLM is responding
  5. Verify chat.send/abort/history work through GraphQL (they now use the correct late-bound service)

Create a new moltis-web crate that owns all browser-facing concerns:
- Rust modules: assets serving, HTML templates, route composition, terminal proxy
- Static assets (JS, CSS, icons, HTML) moved from gateway/src/assets
- Askama templates moved from gateway/src/templates
- Playwright E2E tests and Tailwind build tooling moved from gateway/ui

The web crate injects its routes into the gateway via a RouteEnhancer
composition pattern, keeping UI concerns separate from API/agent logic.
Auth gate is applied globally in finalize_gateway_app rather than
per-route. The web-ui feature flag in moltis-cli controls inclusion.

Update all cross-references in CI workflows, docs, scripts, justfile,
biome.json, and CLAUDE.md. Add streaming.md section for the new web
crate layer in the data flow.
Replace two separate identity fields (creature, vibe) with a single
theme field across the entire codebase. Existing IDENTITY.md files
with creature or vibe keys are accepted as backward-compat aliases
in the frontmatter parser; new saves always write theme.

System prompt changes from two sentences ("You are a {creature}." +
"Your vibe: {vibe}.") to one ("Your theme: {theme}.").

Onboarding wizard merges two steps (AgentCreature, AgentVibe) into
one (AgentTheme). UI replaces two input fields with a single Theme
input in both onboarding and settings pages.
Move 20 service trait definitions and their simple Noop implementations
from gateway/services.rs into a dedicated moltis-service-traits crate.
This breaks the circular dependency where implementations had to live
in gateway just to access trait definitions.

The gateway re-exports everything from service-traits for backwards
compatibility. Gateway-specific code (NoopSkillsService with complex
deps, RealBrowserService, GatewayServices struct, helper functions)
stays in gateway.
…ase 1)

Move tls.rs (657 lines) to moltis-tls and tailscale.rs (548 lines) to
moltis-tailscale. Both modules had zero crate:: imports, making them
trivial extractions.

Gateway retains thin re-export modules for backwards compatibility.
The tls and tailscale feature flags now gate the new crate dependencies.
Move credential store, WebAuthn, and locality detection into dedicated
moltis-auth crate. Gateway auth.rs and auth_webauthn.rs become thin
re-exports. Removes argon2, password-hash, webauthn-rs-proto, and
openssl as direct gateway dependencies (now transitive via moltis-auth).
Locality tests (37 total) now live in moltis-auth; gateway test count
unchanged at 49.
Move provider setup logic (4,180 lines) into a dedicated crate.
Introduces SetupBroadcaster trait and ErrorParser callback to decouple
from gateway's broadcast mechanism and chat_error module. Gateway's
provider_setup.rs becomes a thin re-export plus GatewayBroadcaster impl.
local-llm feature forwarded to the new crate. 70 tests now live in
moltis-provider-setup.
Port GraphQL improvements from ethiebaut/graphQL branch onto current main:

- Add sessions.active query to check whether an LLM run is active
- Fix chat methods to use late-bound state.chat() instead of s.chat,
  ensuring GraphQL shares the same LiveChatService as WebSocket/RPC
- Fix SessionEntry.id type from i64 to String to match RPC data
- Accept "message" as alias for "text" param in chat.send
- Add "ok": true to send/delete responses for consistency
@codspeed-hq
Copy link
Contributor

codspeed-hq bot commented Feb 22, 2026

Merging this PR will improve performance by 44.42%

⚡ 1 improved benchmark
✅ 38 untouched benchmarks
⏩ 5 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
env_substitution 15.4 µs 10.7 µs +44.42%

Comparing graphql-fix (28c95e3) with main (12e438c)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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