Skip to content

fix: harden state/cache identity, asset paths, provider routing and add bounded image concurrency - #11

Merged
phaethix merged 3 commits into
mainfrom
fix/design-hardening
Jul 23, 2026
Merged

fix: harden state/cache identity, asset paths, provider routing and add bounded image concurrency#11
phaethix merged 3 commits into
mainfrom
fix/design-hardening

Conversation

@phaethix

Copy link
Copy Markdown
Owner

Summary

Hardens the creative-comic pipeline against silent data loss, unsafe file writes, provider misconfiguration, and slow generation.

  • Resumable cache identity: persist a fingerprint of source text, style guide, provider/model snapshot, panel continuity, and L3 settings so a rerun never reuses assets generated for a different input or configuration.
  • Filesystem containment: model-controlled character names and panel IDs no longer drive file paths. Asset filenames are hashed and every persisted/project-local path is verified to stay inside the output root; state is written atomically and guarded by a per-project lock (POSIX + Windows).
  • Provider credential routing: the provider is selected before resolving credentials, so an OpenAI-compatible endpoint never receives the Agnes key. web/server.py now accepts compatible-only configurations instead of requiring AGNES_API_KEY.
  • Policy error semantics: a generic HTTP 400 is no longer treated as a content-policy rejection, preventing permanent silent skips of operational failures.
  • Layout integrity: panels are ordered by storyboard position (chunk/panel index) rather than lexical IDs; dialogue is rendered into both page and webtoon output with dynamic bubble height; reused model panel IDs across chapters are isolated via internal position keys.
  • Performance: independent portraits and panels generate under a bounded asyncio.Semaphore (default 3, configurable via INKSTONE_IMAGE_CONCURRENCY); successful work is checkpointed before a sibling operational error propagates.

Test plan

  • pytest passes (1 skipped) and ruff check . is clean in the inkstone conda env.
  • New regression tests cover cache invalidation on input/config/model change, path escape containment, provider credential isolation, storyboard ordering/dialogue, reused model panel IDs, long-dialogue expansion, and web UI provider configuration.

🤖 Generated with CodeBuddy

phaethix added 3 commits July 22, 2026 23:52
…dd bounded image concurrency

- fingerprint resume state by source, style, provider/model, continuity and L3 so an
  edited text or changed backend cannot silently reuse stale assets (closes the
  regression where a fixed safe chapter was permanently skipped after a prior rejection)
- use pipeline-owned (chunk, panel) state keys and hash all model-controlled asset
  filenames to prevent path traversal, windows reserved-name failures and collisions
  when chapters reuse the same model panel_id; keep the model id as display metadata
- classify content-policy rejections only from explicit provider evidence instead of
  any HTTP 400, so malformed requests no longer become permanent silent skips
- resolve provider credentials only after selecting the provider so openai_compat
  endpoints never receive the agnes key; validate provider config for the web ui
- write state atomically and guard a project with a posix/windows lock; reconcile
  missing or escaped persisted assets before trusting them
- preserve storyboard order and dialogue; webtoon and page layouts expand for long or
  explicitly wrapped dialogue instead of clipping
- run independent portraits and panels under a bounded asyncio semaphore (default 3,
  configurable via INKSTONE_IMAGE_CONCURRENCY) and checkpoint successful assets in a
  batch before propagating an operational error
- harden web file routes with real path containment instead of shared-prefix strings
- add regression tests for cache invalidation, path containment, concurrency, repeated
  model ids, long dialogue and compatible-provider configuration
@phaethix
phaethix merged commit 9c8c473 into main Jul 23, 2026
3 checks passed
@phaethix
phaethix deleted the fix/design-hardening branch July 24, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant