Skip to content

Feat/webui code genesis#843

Merged
tastelikefeet merged 11 commits intomainfrom
feat/webui_code_genesis
Feb 2, 2026
Merged

Feat/webui code genesis#843
tastelikefeet merged 11 commits intomainfrom
feat/webui_code_genesis

Conversation

@vinci-grape
Copy link
Collaborator

Change Summary

Fix post-build bugs

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check.
  • Documentation reflects the changes where applicable

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vinci-grape, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request is a major feature addition, integrating a powerful new multi-agent code generation framework called 'Code Genesis' and overhauling the web user interface to provide a more interactive and informative experience. The changes span both frontend and backend, focusing on robust communication between the UI and the agent, flexible configuration, and a dedicated chat mode for general AI assistance. The goal is to make the code generation process more transparent, controllable, and user-friendly.

Highlights

  • Introduction of Code Genesis Multi-Agent Framework: This pull request introduces 'Code Genesis', a new open-source, compositional multi-agent framework designed for end-to-end generation of production-ready software projects from natural language requirements. It features a sophisticated architecture with specialized agents for various stages of the software development lifecycle, including requirement analysis, architecture design, file structuring, dependency management, code synthesis with LSP validation, and runtime refinement with automated deployment.
  • Enhanced Web UI with Chat Mode and Detailed Agent Feedback: The Web UI has been significantly upgraded to support a new 'Chat Assistant' mode, allowing direct conversational interaction. It also provides much more granular feedback on agent activity, including structured display of workflow steps, tool calls with arguments and results, and a consolidated view of generated files. This improves transparency and user experience during project generation.
  • Improved Backend Agent Communication and Configuration: The backend agent_runner has been refactored to handle diverse agent outputs more robustly, including multi-line JSON parsing for tool calls and results, and dynamic log cleaning. Configuration handling for LLMs and tools (like diff-based editing and EdgeOne Pages deployment) has been made more flexible, allowing parameters to be passed directly via command line arguments and conditionally enabled/disabled.
  • Streamlined File Management and Access: The file system interaction in the backend API has been improved to resolve file paths more intelligently, searching in multiple locations (session output, project output directories). The frontend now consolidates generated file listings, presenting them in a structured manner after the coding phase, rather than as individual messages.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces significant new features, including a web UI chat mode and a more robust agent output parser. The changes are extensive and well-implemented for the most part. I've identified a high-severity issue in the WebSocket handling that could lead to a frontend crash, which should be addressed. I also noted a couple of potential feature regressions in the frontend regarding file previews and message retries that might need a second look. Additionally, there are some minor style issues with misplaced imports in the Python backend code.

Comment on lines 188 to 191
socket.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
handleWebSocketMessage(data);
} catch (e) {
console.error('[WS] Non-JSON message:', event.data, e);

// Fallback: stop the loading state to avoid being stuck in "Processing".
endRunningState('error', typeof event.data === 'string'
? event.data
: 'Agent failed with non-JSON output');

// Don't throw again to avoid a blank screen.
}
const data = JSON.parse(event.data);
handleWebSocketMessage(data);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The try...catch block around JSON.parse(event.data) has been removed. If the WebSocket receives a non-JSON message, this will throw an unhandled exception and crash the application. It's crucial to restore the error handling to ensure the UI remains stable even if unexpected data is received from the backend.

Suggested change
socket.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
handleWebSocketMessage(data);
} catch (e) {
console.error('[WS] Non-JSON message:', event.data, e);
// Fallback: stop the loading state to avoid being stuck in "Processing".
endRunningState('error', typeof event.data === 'string'
? event.data
: 'Agent failed with non-JSON output');
// Don't throw again to avoid a blank screen.
}
const data = JSON.parse(event.data);
handleWebSocketMessage(data);
};
socket.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
handleWebSocketMessage(data);
} catch (e) {
console.error('Failed to parse WebSocket message:', event.data, e);
}
};

# Pattern: [INFO:ms_agent] without [agent_name] afterwards
if '[INFO:ms_agent]' in line:
# Check if there's an agent name tag [xxx] after [INFO:ms_agent]
import re
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Imports should generally be at the top of the file. import re is used here and in other places within methods. The same applies to import json and import traceback in this file. Moving all imports to the top of the file is a standard Python convention (PEP 8) and improves readability and avoids repeated import overhead.

