Skip to content

Feat/consolidated improvements - #9

Merged
patil-shubham-dev merged 8 commits into
mainfrom
feat/consolidated-improvements
Jul 20, 2026
Merged

Feat/consolidated improvements#9
patil-shubham-dev merged 8 commits into
mainfrom
feat/consolidated-improvements

Conversation

@patil-shubham-dev

Copy link
Copy Markdown
Owner

No description provided.

Root cause: WordBoundaryStreamBuffer only flushes when its internal buffer
ends on a word-boundary regex ([\s\n\r.!?;:)]$). clearStep() discards the
buffer without any flush. Every termination path — MESSAGE_COMPLETE,
EXECUTION_FAILED, GOAL_ACHIEVED, force-complete, cancel, and the autonomous
pass-through — called clearStep() or clearAll() instead of complete(), so
any trailing word that never hit a word boundary (single-word responses,
numeric output, truncated mid-word tokens) was silently lost.

Fix (7 edit sites across 2 files):
- ExecutionSessionManager.ts: replace clearStep() with complete()
  (flush + dispatch + clear) in all 6 termination paths. Fix inverted
  ordering at MESSAGE_COMPLETE and EXECUTION_FAILED (flush before
  commitStreamingText). Add flushImmediate() before clearAll() in cancel.
- AutonomousExecutionPath.ts: add flushImmediate() before yielding
  MESSAGE_COMPLETE (autonomous path bypassed the executor's handler).

Verification:
- 14-unit synthetic suite (StreamingTextRaceCondition.test.ts): 40
  iterations across all 3 paths with randomized async token delivery.
- 36/36 real Nvidia NIM SSE streams (RealProviderStreaming.verify.test.ts):
  all 3 paths live-verified against actual provider. Single-word no-boundary
  responses (Hi, 42, Hello): 9/9. EXECUTION_FAILED (transport drop): 3/3.
  Cancel mid-stream: 3/3. Regression (multi-sentence): 3/3. Zero dropped
  words.

Pre-existing failures (unrelated, confirmed on main before this change):
- tests/unit/reliability/execution-harden.test.ts: 'should fail with
  EXECUTION_FAILED when no providers configured'
- tests/unit/reliability/execution-harden.test.ts: 'should fail with
  EXECUTION_FAILED when runtime is initializing'
Deleted 6 orphaned shadcn/ui component files from packages/ui/src/ that
were not exported from the barrel index.ts and had zero external consumers:
tabs.tsx, skeleton.tsx, select.tsx, scroll-area.tsx, dropdown-menu.tsx,
command.tsx — these were either superseded by equivalent inline patterns
or never wired up.

Removed 4 unused CanonicalEvent types from canonical-events.ts:
diff_ready, verification_started, approval_requested, session_cancelled
— along with their interfaces and union members. These events were
defined but never emitted or consumed anywhere in the codebase.

Removed 5 unused ExecutionEvent types from ExecutionEvent.ts:
PLAN_UPDATED, FILE_READ, FILE_WRITE, FALLBACK_ACTIVATED, BROWSER_SCROLL
— along with their interfaces and union members. Dead since the
execution model was flattened to linear tool invocation.
…, URL dedup

Silent catch blocks (18 total across 7 files):
- http-client.ts (2): console.warn on fetch failures
- provider-gateway.ts (6): console.warn on URL parse errors, console.debug
  on runtime detection failure
- provider-registry.ts (2): console.warn on URL parse errors
- capability-probe.ts (3): console.warn on probe failures, console.debug
  on unparseable SSE chunks; fix normalizeProbeUrl /v1/v1 dedup
- streaming-transport.ts (3): console.debug on transport-level errors
- VerificationPipeline.ts (2): console.warn on detectLanguage failure,
  console.debug on TestIntelligence fallback
- FailurePatternMemory.ts (2): console.error on disk load/save failures

Unbounded caches:
- provider-gateway.ts: MAX_CACHED_HEALTH=200 with LRU eviction
- provider-health.ts: MAX_HEALTH_RECORDS=200 with LRU eviction
- FailurePatternMemory.ts: MAX_PATTERNS=500, sort-and-trim-oldest-20%

ContextManager session isolation:
- assembleSystemPrompt() accepts optional session: ContextSession
- Uses session-scoped model, betas, budgetTracker, fileScorer, fileCache
  when provided, falls back to singleton state otherwise
- Added estimateAvailableContextFor() helper
- Backward compatible — existing callers pass no session

normalizeProbeUrl dedup:
- Added guard strips duplicate /v1/v1 suffix, mirrors normalizeChatUrl
  logic without introducing circular dependency
…ard redesign, AgentSignal

CSS design tokens (index.css):
- Added component-scoped utility classes: .empty-state-icon,
  .empty-state-action, .shortcut-kbd, .thinking-card-pulse
- Added semantic text color classes and .bg-accent-green
- Added --color-ai restrained violet (#A78BFA) for thinking/agent states
- Added --radius-{sm,md,lg} and --focus-ring tokens for unified focus
- Tightened motion timing defaults (fast 120ms, normal 180ms)
- Refined typography opacity hierarchy and border opacities across themes
- Normalized focus-visible ring to use box-shadow with --focus-ring

EmptyState.tsx:
- Refactored from inline style objects to CSS class references
- Removed unused Command import

ThinkingCard.tsx:
- Replaced 372-line step-timeline layout with 190-line compact card
- Removed framer-motion-dependent step progress, replaced with CSS
  thinking-card-pulse animation
- Added AgentSignal animated motif (three staggered ripple circles)
- Added live step title, token count display, reduced-motion support
- Auto-collapses on completion, expandable for reasoning detail

chat-animations.ts:
- Added CARD animation presets (mount, chevronHover, reasoningReveal,
  iconExplode) with framer-motion Transition type annotations

PanelIcons.tsx:
- Added AgentSignal component using CSS ping animation with
  prefers-reduced-motion guard
Previously appendStreamingText called zustand set() on every individual
token arrival, causing O(n) React re-renders per frame for high-throughput
streaming responses (~100+ tokens/sec).

Added module-level batch queue (_batchQueue: Map<string, string>) with
rAF scheduler (_scheduleBatch / _flushBatchSync). appendStreamingText now
appends to the buffer and schedules a single set() per animation frame
instead of per-token. commitStreamingText calls _flushBatchSync() first
to ensure all buffered text is committed before finalizing.

Maintains existing 200-entry cap, token metrics (tokensReceived,
tokensPerSecond, firstTokenLatency), and endsWith duplication guard.
Handles polyfilled rAF for test environments (falls back to setTimeout).
All 14 StreamingTextRaceCondition tests and ExecutionSessionManager
tests pass.
…oundaries

path-utils.ts (main process):
- Replaced naive .startsWith() path containment with isPathInsideDirectory()
  using resolved+normalized paths and platform-aware comparison — fixes
  false containment matches (e.g. /home/user/foo matching /home/user/foobar)
- Added toPortablePath() to normalize backslash paths for pattern matching
- Added nested file pattern support (.aws/credentials) to sensitive list
- Fixed directory pattern matching for cross-platform path separators

PathVisibilityFilter.ts:
- Added 25 built-in SENSITIVE_PATH_PATTERNS covering .env, .ssh/*, .pem
  keys, credentials, secrets, tokens, service-accounts, vault, .npmrc
- setDeniedPaths() now merges user-configured with built-in defaults
- Added isPathDeniedSilent() returning human-readable denial message
- Boots with sensitive paths pre-populated (default-deny approach)

RoleRegistry.ts (deleted):
- Removed unused module with no remaining consumers

PanelBoundaries.tsx:
- Added EditorBoundary, BrowserBoundary, TerminalBoundary, AgentBoundary
  component-scoped error boundaries for granular crash isolation

main/index.ts:
- Relaxed CSP script-src in dev mode for Vite HMR and React DevTools
Context system:
- Compactor: Improved multi-model context window compaction algorithm
- TokenBudgetManager: Refined budget allocation and enforcement across
  nested agent calls
- TokenBudgetTracker: Enhanced tracking accuracy for concurrent sessions
- ContextSession: Extended session data model for isolated context windows
- microCompact: New lightweight single-block compaction utility for
  targeted trimming without full pipeline re-run
- ExecutionBudgetManager: Aligned budget tracking with TokenBudgetManager
  for consistent enforcement

Execution engine:
- AgentExecutor: Streamlined tool execution decision flow, reduced branching
- AgentPipelineOrchestrator: Simplified orchestration for linear pipelines
- AutonomousExecutionPath: Enhanced self-healing path selection
- FastPathExecutor: Optimized direct-execution for known-pattern tools
- MockExecutionEngine: Updated for testing parity with production paths
- RepairExecutor: Improved repair strategy selection and metrics
- UnifiedExecutionGateway: Consolidated execution route dispatch
- UnifiedExecutor: Flattened execution indirection for single-call patterns
- ProviderGateway: Updated adapter dispatch for runtime detection

Streaming:
- StreamManager: Improved backpressure handling and event coalescing
- WordBoundaryStreamBuffer: Enhanced word-boundary detection for mixed
  token streams

ExecutionSessionManager:
- Session lifecycle refinements for sub-agent delegation

Tool pipeline:
- ToolPermissions: Consolidated permission check routing
- ToolExecutionPipeline: Enhanced execution policy enforcement with
  pre/post hooks
- compactPostHook: Added post-compaction side-effect hooks
- DelegateTool, ReadFileTool: Updated signatures for new execution model
- BatchParallelTaskTool: Worktree-aware parallel batch execution
- ToolExecutionPolicy: Refined policy evaluation ordering
- sub-agent-delegator: Enhanced lifecycle management for nested agents
…pty state, settings tab, tool scripts

ConversationTimeline.tsx:
- Replaced naive scroll-to-bottom with @tanstack/react-virtual virtualizer
  for O(1) rendering of large conversation histories
- Extracted TurnSeparator and TurnContent memoized sub-components
- Uses scrollToIndex for auto-scroll on new turns

chat-panel.tsx:
- Added useShallow for optimized zustand selector subscriptions
- Fixed canSend guard to dynamically check provider state

code-canvas.tsx (workspace management):
- Replaced PremiumGeometricEmptyState with WorkspaceEmptyState component
- Added recent workspaces list with addRecentWorkspace/getRecentWorkspaces
- Added openWorkspacePath helper for unified open flow
- Removed debug console.log calls from hot paths
- Added auto-collapse workspace panel on narrow screens (<700px)

settings.tsx (inline completions):
- Added Completions settings tab (Zap icon) with shortcut '6'
- Renumbered existing shortcuts to accommodate new tab

GitHub integration:
- github-client.ts: Extended API client with new endpoint wrappers
- github-tools.ts: Updated tool implementations for PR review workflow
- github/index.ts: Updated barrel exports

SkillLoader.ts:
- Added bundled PR review skill at pr-review.skill.ts

navigation-rail.tsx:
- Tightened collapsed width from 52px to 44px, expanded from 220px to 200px

shared/types.ts:
- Extended canonical types for new feature support

eslint.config.js:
- Updated ESLint configuration for new file patterns

package.json:
- Added lint:renderer, lint:main, lint:packages, lint:changed scripts
- Added test:unit, test:stress, test:provider, test:benchmark split scripts
- Added monaco-editor override for dompurify CVE
- Bumped node memory for lint operations

browser-manager.ts, viewport-manager.ts:
- Enhanced browser session management and viewport handling
@patil-shubham-dev
patil-shubham-dev merged commit d108ca6 into main Jul 20, 2026
2 of 4 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.

1 participant