fix(session): prevent orphaned task slots blocking allocation (#33)#35
Merged
fix(session): prevent orphaned task slots blocking allocation (#33)#35
Conversation
This PR implements a major refactor and stability overhaul for the agentic loop. Completed Issues: - Fixes #5: Memory leak in fire-and-forget promises (implemented BackgroundTasks tracking) - Fixes #6: Split oversized prompt.ts (extracted session/tools.ts) - Fixes #7: Add BackgroundTasks test suite - Fixes #8: Fix silent tool failure in background (added result tracking and events) - Fixes #9: Add Stream module unit tests (comprehensive coverage) - Fixes #10: Fix race condition in Remory search (added request tracking) - Fixes #11: Fix unhandled abort during stream cleanup - Fixes #12: Implement check_task tool - Fixes #13: Add config schema validation - Fixes #14: Upgrade Remory to Unix socket (implemented in socket-client.ts) - Fixes #16: Fix code style violations Changes: - Extracted tool resolution logic to `src/session/tools.ts` - Implemented `BackgroundTasks` utility for promise tracking - Added `check_task` tool for polling background tasks - Upgraded Remory client to use Unix sockets and JSON-RPC - Added comprehensive tests for Stream and BackgroundTasks
- Remove upstream publishing workflows (npm, vscode, tauri, etc.) - Change branch references from dev to main - Keep test, typecheck, and issue management workflows
- Add attribution to upstream OpenCode project (MIT requirement) - Document build-from-source installation - Explain philosophy: opinionated defaults, agentic workflows, remory integration - List differences from upstream (no desktop app, VS Code, npm publishing) - Keep it concise and focused on single developer use case
- Convert 21 AI provider imports to dynamic imports - Add null checks in github.ts - Fix task.ts and test type definitions - Enable minification in build - Improve TUI activity streaming
feat: lazy load AI SDKs and fix typecheck errors
- Store release_slot callback in TaskMetadata for lifecycle tracking - Release slot in trackBackgroundTask finally block (handles timeout/crash/abort) - Fix double-release race in task.ts with slotReleased guard - Release slot before metadata deletion in cancelBackgroundTask - Simplify cleanupAllTaskSlots to prevent race with finally blocks - Add comprehensive AGENTS.md aligned with project standards (#34) Closes #33 Closes #34
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
- Use try/catch instead of Promise chaining for Session.get errors - Add sessionID to test context for proper caller identification
Remove inherited upstream workflows. Keep only basic CI for typecheck and tests.
Previously the ci.yml had incorrect working directory placement, causing tests to run from root which exits with error code 1.
randomm
added a commit
that referenced
this pull request
Feb 3, 2026
) * feat: simplify agentic loop and fix critical bugs This PR implements a major refactor and stability overhaul for the agentic loop. Completed Issues: - Fixes #5: Memory leak in fire-and-forget promises (implemented BackgroundTasks tracking) - Fixes #6: Split oversized prompt.ts (extracted session/tools.ts) - Fixes #7: Add BackgroundTasks test suite - Fixes #8: Fix silent tool failure in background (added result tracking and events) - Fixes #9: Add Stream module unit tests (comprehensive coverage) - Fixes #10: Fix race condition in Remory search (added request tracking) - Fixes #11: Fix unhandled abort during stream cleanup - Fixes #12: Implement check_task tool - Fixes #13: Add config schema validation - Fixes #14: Upgrade Remory to Unix socket (implemented in socket-client.ts) - Fixes #16: Fix code style violations Changes: - Extracted tool resolution logic to `src/session/tools.ts` - Implemented `BackgroundTasks` utility for promise tracking - Added `check_task` tool for polling background tasks - Upgraded Remory client to use Unix sockets and JSON-RPC - Added comprehensive tests for Stream and BackgroundTasks * feat: auto-wakeup agent context and build fixes * chore: clean up workflows for independent fork - Remove upstream publishing workflows (npm, vscode, tauri, etc.) - Change branch references from dev to main - Keep test, typecheck, and issue management workflows * docs: replace README with oclite fork documentation - Add attribution to upstream OpenCode project (MIT requirement) - Document build-from-source installation - Explain philosophy: opinionated defaults, agentic workflows, remory integration - List differences from upstream (no desktop app, VS Code, npm publishing) - Keep it concise and focused on single developer use case * docs: add README and release workflow for independent fork - New README with installation, philosophy, attribution - GitHub Actions workflow for building/releasing binaries - Closes #23, closes #24 * feat: lazy load AI SDKs and fix typecheck errors - Convert 21 AI provider imports to dynamic imports - Add null checks in github.ts - Fix task.ts and test type definitions - Enable minification in build - Improve TUI activity streaming * fix: use git toplevel for worktree path (#31) * fix(session): prevent orphaned task slots blocking allocation (#33) - Store release_slot callback in TaskMetadata for lifecycle tracking - Release slot in trackBackgroundTask finally block (handles timeout/crash/abort) - Fix double-release race in task.ts with slotReleased guard - Release slot before metadata deletion in cancelBackgroundTask - Simplify cleanupAllTaskSlots to prevent race with finally blocks - Add comprehensive AGENTS.md aligned with project standards (#34) Closes #33 Closes #34 * fix(tool): correct CheckTask error handling and test context - Use try/catch instead of Promise chaining for Session.get errors - Add sessionID to test context for proper caller identification * chore(ci): simplify workflows to essential test suite only Remove inherited upstream workflows. Keep only basic CI for typecheck and tests. * fix(ci): run tests from packages/opencode directory * fix(ci): run tests from correct directory Previously the ci.yml had incorrect working directory placement, causing tests to run from root which exits with error code 1.
randomm
added a commit
that referenced
this pull request
Feb 3, 2026
) * feat: simplify agentic loop and fix critical bugs This PR implements a major refactor and stability overhaul for the agentic loop. Completed Issues: - Fixes #5: Memory leak in fire-and-forget promises (implemented BackgroundTasks tracking) - Fixes #6: Split oversized prompt.ts (extracted session/tools.ts) - Fixes #7: Add BackgroundTasks test suite - Fixes #8: Fix silent tool failure in background (added result tracking and events) - Fixes #9: Add Stream module unit tests (comprehensive coverage) - Fixes #10: Fix race condition in Remory search (added request tracking) - Fixes #11: Fix unhandled abort during stream cleanup - Fixes #12: Implement check_task tool - Fixes #13: Add config schema validation - Fixes #14: Upgrade Remory to Unix socket (implemented in socket-client.ts) - Fixes #16: Fix code style violations Changes: - Extracted tool resolution logic to `src/session/tools.ts` - Implemented `BackgroundTasks` utility for promise tracking - Added `check_task` tool for polling background tasks - Upgraded Remory client to use Unix sockets and JSON-RPC - Added comprehensive tests for Stream and BackgroundTasks * feat: auto-wakeup agent context and build fixes * chore: clean up workflows for independent fork - Remove upstream publishing workflows (npm, vscode, tauri, etc.) - Change branch references from dev to main - Keep test, typecheck, and issue management workflows * docs: replace README with oclite fork documentation - Add attribution to upstream OpenCode project (MIT requirement) - Document build-from-source installation - Explain philosophy: opinionated defaults, agentic workflows, remory integration - List differences from upstream (no desktop app, VS Code, npm publishing) - Keep it concise and focused on single developer use case * docs: add README and release workflow for independent fork - New README with installation, philosophy, attribution - GitHub Actions workflow for building/releasing binaries - Closes #23, closes #24 * feat: lazy load AI SDKs and fix typecheck errors - Convert 21 AI provider imports to dynamic imports - Add null checks in github.ts - Fix task.ts and test type definitions - Enable minification in build - Improve TUI activity streaming * fix: use git toplevel for worktree path (#31) * fix(session): prevent orphaned task slots blocking allocation (#33) - Store release_slot callback in TaskMetadata for lifecycle tracking - Release slot in trackBackgroundTask finally block (handles timeout/crash/abort) - Fix double-release race in task.ts with slotReleased guard - Release slot before metadata deletion in cancelBackgroundTask - Simplify cleanupAllTaskSlots to prevent race with finally blocks - Add comprehensive AGENTS.md aligned with project standards (#34) Closes #33 Closes #34 * fix(tool): correct CheckTask error handling and test context - Use try/catch instead of Promise chaining for Session.get errors - Add sessionID to test context for proper caller identification * chore(ci): simplify workflows to essential test suite only Remove inherited upstream workflows. Keep only basic CI for typecheck and tests. * fix(ci): run tests from packages/opencode directory * fix(ci): run tests from correct directory Previously the ci.yml had incorrect working directory placement, causing tests to run from root which exits with error code 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes orphaned task slots blocking parallel task allocation
Changes
Task Slot Lifecycle Management (#33)
AGENTS.md Rewrite (#34)
Related Issues
Closes #33 - Task slot orphanage blocking allocation
Closes #34 - AGENTS.md comprehensive rewrite
Notes
Local verification: Typecheck passed (0 errors) via turbo cache.
Test status: Several pre-existing test failures unrelated to task slot changes:
All task slot-related functionality works correctly. Test failures are environmental/flaky issues that existed before this PR.