mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
fix: emit state after refreshing runtime info so clients get model updates
The Claude agent model was not showing in the UI ("Model: Unknown") because
refreshRuntimeInfo() updated agent.runtimeInfo but never called emitState()
to notify connected clients of the change.
Fixed by:
1. Adding change detection in refreshRuntimeInfo() to check if model, sessionId,
or modeId changed
2. Calling emitState(agent) when changes are detected
3. Added debug logging in handleSystemMessage() to confirm model capture
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -782,7 +782,16 @@ export class AgentManager {
|
||||
|
||||
private async refreshRuntimeInfo(agent: ActiveManagedAgent): Promise<void> {
|
||||
try {
|
||||
agent.runtimeInfo = await agent.session.getRuntimeInfo();
|
||||
const newInfo = await agent.session.getRuntimeInfo();
|
||||
const changed =
|
||||
newInfo.model !== agent.runtimeInfo?.model ||
|
||||
newInfo.sessionId !== agent.runtimeInfo?.sessionId ||
|
||||
newInfo.modeId !== agent.runtimeInfo?.modeId;
|
||||
agent.runtimeInfo = newInfo;
|
||||
// Emit state if runtimeInfo changed so clients get the updated model
|
||||
if (changed) {
|
||||
this.emitState(agent);
|
||||
}
|
||||
} catch {
|
||||
// Keep existing runtimeInfo if refresh fails.
|
||||
}
|
||||
|
||||
@@ -875,6 +875,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
this.persistence = null;
|
||||
// Capture actual model from SDK init message (not just the configured model)
|
||||
if (message.model) {
|
||||
console.log(`[ClaudeAgentSession] Captured model from SDK init: ${message.model}`);
|
||||
this.lastOptionsModel = message.model;
|
||||
// Invalidate cached runtime info so it picks up the new model
|
||||
this.cachedRuntimeInfo = null;
|
||||
|
||||
12
plan.md
12
plan.md
@@ -122,12 +122,13 @@ Hard requirement: We must get the actual runtime model, not just echo back the r
|
||||
- If issues found: add fix tasks immediately after this task, then add re-test task after fixes.
|
||||
- **Done (2025-12-21 13:50)**: FAILED. Created Claude agent with "Automatic" model config. Agent self-reported running on `claude-opus-4-1-20250805` (Opus 4.1), but UI shows **Model: Unknown** in agent info menu. The implementation to capture model from SDK init message is not working - model is not being propagated to the UI.
|
||||
|
||||
- [ ] **Fix**: Debug and fix Claude agent model capture from SDK init message.
|
||||
- [x] **Fix**: Debug and fix Claude agent model capture from SDK init message.
|
||||
- Check server logs to see if `handleSystemMessage()` is receiving the init message with model
|
||||
- Verify `this.lastOptionsModel` is being set correctly
|
||||
- Check if `getRuntimeInfo()` is being called after stream completion
|
||||
- Ensure runtime info is being persisted and sent to client via WebSocket
|
||||
- The model should show `claude-opus-4-1-20250805` instead of "Unknown"
|
||||
- **Done (2025-12-21 14:10)**: Found and fixed the bug. The issue was in `agent-manager.ts:refreshRuntimeInfo()` - it updated `agent.runtimeInfo` but never called `emitState(agent)` to notify clients. Fixed by adding change detection and emitting state when runtimeInfo changes. Also added debug logging to `handleSystemMessage()` to confirm model capture from SDK init message. Typecheck passes.
|
||||
|
||||
- [ ] **Test**: Re-verify Claude agent model display after fix.
|
||||
- Create a new Claude agent with default model
|
||||
@@ -141,6 +142,15 @@ Hard requirement: We must get the actual runtime model, not just echo back the r
|
||||
- Add implementation tasks if improvements needed
|
||||
- Add fix tasks if tests reveal issues
|
||||
|
||||
- [ ] **Plan**: Fix agent git diff not loading.
|
||||
|
||||
- Investigate why git diff is not loading in agent view.
|
||||
- Find where git diff is fetched and rendered.
|
||||
- Identify the root cause of the loading failure.
|
||||
- Add implementation/fix tasks based on findings.
|
||||
- Add test task to verify git diff loads correctly via Playwright MCP.
|
||||
- Add another **Plan** task to re-audit after fix if needed.
|
||||
|
||||
- [ ] **Plan**: Design and implement agent parent/child hierarchy.
|
||||
|
||||
- Add `parentId` field to agents.
|
||||
|
||||
Reference in New Issue
Block a user