Skip to content

Preserve provider reasoning across ReAct tool history - #120

Open
larissaschiavo wants to merge 1 commit into
mainfrom
codex/reasoning-continuity
Open

larissaschiavo wants to merge 1 commit into
mainfrom
codex/reasoning-continuity

Conversation

@larissaschiavo

Copy link
Copy Markdown
Collaborator

User Story

A ReActV2 program can continue a reasoning model's tool exchange and resume saved history without losing the provider's continuation data. Previously, the next request dropped OpenRouter reasoning details and sent empty DeepSeek reasoning text, even though the initial response had supplied them.

Semantic Contract

Preserve native reasoning text and structured details from prediction metadata through tool history, Chat rendering, and ReqLLM message construction. Restoring Imp.History.dump/1 through JSON retains signatures, encrypted blocks, provider extension fields, and the original tool-call IDs. Known normalized detail keys and provider names are restored without dynamically creating atoms.

ReqLLM remains the provider encoder. Anthropic signed/redacted blocks are replayed once, without adding duplicate unsigned thinking text. Operational history retains the original continuation data; ordinary history inputs, run events, and explicit diagnostic copies retain credential redaction. The ReActV2 documentation explains private history storage.

Evidence

  • Deterministic tests: the original OpenRouter and DeepSeek wire regressions fail on unchanged 5392bc9f and pass with this change. Six added tests cover continuation, JSON reload into a new program instance, nested detail normalization, Anthropic encoding, and redaction.
  • Integration or protocol tests where applicable: local HTTP fixtures exercise the pinned ReqLLM OpenRouter and DeepSeek encoders; the Anthropic native encoder is checked for exact signed/redacted block order and count.
  • Live/provider evidence where applicable: not run.
  • ExDoc, guide, or Livebook updates: ReActV2 module documentation and changelog.
  • mix quality.check

Validation (Elixir 1.19.6 / OTP 28, Python 3.12.14, LIVE_PROVIDER=0 EVIDENCE_INFRASTRUCTURE=0 DSPY_CAPTURE=0):

  • mix test test/reasoning_continuity_test.exs test/req_llm_client_test.exs test/react_v2_test.exs test/history_test.exs: 95 tests, 0 failures.
  • mix check: 54 doctests, 9 properties, 2,914 tests, 0 failures; 13 skipped and 261 excluded. This also checks formatting and compilation with warnings as errors.
  • mix quality.check: passed, using the repository's existing dependency-advisory exclusions.
  • git diff --check: passed.

An initial default check picked up system Python 3.9 and failed the existing HoVer fixture's zip(strict=True) call. The complete rerun with the required Python 3.12 passed.

External Evidence

No paid-provider or external-model calls were made. These checks establish behavior against the pinned ReqLLM 1.17.1 codecs and local fixtures; live provider acceptance was not tested.

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