Skip to content

fix: harden generation, workspace, and preview continuity - #425

Merged
hqhq1025 merged 22 commits into
mainfrom
hqhq1025-local-startup-fixes
Sep 17, 2026
Merged

hqhq1025 merged 22 commits into
mainfrom
hqhq1025-local-startup-fixes

Conversation

@hqhq1025

@hqhq1025 hqhq1025 commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Settle cancellation before releasing generation/workspace ownership; cancel pending questions and queued publications, forward tool signals, and enforce the three-check repair ceiling with native pi lifecycle guards.
  • Serialize participating workspace writers, preserve actionable source conflicts, respect inherited disabled controls, and retain encoded asset URLs in standalone/ZIP exports.
  • Separate submitted context from new drafts, order chat snapshots at actual read dispatch, and prevent late file imports from answering a different question or session.
  • Apply comments only when their immutable submitted content still matches. Preserve revised comments across completion/ACK races and persist pending/null state through JSONL reopen; the legacy explicit marking API stays compatible.
  • Preserve tweak input focus through guarded autosaves and retain React component identity for render-time token reads. Computed/memoized compatibility cases update correctly with a localized, nonfatal state-reset notice.
  • Serve the real tweak browser fixture from a temporary production build using public Vite build/preview APIs, removing dev-optimizer 504 races without retries, timeout increases, skipped cases, or product changes.

Validation

  • Final normal pre-push lint, workspace typechecks, and all 10 package test tasks passed at f048ed5; desktop: 1,818 passed, 1 intentionally skipped.
  • The final static tweak fixture and concurrent prompt fixture passed all 54 cases (36 + 18) locally. Linux/Node 22 CI 35263365774 passed lint, typechecks, tests, and the production bundle build. CodeQL and Dependency Review also passed.
  • Production main/preload/renderer builds passed in isolated output; the running user application was not overwritten.
  • Native pi tests cover actual editor writes, preview/done/revision orchestration, recovery, cancellation, queue boundaries, and repair limits. Browser executor substitution is explicitly distinguished from real browser tests.
  • Actual system-Chrome and Electron checks cover local assets, forms, extracted HTML/JSX ZIP output, guarded saves, full text/hex editing, watcher settlement, and preserved counter/input/module/effect state. The final Electron product main-chain fixture passed 19 checks.
  • Real Electron preload/host checks verified mixed comment-CAS results and pending/null persistence after a complete main-process restart, not merely a renderer reload.
  • All three original independent reviewers cleared their assigned findings, including the second-pass question ownership, read ordering, edited-comment/CAS, and cached-hook variants. No remaining verified findings in that bounded review; no additional design-model submissions were made.

Compatibility checklist

  • 🟢 Compatibility: preserve explicit unconditional replacements and legacy tweak refresh behavior; no claim of atomicity against uncooperative external writers or revocable in-flight OS writes. Compatibility replay may reset artifact state, with an explicit notice.
  • 🟢 Upgradeability: additive versioned ask-cancellation and conditional comment-marking contracts, Changesets, and no new persistent-state migration.
  • 🟢 Lean: no new shipped dependency or bundled model/browser runtime.
  • 🟢 Elegance: reuse native pi execution boundaries, one canonical writer boundary, stable component identities, and bounded in-flight reconciliation rather than parallel execution/state systems.

The latest main changes from #424 are included without rewriting upstream history. Existing dependency alerts and unrelated generated-artifact quality limitations are outside this bounded fix set.

hqhq1025 and others added 15 commits September 18, 2026 01:00
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Serialize participating writers by canonical file path across designs. Reject stale agent edits and refresh their view for explicit retry while retaining rename leases and external conflict checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exercise seeded HTML and JSX through real browser preview, shared-workspace conditional save conflicts, and standalone HTML plus extracted ZIP rendering with network requests blocked.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve CSS and JSX syntax when decoded asset filenames contain spaces, quotes, or parentheses. Validate extracted HTML and JSX ZIP assets in an offline system browser.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Centralize native :disabled actionability checks and preserve first-legend, inert, and ARIA semantics. Cover fieldset controls with system-browser regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep source conflicts distinct from storage failures so actual text-editor view/retry recovers in the same generation. Accept an optional generation signal and check it before queued publication; callers wire the signal separately. Cover intentional unconditional replacements and cancellation barriers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Forward the tool signal into scaffold copying and recheck after acquiring the canonical writer and immediately before writeFile. Hold queued operations until settlement without claiming to revoke in-flight OS writes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep source-bound inferred controls stable and validate colors with the browser. Serialize and coalesce debounced writes without erasing newer drafts, stale ACK publication, or weakening source guards.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retain generation ownership through cleanup, cancel clarification and preview waits, guard prompt and recovery admissions, and enforce native ask ordering and the three-round done repair cap. Add installed-pi lifecycle and main-chain regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replay the existing React root element for render-time token reads instead of redefining components on each update. Keep conservative legacy replay for module-scope token snapshots, static roots, and memoized components with a nonfatal, source-guarded compatibility notice.

Cover the production WorkspaceFilePreview boundary, guarded disk saves and watcher echoes, native Electron IPC state retention, and legacy compatibility examples.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Map validated compatibility notices to the app locale in English, Chinese, Spanish, and Brazilian Portuguese without changing the runtime protocol or nonfatal semantics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added docs Documentation area:desktop apps/desktop (Electron shell, renderer) area:core packages/core (generation orchestration) area:exporters packages/exporters (PDF/PPTX/ZIP) labels Sep 17, 2026
hqhq1025 and others added 7 commits September 18, 2026 02:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Conservatively use existing compatibility replay when useMemo or useCallback executes, including closures that capture tokens before entering the hook. Preserve the ordinary useState/useEffect render-time fast path and localized nonfatal notice.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Scan the middleware fixture's real entry and use a per-suite cold optimizer cache instead of sharing Vite output with concurrent fixtures. Report startup page, console, request, and HTTP failures without increasing timeouts or retrying navigation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace development dependency optimization with an awaited Vite build and static preview. Assert nonempty entry/CSS artifacts before serving and retain startup network diagnostics and production behavior coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@hqhq1025
hqhq1025 marked this pull request as ready for review September 17, 2026 19:16
@hqhq1025

Copy link
Copy Markdown
Collaborator Author

Final required CI is green (35263365774), including Linux/Node 22 tests and production bundle build; CodeQL and Dependency Review passed. All three independent adversarial reviewers cleared their assigned original and second-pass repros. The additional ready-for-review DeepSeek workflow (35263880571) failed after three responses with empty final message content and posted no review; this is not being counted as a successful review. No check bypass or workflow change is being used. The repository only permits squash merges, so the validated candidate will be published using that normal merge mode.

@hqhq1025
hqhq1025 merged commit 729e356 into main Sep 17, 2026
6 of 7 checks passed
@hqhq1025
hqhq1025 deleted the hqhq1025-local-startup-fixes branch September 17, 2026 19:19
Sun-sunshine06 added a commit that referenced this pull request Sep 19, 2026
## Summary

Make generation and question workflows survive renderer refreshes,
window switches, and temporary detachment without introducing a new
database. The main process now owns durable run/question state, chat
projection, and completion snapshots; the renderer reattaches using
ordered replay and preserves unanswered form drafts.

### Changes
- Persist `runId`/`generationId`, monotonic event sequences, schema
version, and explicit `run_settled` outcomes in per-run JSONL journals.
Commit events before broadcasting; validate cursors and fail closed on
committed corruption while repairing incomplete tails.
- Subscribe before replay, buffer overlapping live events, deduplicate
cursors, recover gaps, and catch up on focus/visibility changes. Support
multiple renderer subscribers without replay-triggered tool execution,
auto-polish, or stale workspace overwrites.
- Persist questions, answers, cancellation/interruption, and
acknowledgement state in `ask-journal.jsonl`. Scope queues and drafts to
the owning request/design; retain input on failed persistence, accept
identical answer retries, and reject conflicting retries.
- Project chat/tool/active-message events idempotently. Committed
delivery and tool results outrank inferred terminal fallbacks; repaired
rows refresh even when replay contains only already-consumed cursors.
- Finalize artifact snapshots in the main process so detached completion
does not depend on the original renderer Promise. Reattached renderers
refresh the latest snapshot without recreating it.
- Preserve the upstream native cancellation and import-ownership
protections; keep generation/workspace ownership until the worker
actually settles, and reject duplicate run IDs.

## Type of change
- [x] Bug fix
- [x] New feature
- [ ] Breaking change

## Context

Follow-up to the continuity work in #425, rebased onto `main` including
the v0.2.2 release updates. This PR contains only the recovery
implementation, regression tests, and a desktop patch changeset.

Behavioral reference: [Open Design run identity, JSONL events, replay,
and restart
handling](https://github.com/nexu-io/open-design/blob/f5707c8cae7b61014c5e91e114b9aa07826df725/apps/daemon/src/runtimes/runs.ts).
Retains CoDesign's existing file/JSONL and session-chat approach rather
than importing the separate logical-task database architecture.

## Recovery contract and limits
- Renderer refresh/detachment can reattach to a still-running
main-process run and pending questions.
- A main-process restart preserves history and marks orphaned
runs/questions **interrupted**. It does **not** resurrect provider
Promises or automatically repeat tools/side effects.
- Question answers are acknowledged only after persistence. Invalid
submissions leave the question available for correction; losing a window
no longer cancels the question by itself.
- Additive IPC fields and versioned journals; no SQLite, new production
dependencies, or retention/deletion policy.
- Very large histories may need future replay pagination and writer
backpressure.

## Validation

Executed locally on Windows with Node 22 and repository-pinned pnpm:
- `pnpm lint` — passed (617 files).
- `pnpm typecheck` — passed for the workspace.
- `pnpm test` — passed for the workspace; desktop **152 test files, 1937
passed / 1 skipped**. Unchanged workspace packages used valid Turbo
cache entries.
- `pnpm --filter @open-codesign/desktop build` — main, preload, and
renderer bundles passed.
- `git diff --check` — passed. Repository commit/push hooks also passed.

Regression coverage includes temporary-filesystem
reopen/torn-write/corruption cases, failed durable answers,
identical/conflicting retries, native cancellation ownership,
replay/live overlap and gaps, multiple subscribers, headless completion
and snapshot persistence, repaired chat authority, stale status
responses, design-scoped drafts, and cancellation/import races.

No paid/live-provider manual Electron reload acceptance run was
performed. No visual redesign or screenshot recording is included;
renderer recovery and import behavior are covered by component tests.

## Checklist
- [x] Checked relevant continuity context and upstream implementation
- [x] `pnpm lint && pnpm typecheck && pnpm test` passes locally
- [x] Added/updated regression tests
- [x] Added a user-visible desktop patch changeset
- [x] Documented recovery boundaries above
- [x] Additive protocol, schema-versioned storage, explicit main-process
ownership
- [x] No new production dependencies or database layer

Signed-off-by: Sun-sunshine06 <Sun-sunshine06@users.noreply.github.com>
Co-authored-by: Sun-sunshine06 <Sun-sunshine06@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core packages/core (generation orchestration) area:desktop apps/desktop (Electron shell, renderer) area:exporters packages/exporters (PDF/PPTX/ZIP) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant