[PR #860] [MERGED] fix(slurp2): 0.0.12 repair AI Creator drafts instead of failing #1160

Closed
opened 2026-10-21 05:04:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/860
Author: @Gunterlie
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/14/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/slurp2-0.0.12-smart-drafts


📝 Commits (3)

  • f322181 fix(slurp2): repair AI Creator drafts instead of failing (0.0.12)
  • 304321f feat(slurp2): give persona Creators AI drafts and AI images
  • a753f83 fix(slurp2): address CodeRabbit review on 0.0.12

📊 Changes

24 files changed (+712 additions, -311 deletions)

View changed files

➕ artifacts/slurp2-0.0.12.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -0)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -0)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -0)
📝 packages/slurp2/CHANGELOG.md (+6 -0)
📝 packages/slurp2/client.js (+29 -29)
📝 packages/slurp2/manifest.json (+5 -5)
📝 packages/slurp2/server.mjs (+199 -190)
📝 packages/slurp2/src/engine/packages/client/src/components/slurp/SlurpHome.tsx (+60 -14)
📝 packages/slurp2/src/engine/packages/client/src/components/slurp/slurp2-release.ts (+10 -1)
📝 packages/slurp2/src/engine/packages/client/src/hooks/use-slurp.ts (+4 -0)
📝 packages/slurp2/src/engine/packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/slurp2/src/engine/packages/server/src/routes/slurp.routes.ts (+39 -13)
📝 packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-generation.service.ts (+5 -1)
📝 packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-post.operation.ts (+9 -1)
📝 packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-stage-profile-draft.service.ts (+57 -26)
➕ packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-stage-profile-repair.ts (+119 -0)

...and 4 more files

📄 Description

Pull request

Important

This contribution targets staging. Only SpicyMarinara may promote staging to main.

Linked issue

Closes #859

Why this change

A user on 0.0.11 still could not create Creators with AI, even though the model returned a complete profile with "gender": "female" and six tags. The server log shows the bulk create request answered 201 after one model call, with the Creator skipped as "did not include a valid gender and at least 3 tags" — a reason that did not match the answer.

Root causes:

  1. The draft service returns form-only keys (sourceSnapshot in open mode, sourceRevisionToken when redrafting). The bulk route passed the whole draft to the .strict() create schema, so every open-mode Creator was refused as unrecognized_keys and reported with the wrong reason.
  2. A draft that broke one strict limit (bio 500, stagePersonality 1000) failed as a whole, twice, because the prompt never stated the limits — and the route replaced the cause with a generic 500 message.
  3. Single-quoted values and unescaped quotes inside a value could not be parsed at all.
  4. A hinted draft that named its source in prose was rejected rather than rewritten.

What changed

A draft is repaired, not rejected (slurp-stage-profile-repair.ts, new and pure):

  • Over-long text is shortened at the last sentence end that keeps most of the text.
  • The handle loses a leading @ and spaces, or is built from the display name.
  • Gender spellings are understood (woman, f, non-binary, …); anything unknown becomes null with a note.
  • Tags arrive as a list or as one comma-separated string; unknown tags are dropped with a note.
  • Every repair adds a short note. The create form shows them, for example "Stage personality was shortened to fit 1000 characters. Pick a gender before saving."
  • Only an answer with no object or no display name is unusable.

Draft service

  • jsonrepair (already an Engine server dependency) is the last parsing resort after parseGameJsonish.
  • The retry runs only when nothing usable came back, so a fixable field no longer costs a second model call.
  • The prompt states the four length limits.
  • In hinted mode, a leaked source name in the bio or stage personality is rewritten through protectNoodlerGeneratedIdentity, with a note. A leaked name or handle is still refused.

Routes

  • Bulk creation strips notes, sourceSnapshot, and sourceRevisionToken before the strict schema, and reports the real validation reason when it is not the gender/tags rule.
  • The draft route returns the real error text instead of the generic message.

Persona Creator parity (requested in review)

  • Unattended generation stays blocked for a persona-sourced Creator (scheduler, world tick, bulk refresh); an explicit request from its owner is allowed, so the composer's Guide button now drafts posts and stories for these Creators instead of answering 404.
  • New composer AI image toggle: on a guided post it asks the model for an image prompt and renders it, whatever the scheduler's image setting says; on a manual post it keeps the post text as image directions and renders the image right after publishing.
  • Post creation accepts imagePrompt, so a manual post can be rendered later through the existing reviewed-image path.
  • New tests/slurp2-persona-creator-ai.regression.ts covers the gate, the automatic-path exclusions, the toggle wiring, and the manual image path.

