Skip to content

Latest commit

 

History

History
25 lines (13 loc) · 5.63 KB

DEVLOG.md

File metadata and controls

25 lines (13 loc) · 5.63 KB

Development Log

2026-07-28

Follow-up cleanup pass on the llm-backends migration, catching two spots the July 15 adoption had left inconsistent with the new package-backed registry and moving the pin up to v0.2.0. The most consequential fix was in chapter_writing_agent.py: its headless fallback (used whenever there's no GUI app instance to ask for the selected model) still hardcoded the literal "gpt-4", which is no longer a valid registry key and so raised ValueError on any run without the app. That now falls back to ai_helper.DEFAULT_API_MODEL, so the value tracks the registry instead of drifting from it. Second, load_parameters in core/gui/parameters.py was silently dropping any model spelling not already in the available-models list, which meant older parameters.txt files carrying pre-migration names (e.g. claude-4-5-sonnet) lost their model on load; it now routes unknown spellings through llm_backends.resolve_model() first and only warns-and-ignores if that also fails. The requirements pin moved to @v0.2.0.

Decisions & notes: The v0.2.0 bump is behavior-neutral here: the package's 0.2.0 change (no default system prompt) is a no-op for NovelWriter because the ai_helper facade already passes role_description explicitly on every call. The 16-test suite from the migration still passes.

2026-07-15

The day's arc was the shared llm-backends migration, bookended by a hotfix and its retirement. It opened with a security-flavored interim fix (step 0 of the plan tracked in StoryDaemon's docs/LLM_BACKENDS_INVENTORY.md): because ai_helper.py loads .env into os.environ, the codex/claude/gemini CLI backends were inheriting provider API keys, and agent CLIs treat an environment key as outranking their configured subscription login, so CLI generations were being silently billed to metered keys (codex was also bypassing its sandbox). A new _env.subprocess_env_without() strips the relevant provider keys from a per-call copy of the environment, so the failure mode flips from silent spend to a visible auth error. Later the same day the real migration landed (step 4): NovelWriter adopted llm-backends v0.1.1, collapsing its two disagreeing internal model registries into package-backed shims, with llm_interface.py kept as a thin wrapper for the four NovelWriter-specific needs and ai_helper.py as a facade over the package's registry/dispatch. This retired the morning's _env.py hotfix (the package now strips keys by default), moved CLI backends onto the package's neutral-cwd isolation and read-only codex sandbox, and shipped the first real test suite for this layer (16 tests, plus un-ignoring tests/ in .gitignore, a legacy rule that would have silently discarded the new suite). A small unrelated commit added an optimized WebP thumbnail alongside the existing PNG for use as a web card image.

Decisions & notes: The model list was intentionally pruned as part of step 4: gpt-4o, o3, o4-mini, gpt-5-2025-08-07, and gemini-2.5-pro-exp-03-25 now raise ValueError with the supported list, and the default API model moved to gpt-5.5 (was gpt-4o). claude-4-5-sonnet resolves via the package alias table, but claude-4-5-opus was deliberately NOT aliased to opus-4-8 because that would be a silent model upgrade; it errors loudly instead. Saved parameters.txt files referencing retired models fall back to the default via the pre-existing guard. A live smoke test via OpenRouter (deepseek-chat) confirmed the path end to end.

2026-07-14

A project-housekeeping day focused on making NovelWriter's status and direction legible from the repo itself. The morning brought GitHub Sponsors support: a .github/FUNDING.yml config plus a sponsor badge in the README. The bigger work was creating ROADMAP.md, which collates the completed core/ + agents/ refactor (signed off August 2025 in docs/refactor_plan.md) and the since-shipped agentic framework milestone (base agent/tool abstractions, specialized agents, orchestration, checkpointing, multi-level review, and the multi-backend LLM interface) into one checklist-style document. A follow-up pass then added a "Cross-pollination from StoryDaemon" section, planning to port tension/arc-pressure control, grounded name generation, contradiction detection, wiring up the dormant ChromaDB RAG memory, and making the QA review loop actually enforce retries, with the full rationale living in StoryDaemon's docs/CROSS_POLLINATION.md.

Decisions & notes: The roadmap deliberately marks the refactor checklists complete based on the plan's own sign-off even though the original document left them unchecked. New backlog items acknowledge known debt: no test suite for core/ and agents/, dead code to remove (IntegratedStoryOrchestrator, AdaptivePlanningAgent, the mismatched top-level generate_story()), and a possible shared LLM-backend package spanning NovelWriter, StoryDaemon, and LLM-Remote-Runner (home/name/distribution still undecided).

2026-06-20

Reconciled the README against the current codebase after a refactor had moved several modules around. The documentation still pointed at old locations, so paths were corrected to reflect the new layout — combine.py now lives at core/utils/combine.py (previously described as being in the root directory) and ai_helper.py at core/generation/ai_helper.py. The configured-models list was also brought up to date: Gemini 3 Pro and Claude 4.5 Opus were added, and o3 / o4-mini were removed from the Deprecated list since they are in fact still active per ai_helper.py.

Decisions & notes: This was a full-audit pass of the README rather than a one-off fix, aimed at keeping the docs trustworthy as the code is refactored.