Skip to content

fix: Accept unsigned reasoning output - #90

Open
jiahuei wants to merge 1 commit into
mainfrom
fix/unsigned-reasoning-output
Open

jiahuei wants to merge 1 commit into
mainfrom
fix/unsigned-reasoning-output

Conversation

@jiahuei

@jiahuei jiahuei commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Responses and Messages output normalization and projection now accept reasoning summaries without a signature instead of failing when the part completes. Responses omits unavailable encrypted state and Messages emits an empty signature; no continuation state is invented.
  • Keeps request/history validation strict, preserves existing signatures and signature-stream consistency, and retains Chat rejection of signatures it cannot represent. Removes the redundant completed-reasoning validation helper and updates the output/history documentation.
  • Adds SDK-parsed cassette-derived parity across all six translated routes in streaming and non-streaming modes, including exact upstream requests and rejection before transport when unsigned output is replayed as summary history. Signature removal happens only in explicitly synthetic in-memory test streams; no cassette is modified.
  • Targets main independently of the hosted web search work in PR fix: Add automatic citation buffering and preserve point citations #89.

Verification

  • .venv/bin/python -m pytest: 1,478 passed in 25.86 seconds on Python 3.12.9, using offline replay only.
  • PYTHONPATH=python /tmp/molto-pr89-integration/.venv/bin/python -m pytest -q tests/core/test_unsigned_reasoning.py: 12 passed. The standalone tests use local SDK collectors and the existing Responses lifecycle helper, with no hosted-search dependency.
  • uv run --extra lint ruff check --output-format github --config pyproject.toml .: passed.
  • uv run --extra lint ruff format --diff --config pyproject.toml .: passed; the adapted Anthropic comparison was formatted before the final check.
  • npx prettier@3.8 --check .: passed; changed documentation also passed its focused check.
  • git diff HEAD --check: passed. No cassette changes or new recordings.
  • GitHub CI passed Python 3.12, 3.13, and 3.14 tests, Python lint/format checks, and Prettier checks. Python 3.13 and 3.14 were not run locally.
  • The transfer from PR fix: Add automatic citation buffering and preserve point citations #89 required resolving conflicts against main and removing hosted-search documentation/test-helper dependencies.

jiahuei added a commit that referenced this pull request Oct 29, 2026
## Summary

- Adds `Molto.messages(..., citation_policy="auto")` for conditional
citation buffering on translated Responses routes. It buffers text when
normalized tools or history signal possible citations; otherwise text
streams immediately and unexpected citations are dropped. `"buffer"`
always buffers each text part, `"drop"` remains the default, and opaque
transport extensions do not select automatic buffering. Native Messages
and Chat upstream behavior remain unchanged.
- Preserves point citations without splitting text at zero-length
ranges. When no original excerpt exists, the containing block supplies
the fallback `cited_text`. Existing offset validation, blank-text
rejection, provider metadata, and SDK-compatible text deltas remain
intact.
- Extends terminal-reason coverage with normal completion and refusal,
and adds coverage for automatic buffering, history, transport overrides,
point citations, and SDK text iteration.
- Merges `amer-hosted-web-search`, retaining its Anthropic continuation
metadata, provider-specific missing/empty/placeholder ciphertext
rejection, and recorded continuation coverage. No cassette contents
differ from that branch.

Removal of output-only missing reasoning-signature checks is tracked
independently in [PR #90](#90).

## Verification

- `.venv/bin/python -m pytest`: 2,293 passed in 35.78 seconds on Python
3.12.9 after separating the reasoning-output work. Tests used offline
replay only.
- Focused citation and terminal-reason tests: 154 passed, 267
deselected. Earlier outdated point-citation expectations were corrected
before the passing full suite.
- `uv run --extra lint ruff check --output-format github --config
pyproject.toml .`: passed.
- `uv run --extra lint ruff format --diff --config pyproject.toml .`:
passed.
- `npx prettier@3.8 --check .`: passed.
- `git diff 4235d01 HEAD --exit-code`: passed; the final tree exactly
matches the verified hosted-search-only merge. Cassettes remain
unchanged relative to `amer-hosted-web-search`.
- The offline replay workflow targets PRs against `main`, so PR #89
relies on the local suite above while its base remains
`amer-hosted-web-search`.
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