Skip to content

fix(agent): prevent projectless app builds - #120

Merged
iamjr15 merged 1 commit into
mainfrom
fix/projectless-build-preview
Aug 3, 2026
Merged

fix(agent): prevent projectless app builds#120
iamjr15 merged 1 commit into
mainfrom
fix/projectless-build-preview

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Route high-confidence first-run web/mobile build imperatives through the managed app-builder path.
  • Treat /workspace as a virtual project root across file, shell, inline-code, and preview commands.
  • Run genuinely projectless calculations and environment probes from /tmp so they cannot leave orphaned durable files.
  • Persist the resolved builder mode when lazy project materialization creates the project.

Context

A production DeepSeek run wrote a complete site into /workspace/beautiful-site without attaching a project or registering a managed preview, then claimed the result was available in Computer. Files therefore had no project to open and Browser had no preview record.

No Linear issue or standalone plan document is linked; this is a production QA follow-up to the preview recovery work in #118 and #119.

Architecture

A narrowly matched imperative first message (for example, “build a website”) is promoted from general mode into the existing app-builder path before model execution. The builder creates the canonical project and managed preview first. Tool execution then remaps the model-facing virtual /workspace namespace into that project root. Commands with no workspace intent remain projectless and use /tmp.

Decisions Made

Decision Choice Alternatives considered Reasoning
Model variance Enforce the invariant in runtime code More prompt wording Weaker models may ignore descriptions; project/preview correctness cannot depend on compliance.
Build inference Only first-run, projectless, imperative web/mobile prompts Classify every website mention Avoids creating projects for informational questions or existing-project follow-ups.
Projectless cwd /tmp Shared /workspace root Environment probes stay ephemeral and cannot create unindexed durable files.
Workspace paths Remap virtual paths into the canonical project Reject common /workspace/* inputs Keeps models compatible while preventing sibling-project writes.

Edge Cases Handled

Scenario Handling
DeepSeek writes an absolute /workspace/* path in argv or inline code The path binds and remaps to the active project.
A throwaway calculation uses no project path It runs in /tmp without creating a project.
A model requests a familiar preview port Workspace remapping happens before stable port remapping.
A project already exists or the run is a follow-up No inferred builder bootstrap occurs.
UI explicitly selected app-builder mode Explicit mode remains authoritative.

How to Review

  1. Start with agent-run-path.ts for the high-confidence first-run builder routing.
  2. Review workspace-paths.ts and the code-tool adapters for confinement/remapping.
  3. Review runs.ts for persisted resolved project mode.
  4. Skim README updates for the documented runtime contract.

Test Plan

  • Full monorepo typecheck, including scripts
  • Full monorepo lint
  • Forced production build for all 19 packages and Worker dry-runs
  • Dependency architecture check
  • Dead-code check
  • Production DeepSeek first-run build after merge/deploy
  • Confirm Files and Browser both open the materialized project and managed preview

Route high-confidence first-run app builds through the managed builder.
Confine virtual workspace paths to the canonical project and keep projectless
probes ephemeral so weaker models cannot produce blank Computer panels.
@iamjr15
iamjr15 merged commit f2eefaa into main Aug 3, 2026
4 checks passed
@iamjr15
iamjr15 deleted the fix/projectless-build-preview branch August 3, 2026 10:42
iamjr15 added a commit that referenced this pull request Aug 3, 2026
## What changed
- route high-confidence imperative website and mobile-app prompts into
the managed builder whenever the chat has no project
- stop treating `isFirstRun` as the first run of a chat; it represents
the user account’s first-ever agent run
- keep explicit project modes and existing-project follow-ups
authoritative

## Why
Production DeepSeek V4 QA after PR #120 exposed the semantic mismatch:
workspace confinement worked, but a returning user’s new projectless
build chat remained in general mode and could still omit the managed
preview.

## Verification
- `pnpm typecheck`
- `pnpm turbo lint`
- `pnpm turbo build --force`
- architecture checks: 847 modules / 1,753 dependencies, zero violations
- dead-code check: exit 0 (four existing configuration hints only)

After merge and Cloudflare deployment, this will be re-tested through
the production UI with DeepSeek V4.
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.

1 participant