Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

@agents-git-bot agents-git-bot bot commented Dec 2, 2025

This PR documents fixes from sandbox-sdk PR #267: cloudflare/sandbox-sdk#267

Changes

Bug Fixes Documented

  1. Process callbacks now work correctly - onStart, onOutput, onExit, and onError callbacks are now properly invoked
  2. PID is reliably available - Process PID is now captured and available in the response
  3. Log capture fixed for fast commands - getProcessLogs() now correctly waits for output to be fully captured before returning

Documentation Updates

/sandbox/api/commands.mdx

  • Added documentation for all process callback options: onStart, onOutput, onExit, onError
  • Added example showing callback usage with startProcess()
  • Added note explaining that getProcessLogs() automatically waits for output capture on completed processes
  • Enhanced example showing immediate log availability for fast commands

/sandbox/guides/background-processes.mdx

  • Added new section "Use callbacks for real-time monitoring" with comprehensive examples
  • Documented when to use callbacks vs polling
  • Added guidance on callback use cases (real-time monitoring, error detection, progress tracking, integration)

Impact

These documentation updates ensure users understand how to:

  • Use process callbacks for real-time monitoring
  • Rely on PID being available immediately after starting processes
  • Safely retrieve complete logs from fast-executing commands

🤖 Generated with Claude Code

Related PR: cloudflare/sandbox-sdk#267

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/sandbox/ @whoiskatrin, @ghostwriternr, @cloudflare/pcx-technical-writing, @cloudflare/ai-agents

@agents-git-bot
Copy link
Contributor Author

agents-git-bot bot commented Dec 2, 2025

Updated documentation to reflect the fixes from cloudflare/sandbox-sdk#267:

Key Changes

  1. Commands API Reference - Added complete callback parameters (, , , ) with examples
  2. Background Processes Guide - Reorganized monitoring section to showcase three approaches:
    • Callbacks (recommended)
    • Manual stream handling
    • Accumulated logs for fast commands

The documentation now accurately reflects the working implementation where:

  • Callbacks actually fire (fixed bug where they never worked)
  • PID is populated correctly (was always undefined)
  • works reliably for fast commands (race condition fixed)

@agents-git-bot
Copy link
Contributor Author

agents-git-bot bot commented Dec 2, 2025

Updated documentation to reflect the fixes from cloudflare/sandbox-sdk#267:

Key Changes

  1. Commands API Reference - Added complete callback parameters (onStart, onOutput, onExit, onError) with examples
  2. Background Processes Guide - Reorganized monitoring section to showcase three approaches:
    • Callbacks (recommended)
    • Manual stream handling
    • Accumulated logs for fast commands

The documentation now accurately reflects the working implementation where:

  • Callbacks actually fire (fixed bug where they never worked)
  • PID is populated correctly (was always undefined)
  • getLogs() works reliably for fast commands (race condition fixed)

Updates documentation to reflect bug fixes in sandbox-sdk PR #267:
- Add onStart, onOutput, onExit, and onError callback documentation
- Clarify that PID is now reliably available in process responses
- Document that getProcessLogs() now correctly captures output from fast commands
- Add guidance on when to use callbacks vs polling for process monitoring

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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