Commit Graph

446 Commits

Author SHA1 Message Date
Benjamin Schwing
df1fbbe6bc test(notebook): simplify the non-finite verdict PATCH body
Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-25 01:31:53 +00:00
Benjamin Schwing
66b33e29f2 fix(notebook): reject non-finite numbers in a PATCHed verdict
FastAPI's JSON parser accepts NaN/Infinity, so a crafted entry PATCH
stored a verdict that made every later read of the entry fail. Reject it
with a 422 in the route: a model validator's 422 body would echo the
value and fail to serialise as well.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-25 01:31:34 +00:00
Benjamin Schwing
f8378140ee fix(quiz): reject overflowing numbers in the judge verdict
parse_constant only sees the NaN/Infinity literals; a literal such as
1e999 still parsed to inf and produced a verdict frame browsers cannot
JSON.parse. Let the verdict model reject every non-finite number instead
of the custom decoder.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-25 01:31:34 +00:00
Benjamin Schwing
4cbe18ebfd fix(sessions): leave pending answers out of the quiz score
The [Quiz Performance] score counts only graded answers and states how many
are not graded yet, instead of counting a pending photo answer as wrong.
Refresh the router index for the router changes in this series.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 22:00:01 +00:00
Benjamin Schwing
67db2e8dd7 fix(quiz): parse the last judge verdict block and tolerate contract slips
The splitter holds text from the first <verdict> tag and, at the end, takes
the last block as the verdict and releases the prose around it, so prose
that quotes the tag and text after </verdict> are no longer lost. Verdict
tags in learner-supplied prompt fields are neutralised so an echoed tag
cannot grade an answer. The parser case-folds result, truncates an
over-long summary, drops steps without a boolean ok, coerces non-list
steps to none, ignores text after the JSON object and rejects
NaN/Infinity, which browsers cannot parse.

Replace the per-language 'images unreadable' prompt variants with one
neutral system-prompt note; the user prompt only mentions images the
model receives, and the server still forces ungraded.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 21:54:40 +00:00
Benjamin Schwing
afe49a26da fix(notebook): reject contradictory or malformed grades in the entry PATCH
The PATCH restricts result to the four verdict results, derives is_correct
from result when only result is sent, rejects an is_correct that contradicts
result, and checks the stored ai_verdict's shape (known result, boolean
final, no final ungraded) and size.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 21:52:44 +00:00
Benjamin Schwing
c1a6fa2102 fix(practice): keep judged grades and mistakes consistent
A /quiz-results post that keeps the stored verdict (same answer, no image
list) now also keeps the judged is_correct/result, so a late post with the
provisional exact-match grade cannot turn a judged-correct answer back into
a mistake. The release trigger now fires whenever a judged entry is correct
(also healing entries left stuck), and no longer on an ungraded re-judge, so
an unsure re-judge cannot erase a confirmed mistake.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 21:50:47 +00:00
Benjamin Schwing
73835e9c37 fix(quiz): keep re-judged notebook entries consistent
A re-judge that lowers a verdict now replaces the stored result instead
of leaving result=correct behind an is_correct=0 row: the client always
sends an explicit result and the entry PATCH derives result and resolved
from is_correct with the upsert's rules. Invalid step entries are
trimmed or dropped rather than voiding a clear verdict, and the verdict
is saved even when the submit upsert lands after the judge starts.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 18:51:55 +00:00
Benjamin Schwing
b3b1a6ea05 fix(notebook): drop a stored judge verdict when the answer is resubmitted
A verdict judges one answer. A fresh submission (which carries its image
list) or changed answer text now clears ai_verdict, so a reload cannot
apply an old verdict to a retried answer; result-only re-records keep
it. Clearing never releases a recorded mistake.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 18:42:55 +00:00
Benjamin Schwing
310588801c fix(quiz): accept judge verdicts without a summary sentence
Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 18:33:45 +00:00
Benjamin Schwing
4cad709b71 feat(notebook): store AI-judge verdicts and stop counting judged answers as mistakes
Notebook entries gain an ai_verdict JSON column (additive migration) and
the entry PATCH accepts ai_verdict, is_correct and result, so a judged
photo or free-text answer keeps its structured verdict and real result.
Quiz results accept an optional result and report partial/ungraded
answers honestly.

A practice trigger releases a mistake captured from the provisional
exact-match result when an AI verdict marks the same answer correct or
ungraded, unless the learner already practised it. Partial verdicts stay
reviewable with result=partial.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 18:24:05 +00:00
Benjamin Schwing
9c5db755bb feat(quiz): emit a structured verdict frame from the AI judge
The judge now ends its reply with a <verdict> JSON trailer that the
server strips from the streamed prose, validates against the learning
Verdict model (same result vocabulary and 0.8 confidence gate) and sends
as a separate "verdict" frame before "done". Missing or invalid
trailers, low confidence and vision-incapable models yield "ungraded";
points are only kept when the question states them and they are
consistent. Clients that ignore unknown frames see unchanged prose.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 18:15:29 +00:00
Bingxi Zhao (Frank)
4c1e000d85 release: v1.7.3
Prepare v1.7.3 notes for reading and book editing, expanded provider and
agent connections, learning records, model streams, and desktop upgrades.

Sync README prose and 11 translations, archive older release notes, and
update the package version. Resolve release lint/type blockers with explicit
parser and capability contracts, compatible Book call forwarding, accurate
auth task types, and quoted SQLite schema identifiers. Cover positional Book
calls and quoted legacy columns; align KB seed tests with visible retrieval
failure reporting. Keep HTTP fixtures independent of host proxies and translate
new Portuguese UI copy.

Release notes: assets/releases/ver1-7-3.md
2026-11-16 02:17:36 +08:00
Bingxi Zhao (Frank)
8ab4ecfee9 feat(books): review and undo scoped chapter and section edits
Fixes #2571
2026-11-15 01:42:47 +08:00
Bingxi Zhao (Frank)
53bc9eb99d fix(learning): paginate and search question bank sources
Fixes #2641
2026-11-15 01:20:53 +08:00
Bingxi Zhao (Frank)
8ecf2da95f fix(parsing): validate uploads against available parser formats
Fixes #2338
2026-11-15 01:20:52 +08:00
Bingxi Zhao (Frank)
92a26ae3cc fix(storage): isolate attachment writes and settle document parsing
Local dev repairs for #2244, #2245, #2255, #2426, #2453. Regression checks cover reported symptoms and compatibility boundaries.
2026-11-15 00:44:09 +08:00
Bingxi Zhao (Frank)
af403550ce Merge PR #2639: fix: explain missing LLM access in chat
Retain admission error text and localized model-access guidance; allow explicit retry to revalidate access instead of permanently blocking stored messages. No automatic retry on reload. Backend tests and both manual retry paths passed.
2026-11-14 23:19:09 +08:00
Bingxi Zhao (Frank)
2d493edb84 Merge PR #2521: feat(i18n): add Hindi as a reply language
Regenerate the lazy route index after the reply-language contract changes; targeted tests passed.
2026-11-14 23:16:33 +08:00
Bingxi Zhao (Frank)
9934fb15ca Merge PR #2625: feat(book): post-generation chapter CRUD without recompiling
Validate chapter existence, spine presence, and protected overview deletion before claiming a revision; cover failed edits followed by valid retries (22 passed).
2026-11-14 23:11:57 +08:00
Bingxi Zhao (Frank)
3fc9d2ce18 Merge PR #2534: feat(web_fetch): pluggable fetch backend with DeepSeek Fetch as first alternative
Combine independent locale additions and regenerate integrated route index.
2026-11-14 23:00:23 +08:00
Bingxi Zhao (Frank)
16cc590b63 Merge PR #2564: feat(chat): per-conversation reasoning-effort selector in the composer (#641) 2026-11-14 23:00:04 +08:00
Bingxi Zhao (Frank)
c60e0e0331 Merge PR #2576: feat(reading): record question-linked help without replacing the quiz
Keep server-only quiz answer keys before persisting help results; retain relationship and extension-policy revalidation.
2026-11-14 22:59:16 +08:00
Bingxi Zhao (Frank)
a768f739a2 Merge PR #2578: fix(book): don't advance revision when refresh-fingerprints is refused 2026-11-14 22:58:50 +08:00
Bingxi Zhao (Frank)
269a026f84 Merge PR #2537: fix(practice): grade optionless true-false answers 2026-11-14 22:58:01 +08:00
Bingxi Zhao (Frank)
211e19a85e Merge PR #2598: fix(session): give attached reading sections to non-chat capabilities 2026-11-14 22:58:00 +08:00
Bingxi Zhao (Frank)
f691217179 Merge PR #2589: fix(mcp): pass the server name into the OAuth store during Test
Regenerate the lazy router index against the integrated route sources.
2026-11-14 22:57:40 +08:00
Bingxi Zhao (Frank)
54324f8318 Merge PR #2674: fix: reject partner session branches that already exist
Preserve both image-only partner history coverage and existing-destination validation tests; combined partner suite: 146 passed.
2026-11-14 22:57:24 +08:00
Bingxi Zhao (Frank)
0fa3123903 Merge PR #2678: fix: retain image-only records in partner session history 2026-11-14 22:49:42 +08:00
mpichini1
ca45fb0fc7 fix: retain image-only records in partner session history 2026-11-13 20:08:34 +01:00
mpichini1
44dee85814 fix: reject partner session branches that already exist 2026-11-13 19:26:35 +01:00
riccardo-algorime
2514313937 fix(session): cap attached reading sections for non-chat capabilities
All attached units together stay within one unit's cap (60k chars). The unit
that crosses it is cut with a named marker; later units are listed by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 11:47:55 +00:00
Junlin Li
560a80a17f fix: explain missing LLM access in chat 2026-11-12 16:58:52 +08:00
ZQR1101
71a05602d5 feat(book): post-generation chapter CRUD without recompiling
Add / rename / reorder / delete chapters after generation through REST
endpoints mirroring the block-CRUD handlers. New chapters are pending
shells; already-compiled pages are never recompiled or discarded. Each
edit carries the chapter's order/title onto its pages so the reader-visible
sequence follows, and delete prunes only its own pages plus the concept
graph, prerequisites, and progress refs.

Part of #2571
2026-11-11 17:45:37 +08:00
riccardo-algorime
1279257900 fix(session): give attached reading sections to non-chat capabilities
Chat turns reach attached reading units through the source inventory and
read_source. Deep Solve, Visualize, Math Animator and the other non-chat
capabilities get attachments inlined into the user message instead, but
reading references were left out there, so a turn with reading sections
attached ran without them. They now go in as [Reading Sections], next to
[Attached Documents] and [Book Context].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 13:50:51 +00:00
evan188199-tech
585d7656c7 fix(mcp): pass the server name into the OAuth store during Test (#2587)
POST /api/space/mcp/servers/{name}/test discarded the path name, so a
probe of an OAuth-backed server built its token store with '' and every
Test answered "ValueError: Unsafe MCP server name for an OAuth store: ''"
— including for a server that was authorized and connected.

probe_server now takes a server_name (the name the saved connection
would address the grant under) and the space router passes the path
name for OAuth configs. A scratch name no grant could live under (an
unnamed draft) is answered the way an unauthorized server is instead of
the store's refusal; non-OAuth probes stay nameless as before.

Fixes #2587

Signed-off-by: evan188199-tech <238371241+evan188199-tech@users.noreply.github.com>
2026-11-10 15:35:07 +08:00
evan188199-tech
b04ac1bbc0 fix(book): run refresh-fingerprints refusal gate before claiming revision
A rejected POST /api/books/{id}/refresh-fingerprints (force=false, stale
pages not yet recompiled) bumped and persisted book.revision before the
engine refused it, so the client's expected_revision went stale and the
force=true retry always lost the revision race (409 forever).

Run the engine's refusal check (new read-only preflight
check_refresh_kb_fingerprints -> ensure_can_refresh_fingerprints) before
_claim_content_mutation; a rejected dismissal is now side-effect free and
the force retry with the same expected_revision succeeds. Regenerate the
router index fingerprint.
2026-11-10 00:47:45 +08:00
Yin
caee2c5ff6 feat(reading): persist question-linked help receipts and events 2026-11-10 00:12:58 +08:00
evan188199-tech
3b1730d758 feat(chat): per-conversation reasoning-effort selector in the composer (#641)
Carry the #958 service-layer reasoning_effort override through the whole
turn contract: the core TurnRequest LLMSelection accepts the field
(validated against VALID_REASONING_EFFORTS, old two-ID payloads unchanged),
the generated web contracts are regenerated, and ChatStateAdapter's
asLLMSelection restores a legal override instead of dropping it.

The composer gains a selector beside the model picker, offering only the
levels the selected model supports (live supported_reasoning_efforts or
the provider/model tables) narrowed to the wire vocabulary, hidden when
the model has none. The choice persists on the conversation's
llm_selection, so the next send uses it without a backend restart and
other conversations are unaffected; switching models resets the override.
Precedence stays conversation override -> profile/model default ->
provider default, and the context-budget readout reports the effective
effort beside the model when one was used.
2026-11-09 20:47:08 +08:00
evan188199-tech
91104d9a3f fix(web_fetch): settings UI for backend + harden DeepSeek fetch cap (#2448)
Addresses Air R1/R2 review blockers on top of the opened PR head:
Settings GET/PUT /api/settings/web-fetch with UI control; DeepSeek fetch
uses identity encoding, raw bytes, and capacity checks before buffer extend;
provider-branding treats `local` as generic.
Air Codex R3 on MacBook Air: READY.
2026-11-09 16:23:50 +08:00
Scarffe
9bebc622c4 fix(practice): grade optionless true-false answers 2026-11-09 04:47:34 +00:00
Henrik Bakke Dukefoss
fb187c5ca3 feat(providers): add Standard Compute as an OpenAI-compatible gateway
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 00:33:13 +01:00
Arrunabh Singh
b0bf8cf2d4 feat(i18n): add Hindi as a reply language
Add Hindi (hi, हिन्दी) to the reply-language contract, following step 4
of docs-for-dev/I18N.md and the earlier Malay change (550268e1):

- SUPPORTED_RESPONSE_LANGUAGES, the settings router's ResponseLanguage,
  the prompt-language label and the settings-spec reply choices;
- "hindi", "हिन्दी" and "हिंदी" aliases in the backend and web
  normalizers (hi-IN and hi_IN resolve through the base code);
- the web ResponseLanguage type, isResponseLanguage() and
  RESPONSE_LANGUAGE_OPTIONS, which the partner picker shares;
- regenerated frontend contracts, and tests mirroring the Malay change.

The interface language is unchanged: no web catalog or picker entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:24:54 +05:30
Bingxi Zhao (Frank)
ebcebd4723 Unify migration locks and plugin environments, and cover compatibility boundaries 2026-11-06 02:04:52 +08:00
Bingxi Zhao (Frank)
d8ee0e5e40 Merge #2280 and regenerate router index 2026-11-06 02:04:52 +08:00
Bingxi Zhao (Frank)
8244eb3f59 Merge #2346 from rudycelekli 2026-11-06 01:56:40 +08:00
Rudy Celekli
c77f888966 fix(api): honor a data: URL's declared MIME for quiz-answer images
The quiz judge stripped the data: prefix from a submitted answer image and
re-guessed the MIME from the filename, so a JPEG photo sent as
data:image/jpeg with the default answer.png filename was relabelled
image/png and rejected by strict vision providers. Parse the media type
from the data URL and prefer it over the filename guess (an explicit
mime_type field still wins); same fix for the legacy single-image branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-02 00:44:23 -05:00
FSOTM
4fb9d78c99 fix(chat): confirm cancelled turn ownership before enabling another send 2026-11-01 22:55:21 +08:00
RRFZ
d072a786fb fix(knowledge): name the clashing member when a zip upload is refused
safe_extract_zip refuses to replace a document the knowledge base
already holds, but _save_zip_archive let the FileExistsError escape, so
the upload failed with "Validation failed for file 'course.zip':
[Errno 17] File exists: '<absolute server path>/raw/chapter1.md'": an
OS error instead of a reason, and the server's directory layout handed
to the client.

Catch it next to the other archive rejections and say which member
clashes and what to do; still 400, the existing file still untouched.
2026-10-31 21:56:27 -04:00
Bingxi Zhao (Frank)
84de213aa2 Merge commit '81ab035e0370bd125592ecfaf7f867240081ddad' into codex/validate-reviewed-integration
# Conflicts:
#	tests/api/test_settings_router.py
2026-10-31 18:53:28 +08:00