Skip to content

refactor(antigravity): reuse parseElicitationForm and harden ask_question companion handling - #1

Open
tooooolong wants to merge 2 commits into
neurovariant:fix/antigravity-ask-question-elicitationfrom
tooooolong:fix/antigravity-ask-question-pr40547-followup
Open

tooooolong wants to merge 2 commits into
neurovariant:fix/antigravity-ask-question-elicitationfrom
tooooolong:fix/antigravity-ask-question-pr40547-followup

Conversation

@tooooolong

@tooooolong tooooolong commented Nov 23, 2026 •

Copy link
Copy Markdown

Companion PR for pingdotgg#40547 (fixing pingdotgg#37111).

We ran into the same Antigravity ask_question double-card bug and went through a couple of review passes before realizing you already had pingdotgg#40547 open. Rather than opening a duplicate PR upstream, here are the structural refinements, edge-case fixes, and discussion follow-ups rebased directly onto your branch.

What this changes

  1. Reuse canonical parseElicitationForm in a focused module (AntigravityElicitationForm.ts)

    • Re-exports parseElicitationForm from packages/provider-acp/src/server/adapter.ts (+1 line) and extracts the Antigravity elicitation logic out of AntigravityProtocol.ts into apps/server/src/provider/acp/AntigravityElicitationForm.ts.
    • Delegates JSON Schema validation, option extraction, minItems/maxItems enforcement, and typedAnswer validation to parseElicitationForm instead of re-implementing them, and keeps AntigravityProtocol.ts free of upward AcpAdapterV2Flavor imports.
  2. Tighter native ask_question matching (protects ordinary MCP forms & cognition.ai/allowOther)

    • Requires every property in the form to be a q<N> question or its matching q<N>_other companion (title === "Other", description starting with "Optional free-form answer to:" matching the trimmed question title—tolerating leading whitespace in title), with no non-empty field.description.
    • Defers requests with _meta["cognition.ai/allowOther"] === true to the generic parser so explicit allow-other schemas keep writing free-form answers back to the primary field instead of _other.
  3. Strict, co-located attachment suffix parsing (userInputAttachments.ts)

    • Exports isUserInputAttachmentReference and splitUserInputAttachmentSuffix alongside appendUserInputAttachmentPaths.
    • Validates each \n-joined attachment line with JSON.parse on the quoted label/path literals (so hand-typed incomplete quotes or invalid escapes like 1\n\nAttached file "example": "C:\docs\spec" are not falsely split as option + attachment) and splits at lastIndexOf("\n\n") so option values containing \n\n still split cleanly.
  4. Explicit [], minItems/maxItems, and valid blank single-select options

    • Multi-select preserves explicit { q1: [] } (including when attachments are appended) when minItems === 0, and cancels out-of-bounds [attachment] payloads when minItems >= 1.
    • Single-select checks exact declared option matches before rejecting blank custom text.
  5. Real makeAntigravityAdapterV2 stdio JSON-RPC tests (also resolves CodeRabbit's duplicate-test nitpick)

    • Consolidates elicitation coverage into AntigravityAdapterV2.test.ts (removing the duplicate assertions from AntigravityProtocol.test.ts) and adds real makeAntigravityAdapterV2 + acp-mock-agent.ts round-trip tests using real appendUserInputAttachmentPaths output, verifying both native 2-question folding and intact ordinary MCP form fallback on the same adapter.
  6. Update Antigravity user docs (docs/user/providers-antigravity.md)

Scope decision

  • Kept intentionally server-side only (no changes to packages/contracts, packages/client-runtime, apps/web, or apps/mobile), preserving T3's existing mutually-exclusive option vs. custom-answer card UX.

Before / After (Web UI)

Before (2 questions → 4 steps, duplicate optionless "Other" card) After (2 questions → 2 steps, question text in body)
Before step 1 of 4 After step 1 of 2
Before step 2 of 4 duplicate Other After step 2 of 2

Verification

  • vp fmt --check, vp lint (0 warnings, 0 errors), vp run knip:check
  • vp run --filter @t3tools/provider-acp --filter t3 typecheck
  • vp test run: 123/123 passed (AntigravityAdapterV2.test.ts, AntigravityProtocol.test.ts, userInputAttachments.test.ts)
  • Manual Web UI verification against isolated dev state (screenshots above)

Built with Gemini 4 Neon (Antigravity harness in T3 Code), reviewed with Codex GPT-6.2 Astra.

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