Skip to content

Consolidate loop and sandbox patterns with completion signal enhancement#2

Merged
chriswritescode-dev merged 9 commits intomainfrom
refactor/patterns
Apr 6, 2026
Merged

Consolidate loop and sandbox patterns with completion signal enhancement#2
chriswritescode-dev merged 9 commits intomainfrom
refactor/patterns

Conversation

@chriswritescode-dev
Copy link
Copy Markdown
Owner

Summary

  • Rename completionPromise to completionSignal with enhanced regex matching
  • Extract shared sandbox context helpers to reduce duplication
  • Add ESLint configuration with TypeScript and Solid.js rules
  • Improve Docker exec with stdin support and better timeout handling
  • Add utility helpers for duration formatting and model resolution

Changes

  • src/sandbox/context.ts: New shared sandbox context helpers
  • src/utils/loop-helpers.ts: New utility module with common helpers
  • src/services/loop.ts: Enhanced completion signal detection
  • eslint.config.js: ESLint configuration with TypeScript/Solid rules
  • test/loop-helpers.test.ts: Tests for new utility functions
  • Multiple refactoring changes across loop, sandbox, and tool modules

- Add LOOP_PERMISSION_RULESET for consistent permission handling
- Improve sandbox timeout handling with hard deadlines
- Add git common dir detection for worktree mounts
- Remove opencode.jsonc workaround
- Clean up strip-promise-tags utility
- src/index.ts:89: Use config.sandbox?.mode === 'docker' directly instead of
  isSandboxEnabled(config, null) which always returned false since sandboxManager
  was not yet created at init time

- src/services/loop.ts:138-143: Revert checkCompletionSignal to simple
  case-insensitive includes() matching. The <promise> tag wrapping was introduced
  in the refactor but never wired into agent instructions, causing loops to run
  indefinitely

- test/loop.test.ts: Update test cases to use raw signal strings and add
  case-insensitive test

- src/tools/loop.ts: Import DEFAULT_COMPLETION_SIGNAL from services instead of
  duplicating, and use isSandboxEnabled() consistently in restart

- src/tui.tsx:210: Sync inlined completion instructions with canonical version

- src/utils/loop-helpers.ts: Remove unused formatElapsed function

All 329 tests pass. TypeScript and type checking pass.
@chriswritescode-dev chriswritescode-dev merged commit e3185bc into main Apr 6, 2026
2 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