Comment on lines 147 to 148
import ms_agent
from pathlib import Path
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Imports should be at the top of the file. import ms_agent and from pathlib import Path are imported inside a function. Please move them to the top of the file to follow standard Python conventions (PEP 8) and improve code organization.

Comment on lines 166 to 218
const handleViewFile = async (path: string) => {
setSelectedFile(path);
setFileLoading(true);
try {
// Build path variants - add project-specific paths
const pathVariants = [
path, // Original path from file tree
];

// If we have a project, try project-specific paths
if (currentSession?.project_id) {
pathVariants.push(`projects/${currentSession.project_id}/output/${path}`);
}

// Also try without prefix
pathVariants.push(path.replace(/^output\//, ''));
pathVariants.push(path.split('/').pop() || path);

setSelectedFile(path);
setFileLoading(true);
const kind = getFileKind(path);
setFileKind(kind);
let lastError: Error | null = null;

try {
if (kind === 'text') {
for (const pathVariant of pathVariants) {
try {
const response = await fetch('/api/files/read', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ path: path, session_id: currentSession?.id }),
body: JSON.stringify({ path: pathVariant }),
});

if (!response.ok) {
const error = await response.json();
throw new Error(error.detail || 'Failed to load file');
if (response.ok) {
const data = await response.json();
setFileContent(data.content);
return; // Success, exit early
} else {
const errorData = await response.json().catch(() => ({ detail: `HTTP ${response.status}` }));
lastError = new Error(errorData.detail || `Failed to load file: ${pathVariant}`);
}

const data = await response.json();
setFileContent(data.content);
setFileUrl(null);
return;
} catch (err) {
lastError = err instanceof Error ? err : new Error('Unknown error');
}
}

const sid = currentSession?.id;
const streamUrl =
`/api/files/stream?path=${encodeURIComponent(path)}&session_id=${encodeURIComponent(sid || '')}`;
setFileUrl(streamUrl);
setFileContent(null);
} catch (err) {
setFileError(err instanceof Error ? err.message : 'Failed to load file');
} finally {
setFileLoading(false);
// If all attempts failed, show the last error
if (lastError) {
console.error('Failed to load file with all path variants:', lastError);
setFileContent(`Error: ${lastError.message}\n\nTried paths:\n${pathVariants.join('\n')}`);
}
};
} catch (err) {
console.error('Failed to load file:', err);
setFileContent(`Error: ${err instanceof Error ? err.message : 'Unknown error'}`);
} finally {
setFileLoading(false);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This refactoring seems to have removed the functionality to preview binary files like images and videos. The previous implementation handled different file kinds and used the /api/files/stream endpoint for non-text files. The new implementation only fetches and displays text content. Was this removal of functionality intentional? If not, it should be restored as it's a regression.

Comment on lines 382 to 409
const sendMessage = useCallback((content: string) => {
if (!currentSession || !ws || ws.readyState !== WebSocket.OPEN) return;

// Add user message locally
setMessages(prev => [...prev, {
id: Date.now().toString(),
role: 'user',
content,
type: 'text',
timestamp: new Date().toISOString(),
status: 'running',
client_request_id: clientRequestId,
}]);
}

ws.send(JSON.stringify({
action: 'start',
query: content,
client_request_id: clientRequestId, // If the backend can pass it back unchanged, that would be better.
}));
// For chat mode, send as input to existing process
// For project mode, start a new agent
if (currentSession.session_type === 'chat') {
ws.send(JSON.stringify({
action: 'send_input',
input: content,
}));
} else {
ws.send(JSON.stringify({
action: 'start',
query: content,
}));
}

setIsStreaming(false);
setStreamingContent('');
setIsLoading(true);
}, [currentSession, ws]);
setIsLoading(true);
}, [currentSession, ws]);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The sendMessage function has been refactored, and in the process, the ability to retry sending a message (using reuseMessageId) has been removed. This was a useful feature for recovering from transient errors without re-typing the query. Was this removal intentional? If not, consider re-introducing this capability.

@tastelikefeet tastelikefeet merged commit dc83fa4 into main Feb 2, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants