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>
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>
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>
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>
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>
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>
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>
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>
Local dev repairs for #2586.
OAuth owner isolation and refresh-token stability verified. Hook polls until connected, refreshes on focus and stops on unmount. Python rechecks: 56 passed; UI batch: 25 passed. Web typecheck, 1407 Node tests, eslint and i18n passed.
Combine Hungarian with Italian UI and Hindi reply-language registries; translate 49 newly integrated keys and add the Hungarian endonym to Italian. Regenerate router and frontend contracts. 33 Python locale tests, full Node suite and locale parity pass.
Make Italian quality tests compatible with CommonJS Node test compiler; accept Italiano as reply-language alias; translate 48 keys added by other integrated PRs; regenerate router index and format i18n. 26 Python locale tests and full Node suite pass.
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.
Validate chapter existence, spine presence, and protected overview deletion before claiming a revision; cover failed edits followed by valid retries (22 passed).
Adding the four chapter routes changed the router source fingerprint, so
the tracked lazy-routing index must be rebuilt via scripts/build_router_index.py
to keep test_repository_index_matches_router_sources green.
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
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>
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.
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.
The authenticated-request dependency takes a shared lease on
workspace-activity.sqlite3 for the whole ASGI call, and the middleware
releases it when that call returns. A streaming response only returns when
the stream ends, so an indexing-progress SSE held the lease for as long as
its tab stayed open -- and when the indexed task never starts (see the
preceding commit) that is indefinitely.
Every exclusive workspace operation (KB move, registration update, data
migration) then answered 'Workspace data is busy' until the backend was
restarted, because acquire_activity() uses timeout=0 and a leaked shared
lock never expires.
Task-board events and the calendar stream were already excluded for this
reason; the knowledge-base task progress stream reads only in-memory task
state and is equally safe to exclude. A failing task therefore no longer
locks the workspace it cannot even reach.
Regenerate the router index for the changed router sources.
Fixes#2525
workspace_id_for_kb_base_dir() walks every registered workspace to find the
one that owns a KB directory, and it runs on every upload, folder sync and
reindex. A registration whose folder no longer exists (archived leftovers, a
directory the user moved) raises WorkspaceError on entry, which aborted the
whole lookup and dropped the storage scope from the background task.
Because WorkspaceError is a ValueError, the upload/sync routes then answered
404 'Knowledge base <name> not found' for a KB that exists, the background
task was never registered (the call sits in add_task's argument list), and
the KB kept the progress entry written just before it, so the UI showed an
endless 'scanning' state with no error on disk.
- skip registrations that cannot be entered instead of aborting the scan
- resolve the scope before copying files or marking the KB queued, so a
failure cannot leave a task-less progress entry behind
- surface WorkspaceError as 409 with its real message instead of a 404
Fixes#2524