Repository navigation
Commit 90619cc
committed
refactor(llm): tighten reasoningStart step parity and lock itemId-only drop
Two narrow changes prompted by the latest review pass — both verified
against the surrounding code, not added arbitrarily:
- reasoningStart now calls stepStart unconditionally before checking
whether the reasoning id is already in state. textDelta, textEnd,
and reasoningEnd already do this; reasoningStart was the outlier.
stepStart is idempotent so the change is a no-op for all existing
callers, but it prevents a hypothetical future protocol whose first
emitted event is a reasoningDelta from being missing a step-start.
This is internal helper hygiene; it does not change anything on the
wire and adds no OpenAI-imposed constraint.
- Add a regression test asserting that a reasoning part with an itemId
but no encrypted state is dropped under store:false. This codifies
behaviour the protocol already enforces and that the surrounding
comment in lowerMessages documents: "With store:false, OpenAI only
accepts previous reasoning items when the encrypted state is
present." Complements the existing reasoningEncryptedContent: null
case.1 parent ae89813 commit 90619cc
2 files changed
Lines changed: 38 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
933 | 933 | | |
934 | 934 | | |
935 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
936 | 970 | | |
937 | 971 | | |
938 | 972 | | |
| |||
0 commit comments