Skip to content

docs(spec): cover query fields through contract 2.25 - #6113

Merged
kovtcharov-amd merged 2 commits into
amd:mainfrom
huong8373tt-beep:gaia-6095
Oct 30, 2026
Merged

kovtcharov-amd merged 2 commits into
amd:mainfrom
huong8373tt-beep:gaia-6095

Conversation

@huong8373tt-beep

@huong8373tt-beep huong8373tt-beep commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6095.

The strict /query JSON schema stopped at contract 2.18. Validating clients therefore rejected five fields the flagship server has accepted since 2.19–2.25.

This updates both the request-field table and strict schema for:

  • changes_turn_id (2.19), including session_id dependency
  • surface (2.20), constrained to agent_ui, tui, or cli
  • internet_off (2.23)
  • working_directory (2.24)
  • turns (2.25), as an array of arrays of objects

Validation:

  • Parsed the documented JSON schema with Python’s JSON parser and asserted all five fields, the surface enum, the changes_turn_id → session_id dependency, and nested turns shape.
  • python -m py_compile hub/agents/gaia/python/gaia_agent/server.py
  • git diff --check

This is based on current main, which already includes #6061’s 2.18 documentation.

Disclosure and authorization

Slai Agent Runtime performed the investigation, implementation, and test execution. The account owner authorized this contribution and is responsible for its content.

@github-actions github-actions Bot added the documentation Documentation changes label Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

The spec's /query field table and strict JSON schema now cover the five fields the flagship server added between contract 2.19 and 2.25. Before this, a client validating against the documented schema rejected requests the server accepts. I checked every new row and schema entry against the server's request model, and the versions, types, enum values and the "needs a session" rule all match. Nothing blocks the merge.

Two optional tightenings would bring the schema closer to what the server enforces. Without them, a client that passes the documented schema can still get a 422. Both are in the details below.

Real-world evidence

N/A: this PR only changes a docs spec, so there was no runtime surface to exercise and no evidence bundle was produced. The verdict comes from static review alone, comparing the doc against the server's request model.

🔍 Technical details

Issues found

🟢 The changes_turn_id schema is looser than the server (docs/spec/agent-ui-query-sse-contract.md:124). QueryRequest.changes_turn_id carries pattern=file_snapshots.TURN_ID_PATTERN (^\d{14}-[0-9a-f]{8}$, src/gaia/agents/base/file_snapshots.py:62). So a value like "turn-1" passes this schema, but the server returns a 422 for it.

    "changes_turn_id": { "type": "string", "pattern": "^\\d{14}-[0-9a-f]{8}$" },

🟢 The "turns replaces context" rule is in the table but not in the schema (docs/spec/agent-ui-query-sse-contract.md:128-138). The server enforces it in _turns_replace_context: context must be empty whenever turns is sent. A strict validator would accept both at once. If you want the schema to encode the rule, add a sibling of dependentRequired:

"if": { "required": ["turns"] },
"then": { "properties": { "context": { "maxItems": 0 } } }

The server also restricts each message's role inside turns to user, assistant, system or tool (_turn_roles_known). That could go into turns.items.items in the same pass.

Strengths

  • Each table row matches the comment in the server's API_VERSION changelog (server.py:88-95), so clients that gate on the contract version get accurate cut-offs.
  • dependentRequired is the right draft 2020-12 construct for the changes_turn_id → session_id rule. It mirrors _changes_need_a_session exactly.

@huong8373tt-beep

Copy link
Copy Markdown
Contributor Author

Took the optional schema-tightening suggestions in ef62e7e2e.

The strict request schema now also:

  • validates changes_turn_id against the server's ^\\d{14}-[0-9a-f]{8}$ format;
  • restricts every message role in turns to user, assistant, system, or tool;
  • rejects non-empty context whenever turns is supplied, matching _turns_replace_context.

Local verification: extracted JSON Schema parses successfully and git diff --check passes. GitHub docs validation has been re-triggered by the push.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 30, 2026
Merged via the queue into amd:main with commit f4c63c4 Oct 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(spec): /query schema still rejects the 2.19–2.25 request fields

2 participants