Skip to content

fix: preserve informational agent results - #482

Draft
Astro-Han wants to merge 1 commit into
LodyAI:mainfrom
Astro-Han:fix/451-info-notice-outcomes
Draft

fix: preserve informational agent results#482
Astro-Han wants to merge 1 commit into
LodyAI:mainfrom
Astro-Han:fix/451-info-notice-outcomes

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related issue

Refs #451

Problem / pressure

Pi can successfully handle a command without starting a model turn. Desktop acceptance answered an extension question and confirmed its saved answer, but Lody marked the turn as failed because no visible result reached the conversation. Retrying such a command can repeat its side effects.

Core already defines informational notices; Lody parses their level but forwards only warnings and errors.

Summary

Consume info through the existing agent notice pipeline, preserve each occurrence and render it neutrally. Retain the existing history discriminant and the default warning meaning for old records. Informational results do not suppress a later warning with the same text.

The Pi producer is in LodyAI/acp-extension-pi#1. It emits the notice only after native input handling completes without starting a model run. This consumer requires no new Core release and is independent of MCP opt-out #479 and Stop/steer #471.

Visual explanation

The adapter owns proof of native input completion. This PR completes the existing Lody notice consumer across CLI, shared history and UI:

flowchart TD
    A["Adapter: establish native input completion"] --> N["Core LodyNotice: level, message, source"]
    subgraph CLI["Lody CLI"]
        N --> V["AgentClient validates notice"]
        V -. "Before: info discarded here" .-> X["No visible informational result"]
        V -->|"After: forward all notice levels"| Q["Existing notice queue + history gate"]
        Q --> I{"Informational?"}
        I -->|Yes| E["Retain every occurrence"]
        I -->|No| W["Keep warning deduplication; ignore info matches"]
    end
    subgraph History["Shared durable history"]
        E --> H["system_notice / agent_warning<br/>Preserve optional level"]
        W --> H
    end
    subgraph UI["Conversation UI"]
        H --> L{"level = info?"}
        L -->|Yes| P["Neutral notice; role=status"]
        L -->|"No / legacy missing level"| G["Warning presentation; role=alert"]
    end
Loading

Notice text stays separate from assistant prose. Empty model output still follows the existing silent-failure check.

Before / after

Before After
A successful command with no model reply can appear as a failed turn. Its explicit informational result is retained and shown without pretending to be model prose.
Repeated identical notices share warning-style session deduplication. Each informational occurrence is retained; existing warning suppression remains.
Empty model responses receive silent-failure handling. The same protection remains.

Test plan

  • pnpm check, pnpm format and pnpm run docs check passed.
  • Independent consumer review passed 145 related tests with no P0/P1.
  • Astra removed a duplicate schema-only test: the single ACP-to-history regression parses the stored result through the public schema and fails if level is stripped.
  • Real Pi experiments separated successful command/input handling, handler errors and empty model output. No completion notice is emitted for the latter two branches.
  • Original desktop acceptance will be repeated after the combined build; it is not yet claimed as passing.

Context handoff

Instructions for reviewing agents

  • Review focus: Follow Core notice severity through AgentClient, the existing queued history writer, the shared schema and agent_warning renderer.
  • Decisions to challenge: Retain the legacy discriminant and warning defaults while recording each info occurrence; do not add a second notice queue or command outcome protocol.
  • Plausible failures / evidence gaps: Check repeated equal info messages, an equal-text warning after info and old records; original desktop acceptance remains pending.

Authoring context

  • User goal / directives: Validate a usable Pi adapter end to end and fix actual authority or contract gaps using independent review and Astra design experiments.
  • Constraints / non-goals: No change to the silent-model-output guard, invented assistant text, model tool calls, MCP implementation or Stop ownership.
  • Risk-bearing decisions: Native command completion is the producer's authority; Host consumes the existing severity contract and keeps notice text separate from assistant prose.
  • Destructive or irreversible behavior: No migration or history rewrite. New records add optional severity, and rollback leaves their existing notice discriminator readable.
  • Deliberately not done or tested: No generic command outcome protocol or inference from answered questions; neither proves a completed native command.
  • Unknowns / confidence: Real Pi discrimination experiments support the producer boundary; consumer tests passed; combined desktop acceptance determines readiness. This PR remains Draft.

@github-actions github-actions Bot added status:needs-pr-attention External PR needs contributor attention before review and removed status:needs-pr-attention External PR needs contributor attention before review labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant