refactor(agent-core-v2): fold the prompt queue into the agent loop service - #3747
Merged
sailist merged 11 commits intoSep 14, 2026
Merged
Conversation
|
commit: |
sailist
force-pushed
the
refact-206-09-13-delete-prompt-service
branch
from
September 14, 2026 06:51
9c8350e to
2faf3ec
Compare
…rvice Delete AgentPromptService/IAgentPromptService: prompt submit/queue/steer/ abort now ride the agent machine queue through IAgentLoopService's extended surface (submitPrompt/submitSteerPrompt/enqueuePrompt/steerPrompts/ abortPrompt/drainPrompts/injectPrompt/retryPrompt/promptQueue plus hooks.onBeforeSubmitPrompt and the promptAdmission reservation slot). Durable prompt.* event classes move to agent/prompt/promptEvents.ts and keep their registrations; promptAdmissionKey keeps its fold. Dead assets go away: promptResolutionKey, PROMPT_ALREADY_COMPLETED (kap-server 40903 path), promptLaunchingKey and clear(). Compaction gating (queue while compacting, resume on finish) moves into the loop reservation drain. The 'agentPromptService' wire name keeps its shape: a thin AgentPromptChannel facade (same decorator id) forwards submit/submitSteer to the loop, so klient memory/ipc/debug transports and the kap-server dispatcher are unchanged.
Rewrite promptService.test.ts (25 cases, count unchanged) against the real AgentLoopService with the scripted-LLM harness, fold the launch-window reservation out of promptQueue().pending to match the old snapshot contract exactly, and update the debug-channels pin to the facade's submit/submitSteer surface.
Match the deleted service's microtask position: prompt.completed/aborted and the completion deferreds fire from a result.then chain attached at bind time instead of synchronously inside endTurn, so wire/emit ordering with post-turn producers (tool unregister, next-prompt launch) stays identical to the baseline snapshots. Steered children move onto the reservation so the chain can settle them after the active turn is gone.
…i-id steer, gate rewrite, and pause
…gistry fed by machine events
sailist
force-pushed
the
refact-206-09-13-delete-prompt-service
branch
from
September 14, 2026 07:03
2faf3ec to
63d325e
Compare
5 tasks
This was referenced Sep 15, 2026
7723qqq
added a commit
to 7723qqq/kimi-code
that referenced
this pull request
Sep 15, 2026
- MoonshotAI#3750 loop_control.compaction_max_attempts caps one compaction round's requests (default 5, upstream's, replacing the hardcoded 10) - MoonshotAI#3785 reject an unsupported [secondary_model].default_effort at load time, and surface adaptive_thinking on the catalog model - MoonshotAI#3681 warn on [models] entries missing the model field - MoonshotAI#3752 tower resolves a caller by its last roster entry and retires duplicate agent ids; only ENOENT means an uninitialized workspace - MoonshotAI#3778 evict completed subagent scopes behind an LRU cache (KIMI_CODE_SUBAGENT_SCOPE_CACHE_SIZE, default 32) and rebuild them from the persisted resume record on demand - MoonshotAI#3747 aborting an unknown or already-settled prompt answers 40402 instead of 40903, end to end through the protocol and kimi-web - MoonshotAI#3720/MoonshotAI#3717 scope task notifications by session, so one session's print turn can no longer consume another's completion The allowlist verdicts move to ported where the behavior landed, and ROADMAP 6.1 records the evidence and what stayed open.
5 tasks
5 tasks
sailist
added a commit
that referenced
this pull request
Sep 19, 2026
…story API) (#3532) (#3920) This reverts 64505e3. The v1 WS + legacy REST + transcript surfaces are alive on main and remain the single protocol surface; kimi-inspect returns to the transcript-based data model (keeping #3747's removal of the prompt input, which adapted to the agent-core-v2 prompt-queue fold).
Leeeon233
added a commit
to LodyAI/acp-extension-kimi
that referenced
this pull request
Sep 24, 2026
* feat(kimi-code): carry turn trace id and copilot stats in rating surveys (MoonshotAI#3907) * feat: expose resolved base_url on models.dev catalog provider items (MoonshotAI#3909) * fix(agent-core-v2): restore thinking for the openrouter reasoning dialect (MoonshotAI#3910) Keep string reasoning fields when a reasoning_details array is present, stamp each think part by source, and replay those fields on the next request. * ci: release packages (MoonshotAI#3862) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * docs(changelog): sync 2.0.1 from apps/kimi-code/CHANGELOG.md (MoonshotAI#3912) * fix(agent-core-v2): pre-shrink compaction history to the effective model window (MoonshotAI#3911) * fix(vscode): ignore Enter during IME composition in question dialog (MoonshotAI#3915) * fix(kap-server): deliver session-level interaction events past agent filters (MoonshotAI#3901) * revert(kap-server): drop the flat entity message protocol (v3 WS + history API) (MoonshotAI#3532) (MoonshotAI#3920) This reverts 64505e3. The v1 WS + legacy REST + transcript surfaces are alive on main and remain the single protocol surface; kimi-inspect returns to the transcript-based data model (keeping MoonshotAI#3747's removal of the prompt input, which adapted to the agent-core-v2 prompt-queue fold). * feat(oauth): parse goods_version from the managed /me profile payload (MoonshotAI#3921) * fix: keep turn ids above the wire-wide max and fold cold transcripts over the active branch (MoonshotAI#3922) * fix(agent-core-v2): floor the human turn clock at the wire-wide max on engine journal reset * fix(kap-server): fold the cold transcript snapshot over the restorable branch chain * fix(agent-core-v2): advance the human turn clock when a turn starts * fix(kap-server): split reused wire turn ids in the live transcript projector * fix(kap-server): adopt the completed cold tip for mid-turn attach events Continuation deltas after a lazy transcript attach belong on the last cold turn, not a newly split export id. * fix(agent-core-v2): remove the project-root assertion for cwd from the system prompt (MoonshotAI#3929) Co-authored-by: 7Sageer <7sageer@djwcb.cn> * chore: remove the tdd skill (MoonshotAI#3932) * fix(agent-core-v2): don't record turn.steer when an unconsumed steer seeds the next turn (MoonshotAI#3933) * chore: sync web dist from code-app (MoonshotAI#3934) * chore: sync web dist from code-app code-app: 44d7281c7a63ee3c7a907f9406e490efdbec7411 * chore: collapse web dist sync changesets into one summary entry * ci: release packages (MoonshotAI#3913) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * feat: generate native Kimi ACP session titles (#15) --------- Co-authored-by: Grapedge <shiwang.lj@alibaba-inc.com> Co-authored-by: liruifengv <liruifeng1024@gmail.com> Co-authored-by: Haozhe <yanghaozhe@moonshot.ai> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 7Hanrui <qihanrui@moonshot.ai> Co-authored-by: 7Sageer <7sageer@djwcb.cn> Co-authored-by: Zixuan Chen <remch183@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Internal refactor tracked in the agent-core-v2 task system (delete PromptService after the human agent machine queue landed in production via #3737).
Problem
The agent machine queue is already the state-independent first-class queue on the production path, so
AgentPromptService's privatepending/activequeue is a duplicate existence for prompt submit/queue/steer/abort. Keeping both means two queue semantics to reason about and to keep in sync for every lifecycle change.What changed
AgentPromptService/IAgentPromptServiceand their Agent-scope registration (agent/prompt/promptService.ts,agent/prompt/prompt.ts), plus dead assets:promptResolutionKey,PROMPT_ALREADY_COMPLETED(including the kap-server 40903 path),promptLaunchingKey, andclear().AgentLoopService: reservations are the queue items;IAgentLoopServicegainssubmitPrompt/submitSteerPrompt/enqueuePrompt/steerPrompts/abortPrompt/drainPrompts/injectPrompt/retryPrompt/promptQueue,hooks.onBeforeSubmitPrompt, and thepromptAdmissionreservation slot. A serializeddrainPromptQueuelaunches one prompt at a time (launch-window reservations stay out of the snapshot, matching the oldlist()contract).submitted/queued/started/completed/aborted/steered) fire at the baseline points with baseline payloads —startedright after bind materialization, completions on the turn-result chain — pinned by the existing inline wire/event snapshots.prompt.accepted/completed/aborted/steeredkeep their durable registrations (agent/prompt/promptEvents.ts) andpromptAdmissionKeyits fold, so existing wire.jsonl replays identically (verified by the resume/undo suites).AgentPromptChannelfacade keeps the'agentPromptService'decorator id and thesubmit/submitSteerRPC shapes, so klient memory/ipc/debug transports and the kap-server dispatcher are unchanged; all 12 internal consumers plus kap-server routes/transcript/projection, the CLI print runner, and kimi-inspect now targetIAgentLoopService/IAgentPromptChannel.Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.