fix(kap-server): keep foreground tasks out of REST polling - #1644
fix(kap-server): keep foreground tasks out of REST polling#1644wbxl2000 wants to merge 5 commits into
Conversation
Accumulate the per-session live subagent roster in the broadcaster's dispatch queue and expose it via getSnapshotState, so the web client can rebuild swarm cards after a page refresh. Both snapshot assembly paths (SnapshotReader and the legacy resume path) pass it through as the optional subagents field.
agent-core-v2 registers foreground Agent runs in the task service too (detached: false, so the LLM can drive them via TaskList/TaskOutput/ TaskStop). The REST projection dropped that distinction and the web client defaults subagent tasks to background, so foreground subagents showed up in the dock as entries that never settle and cannot be stopped. Add the optional run_in_background field to the protocol Task schema and project info.detached onto it; older servers keep omitting the field and the client default stays correct for them.
🦋 Changeset detectedLatest commit: 6ed6743 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@codex review |
commit: |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2bd6a8b5cb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3ff5bd159
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…nd-subagent-task-projection
Related Issue
Related to #1623. Independent from #1645.
Problem
On the v2 backend, foreground Agent runs are present in the internal task service with
detached: false. The/api/v1task list exposed them as incomplete REST task records, while foreground subagent identity and grouping belong to the snapshot and WebSocket roster. A Web task refresh could therefore add or replace the richer foreground entry with a record that lacked its parent tool call, subagent type, and swarm index.What changed
GET /api/v1/sessions/{sid}/tasksbackground-only by filteringdetached: falserecords, matching the v1 endpoint.Task.run_in_backgroundprojection for precise GET-by-id compatibility; a directly requested foreground task reportsfalse.Foreground roster recovery remains owned by the existing snapshot + WebSocket path from #1623. No Agent/swarm stop behavior from #1645 is included here.
Verification
test/tasks.test.ts, 12 tests passed; typecheck.test/workspace-state.test.ts, 48 tests passed; typecheck; production build.check:style: baseline mode, 29 existing warnings, no failure.git diff --check origin/main.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.