githubnext/chopinPublic

Let's compose rich plans together

Stream Planner tool calls from their own start and end, including Atomic's own tools #314

Mergedlavaman131merged 4 commits intomainfromrefs/pull/314/head
  1. LA

    A Planner turn looks frozen in Chat. A tool row only appears once the model has finished writing its input, and only settles when the harness finishes the whole model step, so its duration covers the step instead of the tool. Under `HARNESS=atomic`, Atomic's builtin, extension, workflow and subagent tools (bash, read, workflow, subagent…) never reach Chat at all. If they did, the fixed `PLANNER_TOOL_NAMES` check would abort the turn.

    This PR fixes the data side only. **The chat presentation belongs to @MaggieAppleton's design work (#296, #162)**, so `apps/web` is unchanged and every protocol addition is optional.

    ## What changes

    - **Protocol** (`packages/protocol/chat.d.ts`, all optional): `Activity.startedAt` (server time when the tool's input began), `Activity.refused`, and `Turn.startedAt` in milliseconds. A client that ignores them keeps working. - **Tool rows from the tool's own start and end** (`apps/server/src/chat/service.ts`): - A row opens on `tool-input-start`. - It settles when the tool itself finishes. `HarnessAgent` buffers host-tool results until step end, so `agents.ts` wraps `execute` to report completion straight away, and the buffered part then finds the row already settled. - Partial output updates the running row. - Running rows are marked failed when a turn ends or a room is restored. - **Redaction** (`chat/activity.ts`): args and results are truncated to 4,000 characters, with token, password and API-key fields and `ghp_` / `github_pat_` / `sk-` / `Bearer` values masked. Plain-text output gets the same treatment, so credential-looking `KEY=value` and JSON pairs in a file or command result are masked too, including nested MCP content and line-numbered file reads. `read_reference` output stays private. - **Atomic's own tools** (`harness/atomic/adapter.ts`, `session.ts`, `full.ts`): - `tool_execution_start/update/end` and tool-call input streaming become stream parts for tools Atomic runs itself. Nested subagent calls stay under their parent row. - A full session's allowed set is its running turn's active tools. - `copilot-sdk` and `pi` still fail closed on any tool outside their fixed set (regression test). - **Reasoning is deliberately not sent to clients.** It can quote `read_reference` content that is private to the Planner, and whether to show it is a design call for #296.

    ## Rebased on #296

    #296 has merged and this branch is rebased on `main`. `begin(handle, entryOffset)` now sets #296's `Turn.entryOffset` alongside `startedAt`, and #296's failed-tool frames, reasons and guarded session cleanup are kept. Two follow-up commits:

    - **Preserve stopped-tool status and streaming fixtures after main rebase**: an aborted Planner question is no longer marked done, and the streaming e2e test uses #296's composer locator. - **Redact credentials in textual Planner tool activity**: the plain-text redaction above, with broadcast and history regression tests.

    ## Verification

    Real GitHub, `githubnext/pdd-demo`, `HARNESS=atomic`, final build, with `main`'s UI unchanged. Atomic's builtin `Bash` row appears live, then settles at **4.9s** for `sleep 4`: its own duration, not the turn's. The server log has no boundary failure.

    ![Bash running live](https://github.com/user-attachments/assets/aa8b3f6b-f3e0-48aa-87e2-e318f77873f1) ![Settled at its own duration](https://github.com/user-attachments/assets/4da25c0f-def4-4cc7-974a-b3105270de6b)

    - `bun run e2e e2e/harness.e2e.ts e2e/smoke.e2e.ts e2e/responsive-activity.e2e.ts`: 28 passed. The new wire tests record WebSocket frames: the busy state comes before any text, the tool row settles at its own ~2.5s end inside a 7.5s turn, and a reload mid-turn restores the running row and turn start from history without reasoning. - `bun test`: 3685 pass, 3 skip, 0 fail. This covers translate cases for input streaming, own-end settlement, boundary failures and reasoning privacy, plus the Atomic `tool_execution_*` and input-streaming adapter cases. - `bun run types` and `bun run ci` pass, with no new Impeccable findings. - After the rebase: `bun test` 4026 pass, 3 skip, 0 fail; `bun run types` and `bun run ci` pass; harness, smoke and responsive-activity e2e 33 passed.

    Refs #306

    Assistant-workflow: goal (run 1e1a9fe2-7263-4372-9eb3-31c679ccb69e), finished inline Assistant-duration: 3h15m converged, estimated 2h30m Assistant-verification: bun test passed: 3685 tests, 0 fail Assistant-verification: playwright e2e passed: harness, smoke, responsive-activity, 28 passed Assistant-verification: bun run types and bun run ci passed Assistant-verification: real GitHub QA passed: pdd-demo, HARNESS=atomic, builtin Bash live and settled at 4.9s for sleep 4, no boundary failure User-preference: Don't overlap teammates' in-flight UI work; leave chat, composer and design changes to Maggie's design track (#296) User-preference: Don't show Planner reasoning where it conflicts with Maggie's design Assistant-workflow: pr-rebase-ci-green (run 660a74b8-146d-4c33-939e-d959a450dc42), follow-up rebase inline Assistant-duration: 56m converged, estimated 1h15m Assistant-verification: bun test passed: 4026 pass, 0 fail after rebase on latest main Assistant-verification: bun run types and bun run ci passed after rebase on latest main Assistant-verification: playwright e2e passed: harness, smoke, responsive-activity, 33 passed Assistant-verification: GitHub CI passed: container, format/lint/types/tests, e2e on fff49fe0 User-preference: Run workflow stages and their subagents on -fast models (gpt-6-luna-fast, gpt-6.1-sol-fast, claude-opus-5-5-fast) Co-authored-by: Alex Lavaee <lavaman131@github.com>

  2. MaggieAppletonmentionedlast month on GitHub

  3. MaggieAppletonsubscribedlast month on GitHub

  4. lavaman131assigned lavaman131last month on GitHub

  5. lavaman131head-ref-force-pushed 594ec938da80last month on GitHub

  6. lavaman131head-ref-force-pushed 17d4f44314balast month on GitHub

  7. lavaman131referenced 168b4551040flast month on GitHub

  8. MaggieAppletonhead-ref-force-pushed 3afbf324667dlast month on GitHub

  9. MaggieAppletonhead-ref-force-pushed 188ca565b522last month on GitHub

  10. github-actions[bot]botreferenced this in Tagging Chopin in the chat hides the tagged user #150last month on GitHub

  11. MaggieAppletonhead-ref-force-pushed 384a77394e87last month on GitHub

  12. MaggieAppletonhead-ref-force-pushed 02953e7bda07last month on GitHub

  13. MaggieAppletonhead-ref-force-pushed 86cd9157d512last month on GitHub

  14. lavaman131head-ref-force-pushed 75048077b9fflast month on GitHub

  15. lavaman131head-ref-force-pushed fff49fe02993last month on GitHub

  16. lavaman131merged 7d8b57cc94aalast month on GitHub

  17. lavaman131closedlast month on GitHub

  18. lavaman131head-ref-deletedlast month on GitHub