Skip to content

Commit 1d7af3b

Browse files
committed
feat: expand iframe sandbox permissions and refine debugging configuration
Extend iframe sandbox attributes to allow forms, modals, orientation lock, popups, and presentation. Update codeDebugger system prompt to clarify runtime environment and exec_commands usage constraints. Adjust model temperatures for surgicalCodeFixer and deepDebugger to 1, switch deepDebugger to OpenAI 5.1. Fix deployment manager to reset session ID on redeploy and remove redundant health check condition.
2 parents 7d958a8 + 078fbee commit 1d7af3b

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/routes/chat/components/preview-iframe.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export const PreviewIframe = forwardRef<HTMLIFrameElement, PreviewIframeProps>(
336336
if (loadState.status === 'loaded' && loadState.loadedSrc) {
337337
return (
338338
<iframe
339-
sandbox="allow-scripts allow-same-origin allow-pointer-lock"
339+
sandbox="allow-scripts allow-same-origin allow-pointer-lock allow-forms allow-modals allow-orientation-lock allow-popups allow-presentation"
340340
ref={ref}
341341
src={loadState.loadedSrc}
342342
className={className}
@@ -362,7 +362,7 @@ export const PreviewIframe = forwardRef<HTMLIFrameElement, PreviewIframeProps>(
362362
<div className={`${className} relative flex flex-col items-center justify-center bg-bg-3 border border-text/10 rounded-lg`}>
363363
{loadState.status === 'postload' && loadState.loadedSrc && (
364364
<iframe
365-
sandbox="allow-scripts allow-same-origin allow-pointer-lock"
365+
sandbox="allow-scripts allow-same-origin allow-pointer-lock allow-forms allow-modals allow-orientation-lock allow-popups allow-presentation"
366366
ref={ref}
367367
src={loadState.loadedSrc}
368368
className="absolute inset-0 opacity-0 pointer-events-none"

worker/agents/assistants/codeDebugger.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ const SYSTEM_PROMPT = `You are an elite autonomous code debugging specialist wit
3131
3232
## Project Environment
3333
You are working on a **Cloudflare Workers** project (optionally with Durable Objects). Key characteristics:
34-
- **Runtime**: Cloudflare Workers runtime (V8 isolates, not Node.js)
34+
- **Runtime**: Cloudflare Workers + Vite dev server running in an ephemeral firecracker mico-vm container
3535
- **No Node.js APIs**: No fs, path, process, etc. Use Workers APIs instead
3636
- **Request/Response**: Uses Fetch API standard (Request, Response, fetch)
3737
- **Durable Objects**: Stateful objects with transactional storage API when present
3838
- **Build**: Typically uses Vite or similar for bundling
39-
- **Deployment**: via wrangler to Cloudflare edge
4039
4140
## Platform Constraints
4241
- Apps run in Cloudflare Container sandbox with live preview
@@ -89,7 +88,7 @@ You are smart, methodical, focused and evidence-based. You choose your own path
8988
- **get_runtime_errors**: Recent runtime errors (user-driven). More reliable than logs.
9089
- **get_logs**: Cumulative logs (verbose, user-driven). **Use sparingly** - only when runtime errors lack detail. Set reset=true to clear stale logs.
9190
- **read_files**: Read file contents by RELATIVE paths (batch multiple in one call for efficiency)
92-
- **exec_commands**: Execute shell commands from project root (no cd needed)
91+
- **exec_commands**: Execute shell commands from project root (no cd needed) - Only use it to gather resources or check environment OR install/update packages (with shouldSave=true). File changes made to the sandbox are ephemeral and will be lost when the agent session ends. Use appropriate generate/regenerate tools instead.
9392
- **regenerate_file**: Autonomous surgical code fixer for existing files - see detailed guide below. **Files are automatically staged after regeneration.**
9493
- **generate_files**: Generate new files or rewrite broken files using phase implementation - see detailed guide below
9594
- **deploy_preview**: Deploy to Cloudflare Workers preview environment to verify fixes

worker/agents/inferutils/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const AGENT_CONFIG: AgentConfig = {
4040
name: AIModels.GEMINI_3_PRO_PREVIEW,
4141
reasoning_effort: 'low',
4242
max_tokens: 48000,
43-
temperature: 0.2,
43+
temperature: 1,
4444
fallbackModel: AIModels.GEMINI_2_5_PRO,
4545
},
4646
phaseImplementation: {
@@ -58,10 +58,10 @@ export const AGENT_CONFIG: AgentConfig = {
5858
fallbackModel: AIModels.GEMINI_2_5_FLASH,
5959
},
6060
deepDebugger: {
61-
name: AIModels.GEMINI_2_5_PRO,
61+
name: AIModels.OPENAI_5_1,
6262
reasoning_effort: 'high',
6363
max_tokens: 8000,
64-
temperature: 0.5,
64+
temperature: 1,
6565
fallbackModel: AIModels.GEMINI_2_5_FLASH,
6666
},
6767
fileRegeneration: {

worker/agents/services/implementations/DeploymentManager.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,13 +504,16 @@ export class DeploymentManager extends BaseAgentService implements IDeploymentMa
504504
* Ensure sandbox instance exists and is healthy
505505
*/
506506
async ensureInstance(redeploy: boolean): Promise<DeploymentResult> {
507+
if (redeploy) {
508+
this.resetSessionId();
509+
}
507510
const state = this.getState();
508511
const { sandboxInstanceId } = state;
509512
const logger = this.getLog();
510513
const client = this.getClient();
511514

512-
// Check existing instance if not forcing redeploy
513-
if (sandboxInstanceId && !redeploy) {
515+
// Check existing instance
516+
if (sandboxInstanceId) {
514517
const status = await client.getInstanceStatus(sandboxInstanceId);
515518
if (status.success && status.isHealthy) {
516519
logger.info(`DEPLOYMENT CHECK PASSED: Instance ${sandboxInstanceId} is running`);

0 commit comments

Comments
 (0)