Skip to content

feat(kimi): modularisation + lifecycle and observation fixes - #106

Merged
aannoo merged 3 commits into
aannoo:mainfrom
mmkzer0:feat/kimi-dropout-fix
Sep 13, 2026
Merged

aannoo merged 3 commits into
aannoo:mainfrom
mmkzer0:feat/kimi-dropout-fix

Conversation

@mmkzer0

@mmkzer0 mmkzer0 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Motivation

Live multi-agent decks (kimi + omp/codex partners) were dropping kimi identity and "losing" inbound messages mid-turn. Hard SessionEnd, dual hcom/uvx hcom hook rows, and missing empty-Stop → listening left agents orphaned or stuck active. Separately, Kimi treats PostToolUse/Notification as observation-only, but hcom still prepared and acked pending delivery there — the cursor advanced while the model never saw the text. This branch modularises the kimi hook surface (same layout as omp) and fixes those lifecycle and observation bugs together so the behaviour is reviewable and the file is easier to extend.

Summary

  • Split kimi.rs into kimi/{mod,config,handlers,tests}.rs (omp-style module layout).
  • Lifecycle/guards: empty Stop → listening; soft SessionEnd when pid alive / launched; SessionStart orphan refuse; dual-prefix hook strip; directory field fix.
  • Observation fix: PostToolUse/Notification are delivery no-ops; Stop defers delivery_ack until Block stdout; UPS unchanged.
  • Unit tests for cursor invariant and lifecycle guards; live deck showed healthy UPS/Stop delivery and no post-deploy vanish windows.

Test plan

  • cargo test -p hcom hooks::kimi
  • cargo fmt / cargo clippy -p hcom -- -D warnings
  • Live: mid-turn pending held through PostToolUse; Stop exit 2 / UPS deliver; nela listening

mmkzer0 and others added 3 commits August 11, 2026 21:13
- broke out kimi hook into structured module + tests
- fixed stop semantics to signal proper listen + notify
- gate tool for session end and guard primary
- finalise when pid alive or launched+bound -> mirror omp
- deny orphan bind and dual-prefix hook (hcom vs uvx hcom bug)
- No-op PostToolUse/Notification so ignored hook output cannot advance the cursor
- Defer Stop delivery_ack until Block stdout is written (HookResult::Block field)
- Unit-test the cursor invariant; pending Stop stays active until empty Stop
@aannoo

aannoo commented Sep 13, 2026

Copy link
Copy Markdown
Owner

nice

@aannoo
aannoo merged commit 4a0c408 into aannoo:main Sep 13, 2026
30 of 31 checks passed
orgoj added a commit to orgoj/hcom that referenced this pull request Sep 13, 2026
… module)

Upstream fabb309 brings the runner Node-precedence fix (aannoo#117), the grown
CODEX_HOME resolution (aannoo#115), Ptyxis support (aannoo#113), the Windows nested
PowerShell removal (aannoo#137) and the kimi modularisation (aannoo#106).

Conflicts resolved in upstream's favour:
- codex.rs / codex_preprocessing.rs: the fork's cherry-picked 080c78a used a
  thread-local CODEX_HOME override; upstream's explicit `*_at` threading
  replaces it, so the wrapper functions and the thread-local are dropped.
- launcher.rs: upstream's case-insensitive effective-env helpers and the
  earlier canonical_dir are taken; the fork's per-instance system-prompt
  path stays and upstream's global gemini system-prompt block is dropped.
- kimi: upstream's src/hooks/kimi/ module replaces the fork's kimi.rs (it
  already carries the fork's lifecycle and observation fixes); only the
  fork's nested-identity gate `hook_gate_check_for_tools` is re-applied.
- terminal_presets: expected preset count raised to 30 for Ptyxis.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDRs6TVA2uSBXG2TQacFRf
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