Release: slurp2 0.0.12 with payloads, artifact, catalog entries, and notes. New tests/slurp2-stage-profile-repair.regression.ts covers the reported answer, over-long text, gender spellings, comma-separated tags, unusable answers, and the route/service wiring.

Package and security impact

  • Affected package IDs: slurp2
  • Engine compatibility impact: unchanged. New bundled dependency jsonrepair, resolved from the Engine server workspace at build time.
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none; normal update from 0.0.11. notes is response-only and never stored on a Creator.

Validation

Run on commit 304321fa:

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry (slurp2 0.0.12)
  • npm run typecheck:packages — 0 errors; npm run check — 0 errors (baseline warnings)
  • node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/tests/catalog-release-notes.regression.mjs — passed
  • All tests/slurp2-*.regression.ts passed, plus noodler-stage-profile-draft, noodler-disclosure-contract, and noodler-generation-guidance-default
  • tests/slurp-*.regression.ts — the same 11 baseline failures as on staging; no new failures

Not done: no browser test and no live model call. Noodle package browser is expected to fail (Engine staging retired PUT /api/characters/personas/:id/activate); it is not a required check.

Summary by CodeRabbit

  • New Features

    • Persona Creators can draft posts with AI and optionally generate images from post text.
    • AI Creator drafts now repair common formatting, length, gender, and tag issues.
    • Draft generation displays repair notes and more specific error details.
  • Bug Fixes

    • Fixed bulk Creator creation incorrectly skipping eligible open-mode Creators.
    • Improved handling of invalid draft data and image-generation failures.
  • Release

    • Released Slurp Remastered version 0.0.12.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/860 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 9/14/2026 **Status:** ✅ Merged **Merged:** 9/14/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/slurp2-0.0.12-smart-drafts` --- ### 📝 Commits (3) - [`f322181`](https://github.com/Pasta-Devs/Marinara-Agents/commit/f322181304c33778fd5a146af54fd1ae768ef5bd) fix(slurp2): repair AI Creator drafts instead of failing (0.0.12) - [`304321f`](https://github.com/Pasta-Devs/Marinara-Agents/commit/304321fae80163d3a7d247c18be4eed97e720f6b) feat(slurp2): give persona Creators AI drafts and AI images - [`a753f83`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a753f831ed63985a8eeaeb8e776facfd8dc8eac1) fix(slurp2): address CodeRabbit review on 0.0.12 ### 📊 Changes **24 files changed** (+712 additions, -311 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/slurp2-0.0.12.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -0) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -0) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -0) 📝 `packages/slurp2/CHANGELOG.md` (+6 -0) 📝 `packages/slurp2/client.js` (+29 -29) 📝 `packages/slurp2/manifest.json` (+5 -5) 📝 `packages/slurp2/server.mjs` (+199 -190) 📝 `packages/slurp2/src/engine/packages/client/src/components/slurp/SlurpHome.tsx` (+60 -14) 📝 `packages/slurp2/src/engine/packages/client/src/components/slurp/slurp2-release.ts` (+10 -1) 📝 `packages/slurp2/src/engine/packages/client/src/hooks/use-slurp.ts` (+4 -0) 📝 `packages/slurp2/src/engine/packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/slurp2/src/engine/packages/server/src/routes/slurp.routes.ts` (+39 -13) 📝 `packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-generation.service.ts` (+5 -1) 📝 `packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-post.operation.ts` (+9 -1) 📝 `packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-stage-profile-draft.service.ts` (+57 -26) ➕ `packages/slurp2/src/engine/packages/server/src/services/slurp/slurp-stage-profile-repair.ts` (+119 -0) _...and 4 more files_ </details> ### 📄 Description # Pull request > [!IMPORTANT] > This contribution targets `staging`. Only `SpicyMarinara` may promote `staging` to `main`. ## Linked issue Closes #859 ## Why this change A user on 0.0.11 still could not create Creators with AI, even though the model returned a complete profile with `"gender": "female"` and six tags. The server log shows the bulk create request answered 201 after one model call, with the Creator skipped as "did not include a valid gender and at least 3 tags" — a reason that did not match the answer. Root causes: 1. The draft service returns form-only keys (`sourceSnapshot` in open mode, `sourceRevisionToken` when redrafting). The bulk route passed the whole draft to the `.strict()` create schema, so **every open-mode Creator was refused** as `unrecognized_keys` and reported with the wrong reason. 2. A draft that broke one strict limit (`bio` 500, `stagePersonality` 1000) failed as a whole, twice, because the prompt never stated the limits — and the route replaced the cause with a generic 500 message. 3. Single-quoted values and unescaped quotes inside a value could not be parsed at all. 4. A hinted draft that named its source in prose was rejected rather than rewritten. ## What changed **A draft is repaired, not rejected** (`slurp-stage-profile-repair.ts`, new and pure): - Over-long text is shortened at the last sentence end that keeps most of the text. - The handle loses a leading `@` and spaces, or is built from the display name. - Gender spellings are understood (`woman`, `f`, `non-binary`, …); anything unknown becomes `null` with a note. - Tags arrive as a list or as one comma-separated string; unknown tags are dropped with a note. - Every repair adds a short note. The create form shows them, for example "Stage personality was shortened to fit 1000 characters. Pick a gender before saving." - Only an answer with no object or no display name is unusable. **Draft service** - `jsonrepair` (already an Engine server dependency) is the last parsing resort after `parseGameJsonish`. - The retry runs only when nothing usable came back, so a fixable field no longer costs a second model call. - The prompt states the four length limits. - In hinted mode, a leaked source name in the bio or stage personality is rewritten through `protectNoodlerGeneratedIdentity`, with a note. A leaked name or handle is still refused. **Routes** - Bulk creation strips `notes`, `sourceSnapshot`, and `sourceRevisionToken` before the strict schema, and reports the real validation reason when it is not the gender/tags rule. - The draft route returns the real error text instead of the generic message. **Persona Creator parity (requested in review)** - Unattended generation stays blocked for a persona-sourced Creator (scheduler, world tick, bulk refresh); an explicit request from its owner is allowed, so the composer's **Guide** button now drafts posts and stories for these Creators instead of answering 404. - New composer **AI image** toggle: on a guided post it asks the model for an image prompt and renders it, whatever the scheduler's image setting says; on a manual post it keeps the post text as image directions and renders the image right after publishing. - Post creation accepts `imagePrompt`, so a manual post can be rendered later through the existing reviewed-image path. - New `tests/slurp2-persona-creator-ai.regression.ts` covers the gate, the automatic-path exclusions, the toggle wiring, and the manual image path. **Release**: slurp2 `0.0.12` with payloads, artifact, catalog entries, and notes. New `tests/slurp2-stage-profile-repair.regression.ts` covers the reported answer, over-long text, gender spellings, comma-separated tags, unusable answers, and the route/service wiring. ## Package and security impact - Affected package IDs: `slurp2` - Engine compatibility impact: unchanged. New bundled dependency `jsonrepair`, resolved from the Engine server workspace at build time. - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none; normal update from 0.0.11. `notes` is response-only and never stored on a Creator. ## Validation Run on commit `304321fa`: - [x] `node scripts/validate-catalog.mjs` passes locally - [x] `git diff --check` passes locally - [x] Rebuilt every affected manifest, payload, artifact, and catalog entry (`slurp2` 0.0.12) - `npm run typecheck:packages` — 0 errors; `npm run check` — 0 errors (baseline warnings) - `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/tests/catalog-release-notes.regression.mjs` — passed - All `tests/slurp2-*.regression.ts` passed, plus `noodler-stage-profile-draft`, `noodler-disclosure-contract`, and `noodler-generation-guidance-default` - `tests/slurp-*.regression.ts` — the same 11 baseline failures as on `staging`; no new failures Not done: no browser test and no live model call. `Noodle package browser` is expected to fail (Engine staging retired `PUT /api/characters/personas/:id/activate`); it is not a required check. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Persona Creators can draft posts with AI and optionally generate images from post text. * AI Creator drafts now repair common formatting, length, gender, and tag issues. * Draft generation displays repair notes and more specific error details. * **Bug Fixes** * Fixed bulk Creator creation incorrectly skipping eligible open-mode Creators. * Improved handling of invalid draft data and image-generation failures. * **Release** * Released Slurp Remastered version 0.0.12. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:04:09 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1160
No description provided.