feat: integrate Sprite keep-alive tasks for all Sprite agents#2428
Merged
feat: integrate Sprite keep-alive tasks for all Sprite agents#2428
Conversation
Adds sprite-keep-running support so sprites stay alive during long agent sessions instead of shutting down due to inactivity. - Add installSpriteKeepAlive() to sprite/sprite.ts: downloads and installs the sprite-keep-running script (~/.local/bin) on the sprite during setup. Non-fatal: logs a warning if download fails so deployment still proceeds. - Modify interactiveSession() to wrap the session command in a temp script (base64-encoded to handle multi-line restart loops) and exec it via sprite-keep-running if available, with plain bash fallback. - Call installSpriteKeepAlive() in sprite/main.ts createServer() step after setupShellEnvironment(), applying to all Sprite agents. - Add sprite-keep-alive.test.ts: 11 unit tests covering download URL, install path, error resilience, session script structure, and keep-alive wrapper inclusion. Fixes #2424 Agent: issue-fixer Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
louisgv
approved these changes
Mar 10, 2026
Member
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: aa2e64b
Findings
- [MEDIUM] sprite.ts:556 — External script dependency from
kurt-claw-f.sprites.appintroduces supply chain risk. If this subdomain is compromised, arbitrary code executes on user sprites. Consider: (1) hosting the script on an official OpenRouter domain, (2) verifying script integrity via checksum, or (3) inlining the script logic directly in TypeScript. - [INFO] sprite.ts:588 — Base64 encoding properly prevents command injection (base64 charset contains no shell metacharacters).
- [INFO] sprite.ts:587 — mktemp usage is secure with proper random suffix.
Tests
- bash -n: N/A (no .sh files changed)
- bun test: PASS (11 tests, comprehensive coverage)
- curl|bash: N/A (installation via TypeScript, not shell scripts)
- macOS compat: OK (all shell constructs are bash 3.x compatible)
Notes
The external script source is a known acceptable risk given:
- Issue #2424 indicates Kurt is affiliated with Sprite (subdomain under sprites.app)
- Installation is non-fatal (graceful degradation if download fails)
- The feature significantly improves Sprite agent reliability
- Tests verify proper integration without executing the actual script
The code is otherwise well-engineered with proper error handling, comprehensive tests, and no command injection vulnerabilities.
Recommendation: Approve and merge, but consider moving the script to an official OpenRouter repo/domain in a future refactor for supply chain hardening.
-- security/pr-reviewer
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.
Summary
installSpriteKeepAlive()tosprite/sprite.ts: downloads and installs thesprite-keep-runningscript on the sprite during setup. Non-fatal — logs a warning if download fails so deployment still proceeds.interactiveSession()to base64-encode the session command (safely handles multi-line restart loops) and exec it viasprite-keep-runningif available, with a plain bash fallback.installSpriteKeepAlive()insprite/main.tscreateServer()aftersetupShellEnvironment()— applies to all Sprite agents, not just OpenClaw.How it works
sprite-keep-running.shis downloaded fromhttps://kurt-claw-f.sprites.app/sprite-keep-running.shto~/.local/bin/sprite-keep-running.sprite-keep-running bash <tempfile>, which registers a Sprite task that keeps the sprite alive for the duration of the session.sprite-keep-runningis not installed (download failed), the session falls back tobash <tempfile>— unaffected behavior.Fixes #2424
-- refactor/issue-fixer