Skip to content

ACP: intra-turn visibility — tool lifecycle events, reasoning/thought surfacing, streamed text #196

Closed

Description

@ajianaz

What problem does this solve?

On the tole acp face, an entire turn renders in the host (Termul/Zed) as a bare "Working…" until the turn settles:

  1. Text is delivered as ONE agent_message_chunk after the whole turn completes (documented limitation: "v1 has no intra-turn streaming — the turn loop is synchronous"). A 30–60 s multi-tool turn shows nothing.
  2. Tool activity is invisible except when a permission prompt happens: AcpPrompt announces tool_call only in the approval path. ReadOnly tools and auto-allowed writes execute with zero notifications — the host shows no progress at all.
  3. Thinking/reasoning is dropped entirely: GLM-class providers return a reasoning field alongside content (verified live against bifrost: "message": {"content": "OK", "reasoning": "..."}), and tole parses only content.

An agent that visibly works (streams, shows tools, shows thought) feels orders of magnitude more trustworthy than one that is silent then answers. This is table stakes for editor-embedded agents.

Proposed solution

Phased, smallest-value-first — each phase independently shippable:

Phase 1 — tool lifecycle events (no provider changes). Give the turn loop an optional progress sink (observer callback/trait on run_turn, threaded through session_host to the ACP conn). Emit the full ACP tool-call lifecycle for EVERY execution: tool_call (pending) → tool_call_update (in_progress) → tool_call_update (completed/failed, with a small output preview). The approval-path announcements move onto the same path instead of being special-cased.

Phase 2 — reasoning as agent_thought_chunk. Parse the provider's reasoning field (OpenAI-compat GLM shape), carry it on the turn outcome alongside the final text, emit it as agent_thought_chunk before the answer. Non-streaming (one chunk at message end) — still a huge visibility win for "what is it doing in there".

Phase 3 — true text streaming. stream: true + SSE parsing in the provider, text deltas forwarded via the Phase-1 sink as incremental agent_message_chunks. This is a deliberate provider wire-shape change — it alters the request body byte-for-byte, so it lands with an updated Tier-1 wire contract (the cache-friendliness contract must be a reviewed, intentional change, not a drift) and the usage ledger still accounted from the final stream chunk. Durable JSONL entries keep storing the final message only — replay/resume semantics unchanged.

Alternatives considered

  • Streaming only (skip 1–2) — highest effort for the single most fragile piece; 1–2 deliver most of the perceived progress without touching the provider.
  • Polling-based pseudo-progress (heartbeats) — noise without information; the host already shows "Working…".

Are you willing to contribute the implementation?

Yes, I can do it

Activity

  1. added
    enhancement
    on Oct 6, 2026
  2. ajianaz commented on Oct 6, 2026

    @ajianaz
    ContributorAuthor

    Reference audit (epics/PRD/ACP spec/Termul) — what the agent SHOULD do

    Grounding the phased plan in the repo's own planning docs and the host's rendering capabilities; two gaps #196 originally missed, one scope addition.

    1. The repo's own documents already promise this

    • docs/epics.md → D2 (tole acp, issue feat: tole acp — Agent Client Protocol host (Phase D2) #95) — scope line: "ACP sessions ↔ JSONL sessions, ACP permission requests ↔ the approval gate, streaming turn events. Est: M." — marked ✅ DONE (2026-09-18). What actually shipped: the final answer as one chunk before the response. "Streaming turn events" is an unfinished item inside a story marked done. Implementing ACP: intra-turn visibility — tool lifecycle events, reasoning/thought surfacing, streamed text #196 = completing D2's own acceptance, not a new ambition. (epics.md status wording gets corrected in the same PR per §7 docs-sync.)
    • docs/prd.md → FR-P1 — the Provider trait is specified as "stream/chat completion" from day one. The current non-streaming provider is a subset of the PRD's own P0 surface.

    2. ACP spec gaps found in today's tool announcements (fold into Phase 1)

    The tool-calls spec defines a ToolKind taxonomy — "Tool kinds help Clients choose appropriate icons and optimize how they display tool execution progress": read | edit | delete | move | search | execute | think | fetch | other, plus an optional programmatic name field ("such as read_file").

    Today AcpPrompt hardcodes "kind": "other" and sends no name. Correct mapping falls straight out of the registry:

    tole tool kind
    read_file, tole_session_* read
    write_file, edit_file edit
    delete_file delete
    run_command, git, gh, gitea, job_start execute
    cora_search, uteke_recall search
    systemone_decide think
    agent_start / agent_poll think (subagent planning/monitoring)

    Registry-gated tools (cora/uteke/systemone) keep mapping only when present — the mapping is by tool name, computed from ToolRequest/specs, never assuming registration.

    3. Termul (the reference host) renders more than we send

    From Termul's ACP client (SessionUpdate handling) and its plan-compliance doc:

    • agent_thought_chunk is a first-class citizen (ChunkRole::Thought → thought bubbles) — Phase 2 lands on a host that already renders it.
    • Tool kind drives icons/progress — the Phase-1 kind mapping is what makes those icons correct.
    • PlanPanel exists and renders standard plan updates (full-replace semantics, entries[] with content/priority/status). Termul keeps a compliance registry of 37 bundled agents; agents that don't emit plans show an empty PlanPanel — tole is in that bucket today.

    4. Scope addition — Phase 4: plan updates via a model-facing update_plan tool

    Plans can't be emitted without a mechanism: register an ACP-face-only update_plan tool (Read-only-equivalent risk tier: it only emits a session/update plan notification; nothing durable, no side effects) with the same schema the spec/Termul render (content/priority/status). The default ACP system prompt gains one line telling the model to maintain its plan for multi-step tasks. This is how spec-standard agents populate Termul's PlanPanel — and it makes tole a verified standard citizen in Termul's compliance registry instead of unknown.

    5. Optional, not scheduled

    available_commands_update (Termul slash menu) and usage_update (context usage display) are both rendered by the host and both need product decisions (what ARE tole's slash commands? cost accounting is in the ledger already) — noted, out of scope for now.

    Revised phases

    1. Tool lifecycle events + name/kind mapping (spec-compliant announcements)
    2. Reasoning → agent_thought_chunk
    3. True text streaming (stream: true + SSE, deliberate Tier-1 wire-contract change)
    4. update_plan tool → standard plan updates (Termul PlanPanel)
  3. added a commit that references this issue on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions