feat: live index_status in robot capabilities response (F3.1) #32
Notifications
Due Date
No due date set.
Depends on
#5 feat: Implement Tantivy-based session index for full-text search
terraphim/agent-tasks
Reference: terraphim/agent-tasks#32
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
Spec F3.1 (terraphim-agent-session-search-spec.md, lines 198-221) requires
terraphim-agent robot capabilitiesto expose live index health underindex_status:Today the field is hard-coded to
None. Verification:User-facing failure mode for AI agents: an LLM probing
terraphim-agent robot capabilities --format jsoncannot tell whether the local session store has any data, whether enrichment ran, or how stale the index is. It must instead invoke/sessions stats, parse a separate response shape, and reconcile -- defeating G3 ("Self-documenting API") and complicating sub-agent task routing.Acceptance Criteria
CapabilitiesData::index_statusis populated fromSessionService::stats()(and, if Tantivy is present, the Tantivy reader's segment metadata forlast_updated).terraphim_sessionsis compiled out (default features), the field remainsNoneand the JSON omits the key (existingskip_serializing_if = "Option::is_none"behaviour). No breaking change for builds without sessions.{"sessions_indexed": 0, "last_updated": null}, distinguishable fromindex_status: null(which means "feature absent").IndexStatusDatastruct gains an optionallast_updated_iso8601: Option<String>(UTC, RFC3339).robot/docs.rs::tests::capabilities_includes_index_status_when_sessions_feature_enabled(gated by#[cfg(feature = "repl-sessions")]) asserts presence and shape.cargo test -p terraphim_agent --features repl-sessions --lib robot::docspasses.cargo clippy -p terraphim_agent --features repl-sessions -- -D warningspasses.Proposed Approach
CapabilitiesData::index_statustoOption<IndexStatusData>with the shape above (struct already declared inrobot/schema.rs; only the producer logic needs updating).pub fn capabilities_data_with_sessions(&self, service: &SessionService) -> CapabilitiesDataonSelfDocumentation. Keep the existing zero-argcapabilities_data()for the no-sessions build./robot capabilitiesREPL handler (and the equivalent path inmain.rs), call the sessions-aware variant when therepl-sessionsfeature is enabled. Use#[cfg(feature = "repl-sessions")]to fork.last_updatedsource: preferSessionService::last_imported_at()(likely needs a tiny additive accessor); fall back to scanningSessionMetadata::updated_atMAX if the accessor cannot be added in this PR.Affected crates:
terraphim_agent,terraphim_sessions(one accessor only, additive).Key files:
crates/terraphim_agent/src/robot/docs.rs,crates/terraphim_agent/src/robot/schema.rs,crates/terraphim_agent/src/repl/handler.rs,crates/terraphim_sessions/src/service.rs.Dependencies
Soft-blocked by #5 (Tantivy session index): once Tantivy lands,
last_updatedwill useIndexReader::searcher()segment metadata for higher fidelity. Until #5 lands, falling back toSessionService::stats()is acceptable -- the field is correct, just refreshed less granularly.Add dep edge:
gitea-robot add-dep --owner terraphim --repo agent-tasks --issue NEW --blocks 5.Verification
Scope
Single-PR change. Estimated 180-260 lines (accessor + producer + feature-gated test + handler wiring). No cross-cutting refactor.