8000 refactor(sessions): drop dead session, runtime, and event paths by geminixiang · Pull Request #197 · geminixiang/mikan · GitHub
[go: up one dir, main page]

Skip to content

refactor(sessions): drop dead session, runtime, and event paths - #197

Merged
geminixiang merged 1 commit into
mainfrom
refactor/simplify-sessions
Oct 26, 2026
Merged

geminixiang merged 1 commit into
mainfrom
refactor/simplify-sessions

Conversation

@geminixiang
Copy link
Copy Markdown
Owner

Stage 3 of docs/research/simplify-modules-2026-10.md (#196). Behavior-preserving; 13 files, +125 / −338.

Change Why it is dead or duplicated
Remove the owner walk (ownerOf, conversationOfProviderSession, ownedByContinuing, recordOwner, bindingOf, bindingOfProviderSession, conversationCreated) and its "delegate" test Only the retired subagent tool (ca5e581) created tool-owned child conversations. Task sessions are in the session index and bind directly. Restores the pre-600556cc continuation logic.
appendMessage / appendCustomEntry / appendCompactionSummary go through appendSessionEntry Same entry writes, written twice
Remove SessionStore.getContextEntries and SessionLifecycle.settle's markRunning No callers (markRunning was added for dream)
chat-history-sync: sortTime reuses parseMessageTimestamp; callers use SessionStore.exists directly Duplicate and pass-through
EventScheduler: resolve the bot once when scheduling; drop the missing_bot branch resolve() already rejects a missing bot and botsByPlatform never changes
conversation-runtime: build run attributes once; main.ts: drop resourceController, one purge interval Duplicate values

Deferred: moving migration-only import code to src/migrations/ (needs an owner decision). Not done (behavior changes): getSessionMessageText via contentText, a shared event-payload validator.

Verification

Check main branch
npm run typecheck pass pass
npm test 2033 passed 2032 passed (the removed delegate child test)
npm run duplication 1 clone 1 clone (unchanged)
Pre-commit gate pass pass

Eval: existing tests, typecheck, and source guards serve as the before/after baseline, as agreed for behavior-preserving refactors.

Pending: this changes the session continuation path, so slack-e2e.yml must pass before merge. Draft until then.

Risk: an unfinished child conversation left by the old subagent tool is now aborted on restart instead of continued with its owner; it could not finish after the upgrade anyway.

@cloudflare-workers-and-pages
cloudflare-workers-and-pages Bot commented Oct 26, 2026 •
Copy link
Copy Markdown

Deploying mikan with  Cloudflare Pages  Cloudflare Pages

Latest commit: 75e65f7
Status: ✅  Deploy successful!
Preview URL: https://58c2be62.mikan-1wv.pages.dev
Branch Preview URL: https://refactor-simplify-sessions.mikan-1wv.pages.dev

View logs

@geminixiang
geminixiang marked this pull request as ready for review October 26, 2026 10:20
@geminixiang
Copy link
Copy Markdown
Owner Author

Slack E2E: see the runs below. S-023 failures before #202 were the model handing the busy run to start_task (reply in the task thread); with #202's prompt applied on a temporary branch this PR passes 26/26.

Behavior-preserving cleanup after the subagent tool's retirement (ADR 0028):

- Remove the conversation owner walk (ownerOf, conversationOfProviderSession,
  ownedByContinuing, recordOwner, bindingOf, bindingOfProviderSession, the
  conversationCreated hook) and its test-only "delegate" tool test, restoring
  the pre-600556cc continuation and routing. Task sessions, the only other
  task-owned conversations, are in the session index and bind directly.
- Route appendMessage, appendCustomEntry, and appendCompactionSummary through
  appendSessionEntry.
- Remove the unused SessionStore.getContextEntries (and its mention in the four
  core-interfaces locales) and settle's never-passed markRunning option.
- chat-history-sync: sortTime reuses parseMessageTimestamp; callers use
  SessionStore.exists instead of the hasMaterializedChatSession pass-through.
- events: resolve the bot when an event is scheduled, so delivery has no
  unreachable missing-bot branch.
- runtime: build the run attributes once; main.ts passes the provisioner as
  the resource controller and purges token stores in one interval.
@geminixiang
geminixiang force-pushed the refactor/simplify-sessions branch from 96cc4a2 to 75e65f7 Compare October 26, 2026 10:52
@geminixiang
geminixiang merged commit 6a3f8c8 into main Oct 26, 2026
7 checks passed
@geminixiang
geminixiang deleted the refactor/simplify-sessions branch October 26, 2026 10:58
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

0