Skip to content

feat: cascade StrEnum validation + chat-agent integration guide#273

Open
Fearvox wants to merge 4 commits into
EverMind-AI:mainfrom
Fearvox:proofstorm/r3-cascade-strenum-integration-guide
Open

feat: cascade StrEnum validation + chat-agent integration guide#273
Fearvox wants to merge 4 commits into
EverMind-AI:mainfrom
Fearvox:proofstorm/r3-cascade-strenum-integration-guide

Conversation

@Fearvox

@Fearvox Fearvox commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What

Two improvements addressing validation gaps and documentation gaps:

Part A: StrEnum for cascade work-queue tables

md_change_state.kind, change_type, and status previously accepted
arbitrary strings despite documented valid values. A typo like
kind="epsiode" would silently fail with a confusing "no handler
registered" error. This PR adds ChangeKind, ChangeType, and
ChangeStatus StrEnums following the existing RunStatus pattern
(infra/ome/records.py).

  • 6 handler kinds: episode, atomic_fact, foresight, agent_case, agent_skill, user_profile
  • 3 change types: added, modified, deleted
  • 4 statuses: pending, processing, done, failed

Part B: Chat-agent integration guide (#193)

Adds docs/chat-agent-integration.md with:

  • On-demand search vs per-turn RAG guidance
  • Write/read path recommendations with API references
  • OpenAI-compatible memory_search tool JSON Schema
  • Timestamp handling guidance

Closes #193 (documentation part — tool schema question).

Testing

  • 27/27 cascade repo tests pass (including 4 new enum validation tests)
  • 1193/1193 unit tests pass
  • 57/57 integration tests pass
  • make lint clean
  • scripts/check_docs.py passed

Fearvox added 2 commits June 7, 2026 21:38
Add ChangeKind, ChangeType, and ChangeStatus StrEnums to enforce valid
values on the cascade work-queue table's kind, change_type, and status
fields. Previously these accepted arbitrary strings despite documented
valid values, causing confusing 'no handler registered' errors on typos.

Follows the existing RunStatus(StrEnum) pattern in infra/ome/records.py.

Refs: EverMind-AI#193
…ind-AI#193)

Add docs/chat-agent-integration.md covering on-demand search vs per-turn
RAG, write/read paths, time-range filtering, and an OpenAI-compatible
memory_search tool schema. Add cross-reference from api.md /search
section and entry in docs/index.md.

Closes EverMind-AI#193 (documentation part).
Copilot AI review requested due to automatic review settings June 8, 2026 04:38

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Fearvox added 2 commits June 7, 2026 21:53
The layered-architecture contract forbids everos.memory from importing
everos.infra.  Move ChangeKind/ChangeType/ChangeStatus to
everos.core.enums — a shared layer accessible from both infra and memory.

This also fixes the integration test_lap_append_during_handler_no_loss
failure caused by the enum definitions living in a module that the
memory layer could not legally reach.
P1-1: SQLAlchemy Enum stores enum *names* (EPISODE) not values (episode).
  Add values_callable=lambda e: [x.value for x in e] to all three
  StrEnum fields so SQLite stores lowercase values matching existing
  data and partial indexes.

P1-2: Tool schema missed user_id/agent_id (required by SearchRequest)
  and had wrong top_k default (10 vs -1). Fixed schema and added XOR
  note.

P2: Added test_db_stores_lowercase_enum_values — raw SQL round-trip
  verifying stored values are lowercase, not enum names.
@Fearvox

Fearvox commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

@cyfyifanchen @hylarucoder Ready for review.

Part Asrc/everos/core/enums.py + table/repos/cascade modules: bare strStrEnum for kind/change_type/status. values_callable ensures SQLite stores lowercase values (not enum names). import-linter clean.

Part Bdocs/chat-agent-integration.md: on-demand search pattern, write/read paths, OpenAI tool schema with user_id/agent_id XOR. Closes #193.

Cross-model brake (GPT-5.5) already applied: caught SQLAlchemy Enum name-vs-value storage bug + tool schema field mismatches. All 7 CI gates green.

@cyfyifanchen cyfyifanchen self-requested a review June 8, 2026 05:53
@cyfyifanchen cyfyifanchen requested a review from hylarucoder June 8, 2026 05:54

@hylarucoder hylarucoder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review 了

Comment thread src/everos/core/enums.py
from enum import StrEnum


class ChangeKind(StrEnum):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/everos/core/enums.py 这里的 Enum 命名太短了,按我的理解,如果提取到公用的 core 级别,命名需要有区分度,从 core 看代码可以直接知道是用在什么地方。可以适当参考 领域命名+字段命名结合。

这里 ChangeKind 太通用了,MemoryCascadeChangeKind 会直观很多。

@Fearvox

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的 应该再细分一下taxonomy Thx

index=True,
sa_type=SAEnum(ChangeStatus, values_callable=lambda e: [x.value for x in e]),
)
"""Lifecycle: ``PENDING`` → ``PROCESSING`` → ``DONE`` | ``FAILED``."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我这里更倾向于 status: CascadeMutation = EnumField(ChangeStatus, nullable=False) 的封装,更加干净一些。可以考虑和 codex 聊一下封装 @Fearvox

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.

Chat Agent + MemSys integration: recommended practices & official search tool schema?

4 participants