Skip to content

fix(output): preserve schema constants in approval resume hints - #151

Merged
yarolegovich merged 3 commits into
a2aproject:mainfrom
vathuluri:fix/structured-approval-resume
Nov 18, 2026
Merged

yarolegovich merged 3 commits into
a2aproject:mainfrom
vathuluri:fix/structured-approval-resume

Conversation

@vathuluri

Copy link
Copy Markdown
Contributor

Problem and change

Fixes #149. When an input-required Task carries a Structured Input object schema, the existing Resume: hint suggests a plain text reply. That loses constants such as the question's seq: retrying an answer after a timeout can then answer the next question rather than the one originally shown. The server-side sequence check is already available in a2aproject/a2a-serve#447.

For a tagged input schema with top-level constant properties, render a --data-part JSON template that copies those constants and adds placeholders for required variable fields. For example, the numbered approval schema produces --data-part '{"option":"<option>","seq":2}'. Constant names are generic; no a2a-serve-specific flag or task refresh is added. Required constants are retained rather than overwritten, and null/false constants are recognized. The template preserves shell metacharacters using POSIX single-quote escaping.

Ordinary text/auth-required hints and schemas without supported top-level constants retain their existing behavior. Update the bundled CLI skill to explain filling placeholders and retaining the same constants on retry. This covers existing Task resume hints; it does not add a new hint path for streamed status updates or implement full JSON Schema form generation. Agent addressing in resume hints remains separate work in #145.

Tests and validation

Go 1.26.11 on Windows:

  • Before the fix, three new output cases failed because they received the old plain-text hint.
  • go test ./internal/output passes. New table cases cover sequence constants, generic null/false constants, required constants, unchanged no-constant/array behavior, and shell quoting.
  • The new TestSend_NumberedResumeReplyCanBeRetried passes over a local REST test agent: the generated answer advances question 1 to question 2, and replaying that same answer leaves question 2 waiting. The existing input-required resume-hint test also passes.
  • go mod tidy -diff, go build ./..., and golangci-lint run --new-from-rev=origin/main pass (lint v2.11.4).
  • Full go test ./... -count=1 was run on both this patch and an untouched checkout of main at 68149c8: the same failing test names/packages occur in both, with no new failures. The Windows failures concern existing file-URL handling, plugin/config discovery, and shell-command tests. The patch has 501 passing test/subtest records versus 493 on main. This is not a claim that the full suite passes.
  • Full lint reports three formatting issues in unchanged files (devkit/cliplugin/cliplugin.go, devkit/cliplugin/doc.go, internal/chat/session.go); changed-code lint reports 0 issues.
  • Race tests could not start locally because a cgo C compiler is unavailable; Linux race CI remains required.

AI-assisted implementation and regression tests. All stated checks were executed locally with synthetic input and local test agents; no external model APIs or real approval actions were used.

@yarolegovich yarolegovich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix! let's rebase and update the approval examples in docs/reference/output.md, docs/guide/conversations.md and lessons/04-conversations, they now print the --data-part hint

Comment thread internal/output/output.go Resolved
Comment thread internal/output/structured_input.go Resolved
Comment thread internal/output/structured_input.go Resolved
Comment thread internal/output/output.go Resolved
@vathuluri
vathuluri force-pushed the fix/structured-approval-resume branch from 866cb3a to 86490fd Compare November 18, 2026 00:49
@vathuluri

Copy link
Copy Markdown
Contributor Author

Thanks @yarolegovich —addressed in 86490fd after rebasing onto main. Added the malformed-schema fallback and regression tests, restored the string return type, simplified property parsing, removed the redundant comment, and updated all three documentation examples. Kept because the documented status text lists allowed replies. All current CI checks pass, including Linux race tests, lint, all 11 demos, and Pages. AI-assisted revision.

structuredResumeData only feeds a best-effort hint, so it returns the
template or an empty string. The 04-conversations scenario answers with
the --data-part hint the lesson now shows.
@yarolegovich
yarolegovich merged commit 13cd6b1 into a2aproject:main Nov 18, 2026
17 checks passed
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.

Echo the question number (seq) of an input-required task in Resume: and answers

2 participants