Skip to content

feat: simplify agentic loop and fix critical bugs#17

Closed
randomm wants to merge 1 commit into
devfrom
claude/simplify-agentic-loop-2jRSP
Closed

feat: simplify agentic loop and fix critical bugs#17
randomm wants to merge 1 commit into
devfrom
claude/simplify-agentic-loop-2jRSP

Conversation

@randomm

@randomm randomm commented Jan 24, 2026

Copy link
Copy Markdown
Owner

Summary

This PR consolidates fixes for 11 issues related to stability, performance, and code quality in the agentic loop.

Key Changes

  • Refactoring: Split prompt.ts by extracting tool resolution logic to tools.ts.
  • Stability: Fixed memory leaks in background tasks and race conditions in memory search.
  • Reliability: Added comprehensive test suites for Stream and BackgroundTasks modules.
  • Features: Implemented check_task tool and upgraded Remory integration to Unix sockets.

Issues Closed

Closes #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #16

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
@randomm

randomm commented Jan 26, 2026

Copy link
Copy Markdown
Owner Author

Closing - this PR's core contributions (tools.ts, socket-client.ts, check_task.ts, tasks.ts, stream tests) have been superseded by subsequent commits to dev branch. Multiple issues (#5, #11, #12) are already resolved. The branch has conflicts and is stale. Any remaining work from issues #13, #16 will be addressed in fresh PRs.

@randomm randomm closed this Jan 26, 2026
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.

[Critical] Fix memory leak in fire-and-forget promises

1 participant