fix: persist agent configs in server-generated classrooms#336
Open
YizukiAme wants to merge 1 commit intoTHU-MAIC:mainfrom
Open
fix: persist agent configs in server-generated classrooms#336YizukiAme wants to merge 1 commit intoTHU-MAIC:mainfrom
YizukiAme wants to merge 1 commit intoTHU-MAIC:mainfrom
Conversation
c3f0e4e to
d046b19
Compare
Server-generated classrooms via /api/generate-classroom silently skip all discussion actions because agent configurations are never embedded in the persisted Stage object. Changes: - Add optional generatedAgentConfigs field to Stage interface - Inject agent configs (with avatar/color/priority) into Stage during server-side generation - Hydrate agents into IndexedDB/registry when loading from server storage on client Closes THU-MAIC#316
d046b19 to
ec0eadc
Compare
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.
Summary
Fix server-generated classrooms silently skipping all discussion actions due to missing agent configuration persistence.
Root Cause
The server-side classroom generation pipeline (
/api/generate-classroom) generates agent profiles and passes them to scene/action generation, but never embeds them in the persistedStageobject. When a client loads the classroom:loadGeneratedAgentsForStage()queries IndexedDB → empty (server can't write to client IndexedDB)selectedAgentIdsremains emptyisAgentSelected()guard returnsfalsefor every discussion actionconsumedDiscussions.add()+processNext()Changes
1.
lib/types/stage.tsgeneratedAgentConfigsfield toStageinterfacesaveGeneratedAgents()input exactly for zero-transform pass-through2.
lib/server/classroom-generation.tsAGENT_COLORSandAGENT_AVATARSconstants (consistent with/api/generate/agent-profiles)generatedAgentConfigsinto Stage object during construction with fallback avatar/color/priority3.
app/classroom/[id]/page.tsxstage.generatedAgentConfigsinto IndexedDB + agent registry via existingsaveGeneratedAgents()selectedAgentIdsso the playback engine'sisAgentSelected()guard passes correctlyData Flow (After Fix)
Backward Compatibility
generatedAgentConfigsis optional — existing classroom JSON files load normallyVerification
pnpm exec tsc --noEmit→ exit code 0, zero errorsCloses #316
Assisted by Claude Opus 4.6.