Skip to content

Conversation

@minorcell
Copy link
Owner

@minorcell minorcell commented Dec 17, 2025

✨ PR Description

Purpose: Refactor run_bun tool to execute code within platform-specific sandboxes and add lifecycle hook system to enable middleware-based session monitoring and extensions.

Main changes:

  • Implemented sandbox isolation for run_bun using bubblewrap (Linux) and sandbox-exec (macOS) with network/filesystem restrictions
  • Added comprehensive hook system (onTurnStart/onAction/onObservation/onFinal) and middleware support for session lifecycle events
  • Introduced time tool providing system time in multiple formats (ISO/UTC/epoch/timezone) for agent temporal awareness

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link

@linearb linearb bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ PR Review

The PR introduces a comprehensive security sandbox for the run_bun tool and implements a well-designed hook/middleware system for session lifecycle events. The changes appear to maintain good separation of concerns and error handling.

2 issues detected:

🧹 Maintainability - Inconsistent API contract for hook payload properties reduces developer experience and predictability.

Details: The onFinal hook calls are inconsistent about when the step property is included in the payload. Some calls (lines 191, 226, 369) omit step while others (line 282) include it. This inconsistency could confuse middleware authors about when to expect step context.
File: packages/core/src/runtime/session.ts

🧹 Maintainability - Silent test skipping can lead to false confidence about test coverage and functionality verification. 🛠️

Details: Tests are silently skipped when sandbox tools (bwrap/sandbox-exec) are not available, which could mask security functionality issues in CI/CD environments where these tools might not be installed.
File: packages/tools/src/tools/run_bun.test.ts (21-21)
🛠️ A suggested code correction is included in the review comments.

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how

tempDir = await mkdtemp(join(tmpdir(), 'memo-run-bun-test-'))
process.env.TMPDIR = tempDir
})
const describeRunBun = hasSandbox ? describe : describe.skip
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Maintainability - Silent Test Skipping: Add explicit logging when tests are skipped due to missing sandbox tools, or ensure CI environments have the required dependencies installed.

Suggested change
const describeRunBun = hasSandbox ? describe : describe.skip
const describeRunBun = hasSandbox ? describe : (() => {
console.warn('Skipping run_bun tests: sandbox tools (bwrap/sandbox-exec) not available')
return describe.skip
})()
Is this review accurate? Use 👍 or 👎 to rate it

If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over

@minorcell minorcell merged commit 66ef9fe into main Dec 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants