Skip to content

Upstream Sync Attempt (v0.10.3)#27

Closed
bizzkoot wants to merge 272 commits intomainfrom
restore_v0.9.2-patch.4
Closed

Upstream Sync Attempt (v0.10.3)#27
bizzkoot wants to merge 272 commits intomainfrom
restore_v0.9.2-patch.4

Conversation

@bizzkoot
Copy link
Owner

Pull Request: Upstream Sync Attempt (v0.10.3)

Branch: restore_v0.9.2-patch.4origin/main
Date: 2026-02-14
Status: Partial Merge - Infrastructure Preserved, UI Components Reverted


Summary

Attempted to sync fork with upstream/dev (v0.10.3). While server/API changes merged successfully, UI component integration caused "Starting instance..." hangs and had to be reverted to maintain stability.

Result: Infrastructure preserved for future custom implementation, app remains stable.


What We Attempted to Merge

From upstream/dev (v0.10.3 line):

Server/API LayerMERGED SUCCESSFULLY

  • New API endpoint for fetching file original content
  • API client method for Monaco diff preparation
  • Git store safety improvements
  • Platform enhancements (keep-awake, dev startup fixes)

UI ComponentsREVERTED DUE TO HANGS

  • Monaco-powered diff viewer in SourceControlPanel
  • Worktree file browser section
  • Session changes section
  • Source Control panel reorganization

Current State (After Reverts)

✅ Preserved & Working

Feature Location Status
Git file-original endpoint packages/server/src/server/routes/git.ts ✅ Active
fetchGitOriginalContent() API packages/ui/src/lib/api-client.ts ✅ Available
Git store safety fix packages/ui/src/stores/git.ts ✅ Active
Permission null checks packages/ui/src/components/tool-call/ ✅ Active
Power save blocker Electron main process ✅ Active
Dev startup fixes Electron main/process-manager ✅ Active
Source Control Panel Original fork version ✅ Stable

⏸️ Available for Custom Implementation

The server infrastructure exists but UI was reverted:

Feature Infrastructure UI Status Path Forward
Monaco diff viewer ✅ API ready ❌ Reverted Add to existing diff modal
Worktree file browser ✅ API ready ❌ Reverted Add to RightPanel Files tab
Session changes ✅ API ready ❌ Reverted Add to RightPanel Changes tab

Why UI Components Were Reverted

Root Cause

Upstream's source-control-panel.tsx uses reactive patterns incompatible with fork's initialization:

  • createEffect hooks tracking instances() store
  • Monaco editor loading during component mount
  • Worktree client initialization on render

Impact

When instance is created, these effects fire and block the UI thread, causing perpetual "Starting instance..." state.

Solution Applied

Reverted to original fork's source-control-panel.tsx which:

  • Has no reactive store dependencies
  • Uses text-based diff (lighter)
  • Loads data only on user interaction
  • Has proven stability

Fork-Specific Features (Unchanged)

These remain intact and functional:

AI-Powered Source Control

  • AI commit message generation (f0fc595)
  • Improved commit input UX (5aa5489)
  • Enhanced commit generation flow (e2208f2)
  • Commit message editor improvements (f7e4601)
  • Push state and staging fixes (1dd1dce)

Core Fork Behavior

  • ask_user MCP server + IPC bridge
  • ✅ Fork-specific prompt/tool-call handling
  • ✅ Custom notification/search behavior

Technical Details

Files Modified

packages/server/src/server/routes/git.ts          (+50 lines) - New endpoint
packages/ui/src/lib/api-client.ts                 (+9 lines)  - New API method
packages/ui/src/stores/git.ts                     (+1 line)   - Safety fix
packages/ui/src/components/tool-call/
  permission-block.tsx                            (+1 line)   - Null check
  question-block.tsx                              (+1 line)   - Null check

Files Reverted

packages/ui/src/components/source-control/source-control-panel.tsx
  → Reverted to original fork version (914 lines)

Validation

  • npm run lint — no errors (warnings only)
  • npm run typecheck — all packages pass
  • npm run dev — App starts, no "Starting instance..." hang
  • ✅ Instance creation — Works reliably
  • ✅ Source Control — Functional with text-based diff

Migration Strategy

For future feature additions:

  1. Use preserved infrastructure — API endpoints and client methods are ready
  2. Implement UI differently — Don't copy upstream's reactive patterns
  3. Lazy load heavy components — Load Monaco only when diff viewer opens
  4. Avoid createEffect on stores — Use user interaction to trigger data loading
  5. Test instance creation — Always verify "Starting instance..." completes

Checklist

  • Server/API changes merged
  • UI components reverted (hangs resolved)
  • Fork-specific features preserved
  • Typecheck passed
  • Dev startup working
  • Version aligned to v0.10.3
  • Documentation updated

References

  • Last successful upstream merge: 444335ad99276922831ba7308de2c7f3b2fcb1e2
  • Upstream version attempted: v0.10.3
  • Issue encountered: UI hangs during instance creation
  • Resolution: Revert UI changes, preserve infrastructure

bizzkoot and others added 30 commits January 11, 2026 22:44
… gradient tooltip

- Add expand button with Maximize2/Minimize2 icons
- Implement 3-state height management (normal/50%/80%)
- Smart double-click detection with 300ms delay
- Height calculation based on session-view - 200px message space
- Custom CSS tooltip with dark gradient background and backdrop blur
- Send button anchored at bottom via margin-top: auto
- Smooth CSS transitions throughout
- Double-click at 80% now reduces to 50% (not normal)
- Removed all debug console.log statements
feat: Implement expandable chat input with double-click detection and gradient tooltip
…ization

- Add platform detection (Electron vs Web) for expand behavior
  - Electron: 3-state (normal → 50% → 80%) with double-click
  - Web/Mobile: 2-state (normal → expanded) with instant single tap
- Implement fixed 15-line height for web/mobile (360px, capped)
- Add orientation-aware height calculation (landscape vs portrait)
- Remove tooltip on web/mobile, keep for Electron desktop
- Add responsive placeholder text to prevent overlap on mobile
  - Desktop: "Type your message, @file, @agent, or paste images and text..."
  - Mobile (≤640px): "Type message, @file, @agent..."
- Delete dev-docs/expand-chat-input.md per upstream feedback

Addresses PR feedback to simplify from 3-state to 2-state for web/mobile
while maintaining rich desktop experience in Electron app.
- Fixed keyboard navigation (↑↓) not auto-scrolling to keep highlighted option visible
- Replaced unreliable refs array with querySelector using data-option-selected attribute
- Added createEffect for auto-scroll when switching tabs
- Matches proven pattern from unified-picker.tsx
- Updated AGENTS.md with communication requirements
- Minor package.json update
- Implement QuestionNotificationBanner to show pending question count
- Add minimize button to AskQuestionWizard header
- Integrate minimize state management in instance-shell2
- Update auto-open logic to respect user minimize choice while preserving subagent workflow
- Add responsive styles for new wizard header buttons
…pport

Feat/question panel multiline support
…h results

- Add section-expansion.ts module with event system for triggering expansion
- Expand reasoning blocks, tool outputs, sidebar accordions, folder nodes on navigation
- Add event listeners to ReasoningCard, ToolCall, InstanceShell2, FolderTreeNode
- Integrate expansion logic into scrollToCurrentMatch() in search-store.ts
- Wait for DOM updates after expansion before scrolling

Components now respond to search navigation by auto-expanding
collapsed sections containing search matches.

Closes: Search expansion implementation
- Remove console.warn() calls that were showing 'Match element not found'
- These warnings are expected when elements haven't rendered yet
- Expansion still works via metadata-based triggers

Silent search navigation
- Replace DOM element lookups with message anchor positions
- Finds anchor closest to viewport center
- Then finds first match in that message
- Works even before DOM highlighting is applied

This should fix the issue where search always went to top
- Add 400ms debounce timer to auto-search after typing stops
- Clear old search results immediately when query changes
- This fixes the issue where old highlights remained when user selects-all and types new text
- Use reactive state management (clearing matches) instead of DOM manipulation
- Add timer cleanup in closeSearch and executeSearchOnEnter to prevent memory leaks
- Update search panel to pass store parameter to setQueryInput

Replaces the previous approach of manually clearing DOM highlights which
didn't work due to SolidJS reactive re-rendering.
shantur and others added 28 commits February 12, 2026 23:53
Publish bleeding-edge builds from dev to GitHub prereleases and npm dist-tag 'dev'. Dev builds poll GitHub prereleases and surface update availability via /api/meta for UI notifications.
Expose NPM_TOKEN as an optional workflow_call secret so step conditionals can reference secrets.NPM_TOKEN.
Remove secrets-based step conditionals in reusable npm publish workflow; decide token vs OIDC at runtime.
Switch dev builds to use -dev-YYYYMMDD-sha8 suffix and update version parsing + dev detection accordingly.
Switch dev workflow to publish the server under @neuralnomads/codenomad-dev with dist-tag latest, avoiding @dev dist-tags. Add workflow input to override package name at publish time.
…ssue-159

fix(ui): keep prompt attachments in sync
…ssue-166

fix(ui): hide keyboard hints on phone layout
- Fix push button remaining active after successful push by fetching
  updated status after 2-second delay to allow remote to complete
- Fix "Stage All" in Changes section incorrectly staging untracked files
- Add separate "Stage All" button to Untracked section for bulk staging
- Fix unused 'index' parameter TypeScript warning in renderDiffLine
- Update @opencode-ai/plugin to v1.1.53.
- Implement AI-powered commit message generation from staged diffs.
- Add a Sparkles button to the source control panel UI.
- Handle temporary AI sessions and message polling for generation.
- Add a clear button to reset the commit message textarea
- Implement Cmd/Ctrl + A shortcut for selecting all text
- Adjust minimum height based on message presence
- Reorganize action buttons into a vertical stack layout
- implement auto-resizing for the source control textarea
- add stabilization delay for robust ai response extraction
- enhance text parsing to handle streaming and nested content
- strip markdown formatting from generated commit messages
- bump workspace versions to 0.9.5-patch.1
Fixes critical crash that occurred when quitting the CodeNomad Electron app.
The error "TypeError: Object has been destroyed" was thrown during shutdown
when event handlers attempted to send messages to already-destroyed webContents.

Root causes addressed:

1. MCP Bridge IPC (packages/mcp-server/src/bridge/ipc.ts):
   - 'closed' event handler was calling webContents.send() after window close
   - setTimeout callbacks could fire after shutdown began
   - IPC handlers lacked proper destruction checks

   Solution:
   - Added safeSendToRenderer() with isShuttingDown flag
   - Fixed 'closed' handler to only cleanup, never send messages
   - Replaced all direct webContents.send() calls with safe wrapper
   - Added shutdownBridge() export for controlled shutdown

2. Storage Config Handler (packages/electron-app/electron/main/storage.ts):
   - webContents property accessed before checking isDestroyed()
   - Duplicate before-quit handler causing race conditions

   Solution:
   - Added try-catch with proper isDestroyed() checks
   - Check window.isDestroyed() BEFORE accessing webContents
   - Removed duplicate before-quit handler

3. Main Process Shutdown (packages/electron-app/electron/main/main.ts):
   - Event listeners could fire during async cleanup after mainWindow=null
   - No coordination between components during shutdown sequence

   Solution:
   - Call shutdownBridge() before nulling mainWindow
   - Added shutdown guards to cliManager event listeners
   - Improved before-quit handler ordering

Shutdown sequence (new order):
1. shutdownBridge() → isShuttingDown = true (stops all MCP sends)
2. Store window reference for cleanup
3. mainWindow = null (prevents new event processing)
4. Async cleanup (MCP server stop, CLI stop)
5. Clean window close

Verified fixes:
- No crash on normal quit (Cmd+Q)
- No crash during force quit
- No crash on window close button
- No crash with pending operations
- All webContents.send() calls now safely handle destruction

Files modified:
- packages/mcp-server/src/bridge/ipc.ts (+55, -15)
- packages/electron-app/electron/main/storage.ts (+15, -8)
- packages/electron-app/electron/main/main.ts (+14, -2)

Total: +84 lines added, -25 lines removed

Related to: Previous crash fix attempt that only added safeSend() helpers
but didn't address the root cause in the MCP bridge.
- Cherry-picked 5 commits from origin/dev:
  - fix(ui): source control push state and stage behavior
  - feat(ui): AI commit message generation
  - feat(ui): improve commit input and actions
  - feat(ui): improve commit generation and ux
  - fix(electron): prevent 'Object has been destroyed' crash on app exit

- Fixed mcp-server package.json exports (main: dist/index.js, types: dist/index.d.ts)
- All packages typecheck successfully
- Version bumped to 0.9.2-patch.5
This commit resolves all 71 ESLint warnings reported by the linter:

**Unused variables (65 warnings):**
- Prefix unused variables with underscore (_) per ESLint rules
- Remove unused imports and type annotations
- Clean up empty catch blocks with unused error parameters

**innerHTML warnings (6 warnings):**
- Add eslint-disable-next-line comments with proper justification for:
  - Markdown content (pre-sanitized by DOMPurify in markdown.ts)
  - ANSI terminal output (rendered by trusted ANSI renderer)
  - Cached diff viewer HTML (from internal diff component)

**Impact:**
- 41 files modified across electron-app and ui packages
- Net code reduction: -9 lines (90 deletions, 81 insertions)
- Lint now passes with 0 errors, 0 warnings

**Files affected:**
- electron-app: storage.ts
- ui components: agent-selector, askquestion-wizard, background-process-output-dialog,
  code-block-inline, diff-viewer, environment-variables-editor, folder-tree-browser,
  folder-tree-node, instance-tab, instance-welcome-view, instance-shell2, keyboard-hint,
  markdown-preview-modal, markdown, message-item, message-part, message-section,
  prompt-input, search-highlighted-text, search-panel, session-picker,
  session/context-usage-panel, tool-call, tool-call/ansi-render,
  tool-call/renderers/todo, tool-call/tool-title, virtual-item
- ui/lib: markdown-file-detector, mcp-bridge, section-expansion
- ui/stores: failed-notifications, message-history, message-v2/instance-store.test,
  message-v2/instance-store, message-v2/session-info, preferences, search-store,
  session-api, session-state
- ui/types: session
- Add clear button to quickly remove commit message content
- Add Cmd/Ctrl+A keyboard shortcut for select all in textarea
- Adjust textarea initial height when message content exists
- Update @opencode-ai/plugin to version 1.2.1
Add syntax highlighting for unified diff format with colored backgrounds
for added/removed/context lines. Detects diff content and applies
appropriate styling in markdown code blocks and tool output.

- Add isDiffContent() and highlightDiff() helpers in lib/ansi.ts
- Modify tool-call.tsx to detect and highlight diff on render
- Apply diff classes to Shiki-highlighted code in markdown.ts
- Add diff-added/diff-removed/diff-context styles for light/dark modes
- Fix Shiki dark mode text color with code-text-primary token
- Update source-control prefix to use dynamic text class
- Add scroll context to code blocks with headers
- Add background color to cover scrolling content
- Remove !important from shiki background override
- Increase z-index on sticky header to properly overlay content
Add powerSaveBlocker integration to prevent system suspension
during long-running CLI operations. Exposes IPC handler for
renderer control.

- Adds power:setWakeLock IPC handler for enable/disable
- Tracks wake lock ID to manage state across invocations
- Cleans up unused variables and imports in UI components
- Removes unnecessary eslint-disable comments
Add server API endpoint and client method for fetching original file
content to support Monaco-powered diff viewers. Includes safety fixes for
null checks and optional chaining.

- Add GET /api/workspaces/:id/git/file-original endpoint that returns
  staged version for unstaged changes, HEAD version for staged changes
- Add fetchGitOriginalContent() API client method for Monaco integration
- Fix null/undefined checks in permission-block and question-block error
  display to prevent false positives with empty string errors
- Add optional chaining in git store for status.changes to prevent crashes
- Update README upstream sync documentation with selective merge strategy
Add comprehensive merge history entry for infrastructure-only merge:
- Server API endpoint preserved (/git/file-original)
- API client method preserved (fetchGitOriginalContent)
- UI components reverted (source-control-panel.tsx)
- Root cause: reactive patterns incompatible with fork
- Validation: no hangs, typechecks pass
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.

3 participants

Comments