unsloth/studio/backend
danielhanchen 7dbe18ab51 studio: line-anchor trailing-plan list items and ship a backend pytest
While drafting backend/tests/test_trailing_plan.py for the changes
landed in b4e0985, the new tests surfaced a deeper false-positive the
earlier regex tightening missed.

For input "Let me explain:\n1. The function returns 42.\n\nThat's the
answer." the previous `(?:\s*(?:[-*•]|\d+\.)\s+[^\n]+\n?)+` allowed the
regex engine to backtrack and treat the in-prose "42." substring as a
second list-item marker: iter 1 consumed "1. The function returns 4"
and iter 2 consumed "2.\n\nThat's the answer." (with `\s+` greedily
crossing the empty-line break). The pattern then satisfied `\s*\Z` and
the buffer fired a spurious `Continue.` retry on what was already a
fully-formed answer.

Tighten the per-item boundary:

  - `[ \t]*` before the marker (no newlines): forces the marker to sit
    at the start of its own line. A mid-prose "42." cannot satisfy this
    because the engine cannot rewind past the preceding `\n` without
    invalidating the previous iteration's `[^\n]+\n` close.
  - `[ \t]+` between the marker and content: blocks an `\s+`-driven
    cross-newline reach into a closing paragraph.
  - `(?:\n|\Z)` at end of item: a real line break OR end of buffer.
    Preserves the "list at EOB with no trailing newline" case while
    eliminating the backtrack route.

Land backend/tests/test_trailing_plan.py at the same time, covering:

  - `_TRAILING_PLAN_INTENT` "let me know" closer exclusion (cycle-3 fix).
  - `_TRAILING_PLAN_LIST` correctly fires on genuine trailing lists
    (dash, asterisk, unicode bullet, numeric).
  - `_TRAILING_PLAN_LIST` does NOT fire on list + closing paragraph,
    list + closing sentence, list embedded mid-text, or the "42."
    in-prose digit case.
  - `_TRAILING_PLAN_COLON` fires on bare trailing intent-colons only.
  - `_trailing_plan_hit` composite cases.
  - The 600-char window slicing.

31 cases, all pass. Pins the regex behaviour against future regressions
inside the repo (the prior pin script lived only in the probing
workspace, not the studio tree).
2026-05-19 04:35:39 +00:00
..
assets Add Qwen3.6 inference defaults for Studio (#5065) 2026-04-16 11:42:42 -07:00
auth studio: security and hardening pass (auth rate-limit, sandbox, path containment, schema validation, headers) (#5375) 2026-05-13 06:12:18 -07:00
core studio: line-anchor trailing-plan list items and ship a backend pytest 2026-05-19 04:35:39 +00:00
loggers Studio: stop truncating long log lines as suspected base64 (#5335) 2026-05-08 13:07:18 +04:00
models Studio: warn when llama.cpp prebuilt is at least 3 days behind (#5529) 2026-05-18 00:21:50 -07:00
plugins fix(gh_client): fail fast on 401/403 auth errors instead of retrying forever (#5325) (#5329) 2026-05-08 21:57:41 +04:00
requirements studio: API external provider support for chat (OpenAI, Mistral, Gemini, Cohere, Anthropic, OpenRouter, DeepSeek, custom providers) (#4706) 2026-05-14 16:13:59 +04:00
routes studio: reset Anthropic adapter cursor on auto-continue boundary 2026-05-19 04:35:39 +00:00
state unsloth run: add --enable-tools/--disable-tools server-side tool policy (#5277) 2026-05-05 12:45:15 +04:00
storage studio: API external provider support for chat (OpenAI, Mistral, Gemini, Cohere, Anthropic, OpenRouter, DeepSeek, custom providers) (#4706) 2026-05-14 16:13:59 +04:00
tests studio: line-anchor trailing-plan list items and ship a backend pytest 2026-05-19 04:35:39 +00:00
utils studio: extend offline DNS auto-detect to inference parent + training (#5512) 2026-05-18 00:31:33 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
_platform_compat.py Fix Studio crash on Anaconda/conda-forge Python (#4484) 2026-03-22 05:36:55 -07:00
colab.py Fix/studio colab button message: Add fallback message for Colab Studio button when proxy URL fails (#4866) 2026-04-05 21:57:45 -07:00
main.py Studio: warn when llama.cpp prebuilt is at least 3 days behind (#5529) 2026-05-18 00:21:50 -07:00
run.py Studio: stop hint, Uvicorn log rename, reachability check + Mac UI CI retry hardening (#5503) 2026-05-17 07:44:06 -07:00
startup_banner.py Studio: stop hint, Uvicorn log rename, reachability check + Mac UI CI retry hardening (#5503) 2026-05-17 07:44:06 -07:00