Skip to content

wire CLI chat identity into GAIA observation pipeline#7

Closed
Esity wants to merge 740 commits intoOptum:mainfrom
LegionIO:feature/gaia-connection-completeness
Closed

wire CLI chat identity into GAIA observation pipeline#7
Esity wants to merge 740 commits intoOptum:mainfrom
LegionIO:feature/gaia-connection-completeness

Conversation

@Esity
Copy link
Copy Markdown
Member

@Esity Esity commented Mar 31, 2026

Summary

  • DaemonChat generates stable conversation_id (UUID) and resolves caller identity (Kerberos -> ENV['USER'] fallback)
  • Forward caller and conversation_id to daemon inference endpoint
  • setup_gaia_observation registers :llm_complete callback that ingests user messages into GAIA's observation pipeline
  • :llm_complete session event now includes user_message in payload

Part of GAIA Connection Completeness Plan 2 (Section 1).

Test plan

  • 4070 specs passing, 0 failures (2 pre-existing failures in daemon_chat_spec unrelated to this change)
  • Rubocop clean on changed files
  • Version bump to 1.6.47

Esity added 30 commits March 23, 2026 21:42
…al modules

- api/llm.rb sync path: caller: { source: 'api', path: request.path }
- api/prompts.rb: caller: { source: 'api', endpoint: 'prompts' }
- cli/commit, pr, review: caller: { source: 'cli', command: '<cmd>' }
- cli/prompt, image: caller: { source: 'cli', command: '<cmd>' }
- notebook/generator: caller: { source: 'cli', command: 'notebook' }
- trace_search: caller: { source: 'cli', command: 'trace' }
- extensions llm runner: caller: { source: 'extension', command: 'llm_runner' }
- update specs: chat_direct -> chat stubs, hash_including for caller kwarg
- Replace private Legion::LLM.chat_single call with public Legion::LLM.chat
- Add Guardrails::SYSTEM_CALLER constant using requested_by: nesting required
  by Pipeline::Profile.derive to resolve :system profile
- :system profile skips rbac, classification, billing, gaia_advisory,
  rag_context, and context_load steps, breaking the recursion loop where
  guardrails (called from inside the pipeline) would re-enter the pipeline
- Extend guardrails_spec with SYSTEM_CALLER structure tests and LLM call
  behavior specs using stub_const
Migrates the final unmigrated LLM call site in LegionIO.
`CLI::ChatCommand#create_chat` now passes `caller: { source: 'cli', command: 'chat' }`
completing Wave 5 of the caller identity migration.
- :lite ProcessRole: all subsystems enabled except crypt (no Vault)
- --lite CLI flag sets LEGION_MODE=lite and LEGION_LOCAL=true env vars
- Service#lite_mode? checks env var and settings[:mode]
- setup_local_mode handles lite mode with Transport::Local + mock_vault
- 3 new specs (1 lite role + 2 service lite_mode?)
Routes free-text intents to the best matching Capability Registry
entry. Tries daemon HTTP API first, falls back to in-process
Registry.find_by_intent + Ingress.run.

Examples:
  legion do "check consul health"
  legion do "list running tasks"
when keyword matching returns no results, classifies intent via
Legion::LLM.ask against the Capability Registry catalog. graceful
degradation when LLM is not available.
do_command try_llm_classify, api/costs metering_available?,
api/apollo apollo_data_connected? now log at debug level
instead of silently returning nil/false.
ModelComparison#cost_tracker_pricing, SystemStatus#fetch_health,
SystemStatus#fetch_ready, SessionStore#generate_summary,
SessionStore#read_session_meta, SaveMemory#ingest_to_apollo,
GenerateInsights#scheduling_status, GenerateInsights#llm_status
stub_const Legion::Extensions::MindGrowth::Client (not loaded
without lex-mind-growth gem), use plain double instead of
instance_double since real class is unavailable in test env
legion-transport >= 1.3.11: InProcess adapter, shutdown hang fix, Helper mixin
legion-tty >= 0.4.34: latest fixes
- legion setup agentic: one command for full cognitive stack
- legion setup llm: LLM routing only
- legion setup channels: Slack + Teams adapters
- legion setup packs: show installed/missing packs
- legion detect: recommends setup agentic when gaia/llm missing
- comment out Bootsnap.setup in exe/legion (matches exe/legionio)
…n-data >= 1.5.0

- overhaul `legionio check` with namespace labels and connection details
- add Legion::Cache::Local and Legion::Data::Local checks
- fix dependency skip cascade (skip-on-skip, not just skip-on-fail)
- `legionio version` lists all 13 legion-* gems, --full shows lex versions
- runner log output tagged with extension name
- transport and routes builders use tagged log helper
- require legion-data >= 1.5.0
Move status and result assignment before handle_exception call in the
StandardError rescue block. Previously, if handle_exception raised,
status remained nil and the ensure block treated it as task.completed,
publishing CheckSubtask messages with null function/result values.
Guarded Client#escalate call during transition! when containment level
increases. EXTINCTION_MAPPING maps lifecycle states to levels 0-4.
Esity added 28 commits March 30, 2026 09:17
lex-cortex has been fully replaced by legion-gaia. Having it in the
agentic pack causes a deprecation warning on every boot when GAIA is
running.
…ic-pack

remove deprecated lex-cortex from agentic setup pack
…ap-clean

add config reset command and bootstrap --clean flag
Helpers::Lex now automatically includes Cache, Transport, Task, and
Data helpers so actors, runners, absorbers, and hooks get methods like
cache_connected?, transport_connected?, and generate_task_id without
explicit opt-in. Absorbers::Base now includes Helpers::Lex (previously
included zero helper modules).
include all core helpers in Helpers::Lex and Absorbers::Base
write_pack_marker creates ~/.legionio/.packs/<name> touch file
and updates ~/.legionio/settings/packs.json with installed pack
names. markers are written on both fresh install and re-run when
all gems are already present.

companion to LegionIO/homebrew-tap#19 which reads these markers
during brew upgrade to reinstall packs after a Cellar wipe.
write pack install markers for brew upgrade reinstall
…rectly (#92)

- extract shared ApiClient module (api_get/api_post/api_put/api_delete)
- add /api/knowledge/* routes for query, retrieve, ingest, status, health,
  maintain, quality, and monitor CRUD
- rewrite knowledge, schedule, and codegen CLI commands to use daemon API
- update absorb command to use shared ApiClient module
- add require_knowledge_*! helpers to API helpers

Closes #92
route CLI commands through local API instead of loading extensions directly (#92)
replace FileUtils.touch with File.write guard to avoid
File.utime EPERM (Operation not permitted @ apply2files)
when marker file already exists on macOS Sequoia
- DaemonChat generates stable conversation_id and resolves caller identity
- forward caller and conversation_id to daemon inference endpoint
- setup_gaia_observation registers llm_complete callback for GAIA ingest
- llm_complete event includes user_message in payload
@Esity Esity closed this Mar 31, 2026
@Esity Esity deleted the feature/gaia-connection-completeness branch March 31, 2026 20:18
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