Skip to content

feat: align typed session failures with AIR protocol - #393

Open
nikita-ashihmin wants to merge 4 commits into
agentclientprotocol:mainfrom
nikita-ashihmin:codex/ijai-993-warning-severity-advisories
Open

feat: align typed session failures with AIR protocol#393
nikita-ashihmin wants to merge 4 commits into
agentclientprotocol:mainfrom
nikita-ashihmin:codex/ijai-993-warning-severity-advisories

Conversation

@nikita-ashihmin

@nikita-ashihmin nikita-ashihmin commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

AIR renders agent failures as persistent inline transcript entries. The existing extension exposed a larger provider-specific shape and sent retry diagnostics through a separate _meta.codex.error path, while warning notifications were flattened into assistant text.

That made presentation inconsistent and gave the client no stable way to update one reconnect incident without appending repeated messages.

Change

Aligns _meta.jetbrains.air.sessionFailure with the AIR v1 contract:

  • required id, revision, category, severity, title, and actions
  • optional details only when the explanation is too large for title
  • broad categories: connection, access, limit, request, service, unknown
  • actions: retry, login, new_session
  • removes phase, source, safeMessage, retryable, turnId, and provider error codes from the wire record

For app-server errors, title is the exact user-facing TurnError.message produced by Codex. The adapter does not replace it with category-specific canned wording. This preserves native messages such as Reconnecting... 1/5, including retry progress already encoded by Codex. TurnError.additionalDetails remains private diagnostic data and is not forwarded. Adapter-authored fallback text exists only for failures outside a Codex turn error, such as process exit before Codex can report one.

Retrying errors arrive as severity: "warning" records, reusing the incident id and incrementing revision. A terminal failure updates that incident to severity: "error". Historical entries are not deleted.

Warnings, config warnings, and deprecation notices use the same typed record when the capability is negotiated. Consecutive duplicate warnings reuse one id and advance its revision; a later independent occurrence receives a new id. Short notice details are folded into title, while genuinely long explanations use details.

Legacy behavior remains unchanged when AIR does not advertise sessionFailure support.

Scoped out deliberately

  • thread/compacted keeps its existing informational transcript line.
  • guardianWarning remains represented by its existing guardian tool flow.
  • windows/worldWritableWarning remains unchanged because its structured path list needs dedicated presentation.

Validation

  • npm run typecheck
  • npx vitest run src/__tests__/CodexACPAgent/typed-session-failure-wire.test.ts src/__tests__/CodexACPAgent/auth-error-events.test.ts src/__tests__/CodexACPAgent/plan-review-events.test.ts — 62 passed
  • npm test — 409 passed, 28 skipped
  • npm run build

Client side: IJAI-993.

Codex reports non-fatal advisories as dedicated app-server notifications, but
codex-acp flattened them into assistant text: `warning` became
`Warning: <message>` and `configWarning` became `Config warning: <summary>`,
both as an untagged `agent_message_chunk`. The client could not tell them from
the model's own words, so a compaction hint rendered as if the agent had said it.

Extend the typed session-failure extension from agentclientprotocol#383 rather than adding a
parallel notice concept: a record now carries an optional `severity` of `error`
or `warning`, plus an `advisory` category whose wording comes from the
app-server. Clients that negotiated the `sessionFailure` capability receive the
structured record; everyone else keeps the existing text, unchanged.

Advisories live in their own `sessionNotice` slot under a `:notice` id, so they
never disturb the revision bookkeeping of an in-flight terminal failure — the
two records coexist and the client decides which to show.

`severity` is optional on the wire and absent means `error`, so an AIR build
that predates this change keeps treating every record it receives as a failure.

Scoped out deliberately: `thread/compacted` keeps its italic transcript line
(informational, not a warning), and `guardianWarning` / `deprecationNotice`
remain dropped as before.
deprecationNotice carries the same {summary, details} shape as configWarning,
so treating the two differently was inertia, not design: it was simply already
being dropped.

Unlike warning and configWarning it has no legacy text rendering to preserve,
so it is emitted only to clients that negotiated typed records. A client that
did not must keep seeing exactly what it sees today, which is nothing.

Extracts joinSummaryAndDetails so the two notifications share one formatting
rule rather than repeating it.
@nikita-ashihmin nikita-ashihmin changed the title feat: expose warning-severity advisories for AIR feat: align typed session failures with AIR protocol Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant