Skip to content

feat(studio): coding agent summary and some fixes - #551

Merged
dmariali merged 12 commits into
mainfrom
feat-studio-coding-agent-summary
Jul 3, 2026
Merged

feat(studio): coding agent summary and some fixes#551
dmariali merged 12 commits into
mainfrom
feat-studio-coding-agent-summary

Conversation

@dmariali

@dmariali dmariali commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added a richer Studio question flow for clarifications and multiple-choice prompts.
    • Introduced collapsed “work details” summaries in chat, with expandable details and clearer labels.
    • Improved handling of Studio summary blocks so related assistant messages are grouped more cleanly.
    • Added a new trivia question-and-answer generation config.
  • Bug Fixes

    • Removed stray “Workspace” artifacts from chat history and artifact panels.
    • Updated chat behavior so unsupported actions return clearer responses.

dmariali added 5 commits June 26, 2026 14:59
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
@dmariali
dmariali requested review from a team as code owners July 2, 2026 17:29
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Studio-native ask_user_question MCP tool with blocking/SSE response handling, replacing Claude Code's built-in AskUserQuestion; reworks permission/input resolution to remove local timeouts; adds an unsupported-method MCP route; and introduces frontend logic to collapse Studio summary blocks into an expandable disclosure UI. Also removes the Workspace artifact row and adds an unrelated trivia_qa.py config builder.

Changes

Backend MCP Tool and Streaming

Layer / File(s) Summary
ask_user_question tool contract
services/studio/src/nmp/studio/coding_agent_mcp_tools.py
Adds tool schema, registers in MCP_TOOLS/STUDIO_UI_TOOL_NAMES, updates agent context to reference mcp__nemo_studio__ask_user_question.
Claude MCP config wiring
services/studio/src/nmp/studio/coding_agents.py
Adds timeout/keepalive constants, disallows built-in AskUserQuestion, updates system prompt for summary block formatting.
Blocking/SSE tool response
services/studio/src/nmp/studio/coding_agents.py
Adds keepalive SSE streaming helper, removes local wait_for timeouts on permission/input futures, adds _request_studio_question.
Dispatcher rewiring & unsupported route
services/studio/src/nmp/studio/coding_agents.py
Routes AskUserQuestion/SELECT_*/approve through blocking response path; adds 405 handler for GET/DELETE on MCP path.
Backend tests
services/studio/tests/unit/test_coding_agents.py
Covers argv/mcp-config, tools/list, system prompt, async resolution flows, and 405 behavior.

Studio Summary Collapsing UI

Layer / File(s) Summary
Summary block parsing & serialization
web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/toolParts.ts, toolParts.test.ts
Extracts StudioSummaryBlock from sentinel markers, derives labels, serializes collapsed tool-call parts.
Disclosure rendering
ClaudeCodeToolCallPart.tsx, ClaudeCodeToolCallPart.test.tsx
Renders collapsed studio details as an expandable <details> UI with parsed segments.
Elapsed time tracking
useCustomAssistantChatRuntime.ts
Records runStartedAt and passes elapsedMs into completion parsing.
History combining
util.ts, util.test.ts
Merges consecutive assistant messages preceding a Studio summary marker before further processing.
Workspace row removal
historyPanel/ClaudeCodeArtifactsPane.tsx, historyPanel/helpers.ts, ClaudeCodeHistoryPanel.test.tsx
Removes Workspace artifact row and drops artifacts.workspace from hasArtifacts.

Unrelated Data Designer Config

Layer / File(s) Summary
Trivia QA config builder
trivia_qa.py
New module defining load_config_builder() with sampler and LLM columns for trivia Q&A generation.

Sequence Diagram(s)

sequenceDiagram
  participant ClaudeCode
  participant MCPDispatcher as Studio MCP Dispatcher
  participant StudioUI

  ClaudeCode->>MCPDispatcher: tools/call ask_user_question
  MCPDispatcher->>MCPDispatcher: create pending future, open SSE
  MCPDispatcher-->>ClaudeCode: keepalive events
  StudioUI->>MCPDispatcher: resolve_permission(answer)
  MCPDispatcher-->>ClaudeCode: event: message (JSON-RPC result)
Loading
sequenceDiagram
  participant Runtime as Chat Runtime
  participant ToolParts as getClaudeCodeCompletedMessageParts
  participant UI as ToolCallPart UI

  Runtime->>ToolParts: assistant content + elapsedMs
  ToolParts->>ToolParts: detect STUDIO_MESSAGE_SUMMARY markers
  ToolParts-->>Runtime: collapsed tool-call + summary text
  Runtime-->>UI: render collapsed disclosure
Loading

Possibly related PRs

Suggested labels: feat

Suggested reviewers: mckornfield, htolentino-nvidia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main coding-agent summary work and related fixes in Studio.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-studio-coding-agent-summary

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
services/studio/src/nmp/studio/coding_agents.py (1)

862-863: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fragile string-match coupling to _request_permission's literal message.

message == "no active Studio coding-agent session" hard-codes another function's literal string (Line 786) to detect the no-session case. If that message text changes, this silently breaks and misclassifies "no session" as an "answered" response.

♻️ Suggested fix
-async def _request_studio_question(session_id: str, args: dict[str, Any]) -> dict[str, Any]:
-    result = await _request_permission(
-        session_id,
-        {"tool_name": "AskUserQuestion", "input": args},
-    )
-    message = result.get("message")
-    if message == "no active Studio coding-agent session":
-        return {"status": "error", "message": message}
+async def _request_studio_question(session_id: str, args: dict[str, Any]) -> dict[str, Any]:
+    if session_id not in _session_streams:
+        return {"status": "error", "message": "no active Studio coding-agent session"}
+    result = await _request_permission(
+        session_id,
+        {"tool_name": "AskUserQuestion", "input": args},
+    )
+    message = result.get("message")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/studio/src/nmp/studio/coding_agents.py` around lines 862 - 863, The
no-session branch in the response handling is coupled to `_request_permission`
via a hard-coded literal message, so update the check in the coding-agent
session flow to use a stable sentinel or structured status instead of comparing
against the exact string. Adjust `_request_permission` to return a distinct
machine-readable indicator for the “no active session” case, and have the caller
in `coding_agents.py` branch on that symbol rather than the message text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@services/studio/src/nmp/studio/coding_agents.py`:
- Around line 58-69: The MCP streaming path in the studio coding agent does not
currently send real `notifications/progress` updates and `_claude_env()` strips
Claude Code idle-timeout env vars, so long waits can still abort. Update the MCP
handling in `coding_agents.py` to either emit progress notifications using the
`progressToken` flow or preserve `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` when
building the subprocess environment, and make sure the SSE/handler logic in the
`PUBLIC_MCP_PATH` flow keeps the tool alive during permission and input waits.

In `@web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/toolParts.ts`:
- Around line 376-388: The summary parser in getStudioSummaryBlock /
getClaudeCodeCompletedMessageParts is falling back to legacy parts when
STUDIO_MESSAGE_SUMMARY_END is missing, which can surface the raw sentinel token
in the chat UI. Handle the truncated-stream case explicitly in
getStudioSummaryBlock (or the caller) by detecting the missing end marker,
deriving a safe neutral summary from any available detail text, and returning
that instead of undefined so raw marker-containing text is never rendered.
- Around line 369-379: The summary parsing in ClaudeCodeChatRoute’s toolParts
logic is dropping interleaved non-text parts because summarySource is built from
parts.slice(index + 1) with non-text parts replaced by empty strings, but those
parts are never retained anywhere else. Update the summary extraction flow so
the scan for STUDIO_MESSAGE_SUMMARY_END can still work while preserving any
intervening tool-call or other non-text parts in detailParts, using the same
parsing path around summaryBlockText/summaryStartIndex to keep streamed parts
intact.

In
`@web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useCustomAssistantChatRuntime.ts`:
- Line 196: The runtime timer in useCustomAssistantChatRuntime is not reset
after prepareForUserInput(), so the final “worked for X” duration can include
time spent waiting on user input. Update the flow around runStartedAt so that
when the chat resumes after the AskUserQuestion pause, you either reset the
start timestamp or subtract the paused duration before computing the label. Use
the existing runStartedAt handling in useCustomAssistantChatRuntime and the
prepareForUserInput() resume path to keep the reported work time accurate.

---

Nitpick comments:
In `@services/studio/src/nmp/studio/coding_agents.py`:
- Around line 862-863: The no-session branch in the response handling is coupled
to `_request_permission` via a hard-coded literal message, so update the check
in the coding-agent session flow to use a stable sentinel or structured status
instead of comparing against the exact string. Adjust `_request_permission` to
return a distinct machine-readable indicator for the “no active session” case,
and have the caller in `coding_agents.py` branch on that symbol rather than the
message text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dae4a444-841e-4498-9b94-7b37abc96169

📥 Commits

Reviewing files that changed from the base of the PR and between c7641ee and bac56a6.

📒 Files selected for processing (14)
  • services/studio/src/nmp/studio/coding_agent_mcp_tools.py
  • services/studio/src/nmp/studio/coding_agents.py
  • services/studio/tests/unit/test_coding_agents.py
  • trivia_qa.py
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/ClaudeCodeHistoryPanel.test.tsx
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/ClaudeCodeToolCallPart.test.tsx
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/ClaudeCodeToolCallPart.tsx
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/historyPanel/ClaudeCodeArtifactsPane.tsx
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/historyPanel/helpers.ts
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/toolParts.test.ts
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/toolParts.ts
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useCustomAssistantChatRuntime.ts
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/util.test.ts
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/util.ts
💤 Files with no reviewable changes (1)
  • web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/historyPanel/helpers.ts

Comment thread services/studio/src/nmp/studio/coding_agents.py
Comment thread web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/toolParts.ts Outdated
@dmariali
dmariali force-pushed the feat-studio-coding-agent-summary branch from bac56a6 to 65ecc11 Compare July 2, 2026 18:24
@dmariali dmariali changed the title Feat studio coding agent summary feat(studio): coding agent summary and some fixes Jul 2, 2026
@github-actions github-actions Bot added the feat label Jul 2, 2026
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 22868/29990 76.2% 61.1%
Integration Tests 13182/28670 46.0% 19.3%

code rabbit feedback

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
@dmariali
dmariali force-pushed the feat-studio-coding-agent-summary branch from 94c1504 to 37c6d03 Compare July 2, 2026 18:56
dmariali added 4 commits July 2, 2026 15:04
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
@dmariali
dmariali added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit edcfc13 Jul 3, 2026
53 checks passed
@dmariali
dmariali deleted the feat-studio-coding-agent-summary branch July 3, 2026 18:00
arpitsardhana pushed a commit that referenced this pull request Jul 9, 2026
* init

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* enforce summary

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* feat(studio): Add chat summaries, remove timeouts on coding agent inputs

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* cleanup unnecessary change

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* lint fix & code rabbit feedback

code rabbit feedback

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* Update trivia_qa.py

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* Delete trivia_qa.py

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

* fix refresh hydration issue, format summaries, show links in summaries

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>

---------

Signed-off-by: Danielle Ali <44468613+dmariali@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants