fix(vocational): send taskEngineMode on the on-demand scene generation path#716
Open
ly-wang19 wants to merge 1 commit into
Open
fix(vocational): send taskEngineMode on the on-demand scene generation path#716ly-wang19 wants to merge 1 commit into
ly-wang19 wants to merge 1 commit into
Conversation
The vocational gate keys off requirements.taskEngineMode in the /api/generate/scene-content body, but only the first scene (generation-preview) sent it. Scenes 2..N and retries run through useSceneGenerator.generateRemaining / fetchSceneContent, which never sent requirements, so resolveVocationalActive returned false and applyOutlineFallbacks rewrote every later procedural-skill scene to diagram — silently dropping the task-engine training mechanism for most of a vocational course (the outline says procedural-skill while the content path strips it). Thread the persisted stage.taskEngineMode through GenerationParams into both fetchSceneContent bodies (the retry path inherits it via lastParamsRef), mirroring what the first-scene request already sends. Server contract is unchanged; the flag is still ANDed with the OPENMAIC_ENABLE_VOCATIONAL env gate server-side. Closes THU-MAIC#715
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #715.
Problem
The vocational task-engine gate is driven by
requirements.taskEngineModein the/api/generate/scene-contentrequest body (resolveVocationalActive→applyOutlineFallbacks({ allowProceduralSkill })). Only the first scene sends it (app/generation-preview/page.tsx). Scenes 2..N and retries are generated byuseSceneGenerator.generateRemaining/fetchSceneContent, which never includedrequirements— sovocationalActivewasfalsefor them andapplyOutlineFallbacksrewrote everyprocedural-skilloutline todiagram. The outline saysprocedural-skill, the content path strips it; most scenes of a vocational course silently lose the task-engine widget. (Full trace in #715.)Fix (minimal, client-side)
taskEngineModeis already persisted on the stage (lib/types/stage.ts,lib/utils/database.ts, written instage-storage.ts), so this mirrors what scene 1 already does:taskEngineMode?: booleantoGenerationParamsgenerateRemaining(...)call site fromstage.taskEngineModerequirements: { taskEngineMode: params.taskEngineMode === true }in bothfetchSceneContentbodiesThe retry path (
retrySingleOutline) inherits it automatically — it reuseslastParamsRef.current. Server contract is unchanged; the flag is still ANDed with theOPENMAIC_ENABLE_VOCATIONALenv gate, so this is not a security/routing change — it only stops the client from dropping a flag it already sends for scene 1.Note on approach
This is the smallest fix that restores parity with the first-scene path. If you'd prefer a server-authoritative shape instead — e.g. persisting
taskEngineModeonto the outline so the content route doesn't depend on the client re-sending it — I'm happy to revise this PR that way; it's your feature and I'd rather match your intended design.Verification
prettierclean,eslintclean,tsc --noEmiterror count unchanged (only pre-existing unresolved@maic/*workspace-module errors; neither edited file appears).tests/generation/scene-content-route-vocational-gate.test.ts; the gap is purely the client hook's request body, and the repo has no React-hook (renderHook + fetch-mock + Zustand) harness to assert it without adding disproportionate test infra. Happy to add one if you'd like to introduce that harness.