Skip to content

Accept max_turns stops and open server enumerations - #13

Merged
farouk09 merged 1 commit into
mainfrom
NBQ-375-stop-reason
Sep 29, 2026
Merged

farouk09 merged 1 commit into
mainfrom
NBQ-375-stop-reason

Conversation

@farouk09

Copy link
Copy Markdown
Member

Summary

The API now ends a session at max_turns: /next returns action: "stop" with stop_reason: "max_turns_reached", an empty candidates list and a null decision_id; the session becomes stopped and later /next calls return the same stop. max_turns_reached is no longer a selection warning. Python zelinqa 1.0.0 declares StopReason = Literal["no_question_available"] and rejects that response with a validation error.

  • Synchronize the OpenAPI snapshot with the contract revision that introduces the max_turns_reached stop (the DecisionApresMaxTurns example is now a stop, ArretSansQuestion no longer carries max_turns_reached).
  • Python: StopReason is Literal["no_question_available", "max_turns_reached"] | str. Every enumeration emitted only by the server (SelectionWarning, DegradedReason, SessionStatus, progress, target, override view, audit, compilation, configuration issue and error codes) follows the same open pattern, so a value added by a later API release is returned as a plain string. Enumerations a client sends (QuestionType, QuestionOutcome, CompletionRole, QualificationLevel, ObjectiveOverrideValue, QuestionSelectionMode, QuestionSource, Role, FeedbackResult, ChangeOperation, DimensionSelectionMode) and NextAction stay closed, so request validation is unchanged.
  • Docstrings, READMEs and both usage guides describe the stop at max_turns; no text presents max_turns_reached as a warning.
  • TypeScript: typescript/src/generated/openapi.d.ts is regenerated with pnpm generate:types (no hand edits; CI checks it against the snapshot). StopReason gains max_turns_reached and SelectionWarning loses it. No runtime change.
  • Version 1.0.1 in the four version files (check-versions requires them to match) and in uv.lock; CHANGELOG entry added and the 1.0.0 heading dated with its publication day.

Validation

  • Python: 448 tests passed (live suite deselected, not run); Ruff, format check and mypy passed.
  • New tests: the max_turns_reached stop parsed from the contract example (blocking and async handles, pending decision cleared, repeated call returns the same stop); unknown stop_reason, warning, degraded reason and statuses accepted; NextAction and every client-sent enumeration still reject unknown values; each named enumeration lists exactly the contract values.
  • uv build and twine check passed; the 1.0.1 wheel installed in a clean environment parses a max_turns_reached stop.
  • TypeScript: pnpm generate:types reproduces the committed declarations; pnpm check (lint, typecheck, 133 tests, version check) and pnpm build passed.
  • No test against a live API was run.

Release

Both publication workflows are manual (workflow_dispatch), run only from main, and wait for approval on their protected environment. Nothing is published by this PR; no tag or release is required.

  1. Merge this PR once CI is green.
  2. Publish Python zelinqa 1.0.1: gh workflow run publish-python-sdk.yml --ref main -f confirm=publish-zelinqa, approve the pypi environment, then verify zelinqa==1.0.1 in a clean environment.
  3. Optional, at the maintainer's discretion: publish @zelinqa/sdk 1.0.1 with gh workflow run publish-typescript-sdk.yml --ref main -f confirm=publish-zelinqa-sdk (types only).
  4. Then release the MCP server, which depends on zelinqa>=1.0.1.

Clients on zelinqa 1.0.0 fail when the API returns the max_turns_reached stop, so 1.0.1 should be available on PyPI before that behavior reaches the public API.

@farouk09
farouk09 merged commit c620fda into main Sep 29, 2026
3 checks passed
@farouk09
farouk09 deleted the NBQ-375-stop-reason branch September 29, 2026 20:50
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