fix: persist agent configs in server-generated classrooms#336
Merged
wyuc merged 3 commits intoTHU-MAIC:mainfrom Apr 2, 2026
Merged
fix: persist agent configs in server-generated classrooms#336wyuc merged 3 commits intoTHU-MAIC:mainfrom
wyuc merged 3 commits intoTHU-MAIC:mainfrom
Conversation
d046b19 to
ec0eadc
Compare
wyuc
requested changes
Apr 1, 2026
Contributor
wyuc
left a comment
There was a problem hiding this comment.
Avatar paths in AGENT_AVATARS don't exist in public/avatars/ — student.png, assistant.png, student-2.png, assistant-2.png are all missing. Check the actual filenames and update.
Also, AGENT_COLORS is duplicated from COLOR_PALETTE in /api/generate/agent-profiles/route.ts. Worth extracting to a shared constant so they stay in sync.
This was referenced Apr 2, 2026
YizukiAme
added a commit
to YizukiAme/OpenMAIC
that referenced
this pull request
Apr 2, 2026
- Extract AGENT_COLOR_PALETTE and AGENT_DEFAULT_AVATARS into lib/constants/agent-defaults.ts to eliminate duplication - Fix invalid avatar paths (student.png -> assist.png, etc.) to match actual files in public/avatars/ - Remove duplicated inline constants from classroom-generation.ts and agent-profiles/route.ts Addresses reviewer feedback on THU-MAIC#336
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
- Extract AGENT_COLOR_PALETTE and AGENT_DEFAULT_AVATARS into lib/constants/agent-defaults.ts to eliminate duplication - Fix invalid avatar paths (student.png -> assist.png, etc.) to match actual files in public/avatars/ - Remove duplicated inline constants from classroom-generation.ts and agent-profiles/route.ts Addresses reviewer feedback on THU-MAIC#336
db8597c to
53c9700
Compare
ifishcool
pushed a commit
to ifishcool/Linksy
that referenced
this pull request
Apr 3, 2026
* fix: persist agent configs in server-generated classrooms (THU-MAIC#316) 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 * fix: extract shared agent constants and fix avatar paths - Extract AGENT_COLOR_PALETTE and AGENT_DEFAULT_AVATARS into lib/constants/agent-defaults.ts to eliminate duplication - Fix invalid avatar paths (student.png -> assist.png, etc.) to match actual files in public/avatars/ - Remove duplicated inline constants from classroom-generation.ts and agent-profiles/route.ts Addresses reviewer feedback on THU-MAIC#336 ---------
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.