Skip to content

feat(core): add skill_writing status for session learning flow#501

Merged
GenerQAQ merged 1 commit intomemodb-io:devfrom
mbt1909432:feat/add-skill-writing-session-status
Mar 27, 2026
Merged

feat(core): add skill_writing status for session learning flow#501
GenerQAQ merged 1 commit intomemodb-io:devfrom
mbt1909432:feat/add-skill-writing-session-status

Conversation

@mbt1909432
Copy link
Copy Markdown
Contributor

Why we need this PR?

This should close Issue (N/A)

Previously, session status went directly from "distilling" to "completed" after distillation, even though skill files were
still being written by the skill agent. This caused confusion for clients waiting for learning to complete.

Problem observed in logs:
[14:08:02] session 状态 = completed ← distillation done
[14:08:03] skills: files=1 ← but skill file not yet created
[14:08:15] skills: files=1 ← still not created
[14:08:26] skills: files=2 ← finally created (24s later!)

Clients thought learning was complete when wait_for_learning returned, but skill files were still being written.

Describe your solution

Added a new skill_writing status to the session lifecycle.

New status flow:
pending → distilling → skill_writing → completed

Changes made:

  • In skill_learner.py, set session status to skill_writing after distillation completes and before publishing to skill
    agent
  • The skill_writing status is automatically handled by existing wait_for_learning logic (it's not in the terminal
    set, so clients will continue polling until completed)

After this PR:
[14:08:02] session 状态 = skill_writing ← distillation done, writing files
[14:08:26] session 状态 = completed ← skill files fully written
[14:08:26] wait_for_learning returns ← client can now safely fetch files

Implementation Tasks

  • Added skill_writing status update in process_skill_distillation
  • Verified existing wait_for_learning handles the new status correctly

Impact Areas

Which part of Acontext would this feature affect?

  • Client SDK (Python)
  • Client SDK (TypeScript)
  • Core Service
  • API Server
  • Dashboard
  • CLI Tool
  • Documentation
  • Other: ...

Checklist

  • Open your pull request against the dev branch.
  • All tests pass in available continuous integration systems (e.g., GitHub Actions).
  • Tests are added or modified as needed to cover code changes.

Previously, session status went directly from "distilling" to "completed"
after distillation, even though skill files were still being written by
the skill agent. This caused confusion for clients waiting for learning
to complete.

New status flow:
- pending → distilling → skill_writing → completed

The "skill_writing" status indicates:
- Distillation has completed successfully
- SkillLearnDistilled message has been published to skill agent
- Skill files are being written/updated

This allows clients to:
1. Know exactly when distillation is done
2. Wait for actual skill file creation completion
3. Avoid race conditions when fetching newly created skill files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mbt1909432 mbt1909432 requested a review from a team as a code owner March 27, 2026 06:25
@GenerQAQ GenerQAQ merged commit c04370b into memodb-io:dev Mar 27, 2026
2 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.

2 participants