Skip to content

feat(edge-worker): cloud-runtime package-install system prompt addendum (CYPACK-1266)#1272

Open
cyrusagent wants to merge 3 commits into
mainfrom
cypack-1266
Open

feat(edge-worker): cloud-runtime package-install system prompt addendum (CYPACK-1266)#1272
cyrusagent wants to merge 3 commits into
mainfrom
cypack-1266

Conversation

@cyrusagent
Copy link
Copy Markdown
Contributor

@cyrusagent cyrusagent commented May 29, 2026

Summary

Implements CYPACK-1266: on Cyrus-managed cloud runtimes, the agent now knows that missing system packages must be added through the dashboard rather than installed ad-hoc.

CYHOST-994 introduces a way for users to add system-wide apt/npm packages to their VPS. Since Cyrus has no intrinsic way of knowing it's running on a managed cloud runtime, this PR gates the behavior behind a new env var, CYRUS_CLOUD_RUNTIME. When it's truthy, a system-prompt addendum tells the agent: if a package is missing, don't try to sudo apt install / npm install -g (won't persist, may fail on perms) — instead direct the user to https://app.atcyrus.com/settings/packages to add the exact package(s) needed, naming them and explaining why, and continue with whatever work isn't blocked.

Approach (SOLID)

Mirrors the existing browser-use addendum precedent exactly:

  • New single-responsibility module packages/edge-worker/src/prompts/cloudRuntimePromptAddendum.ts — owns the addendum text and a pure appendCloudRuntimeAddendum() that is a no-op unless CYRUS_CLOUD_RUNTIME is truthy (1/true/yes, case/space-insensitive).
  • Chained at the single composition pointRunnerConfigBuilder builds appendSystemPrompt for both chat and issue sessions; the new addendum wraps the existing appendBrowserUseAddendum(appendFailureModeAddendum(...)) chain at both sites.

Code paths considered (cold start + hot refresh)

RunnerConfigBuilder is the single point through which every runner config flows — both the chat-session and issue-session build sites are updated. The env var is read fresh each time a runner config is assembled, so it applies identically on cold starts (new session) and continuation/resume runs. No config-schema plumbing is needed since this is a runtime env var, not a config.json field — so there's no ConfigManager whitelist or path-normalization codepath to update.

Testing

  • New unit test cloudRuntimePromptAddendum.test.ts (6 cases): unset/falsy → unchanged, truthy spellings, separator behavior, verbatim-when-empty, and presence of the settings link + apt/npm guidance.
  • Full edge-worker suite green (676 tests).
  • Monorepo build + typecheck pass (run via pre-commit hook).

Changelog

Added an ## [Unreleased] entry referencing CYPACK-1266 and this PR.

…um (CYPACK-1266)

When the CYRUS_CLOUD_RUNTIME env var is truthy, append a system-prompt
addendum instructing the agent to direct users to
https://app.atcyrus.com/settings/packages to install missing apt/npm
packages rather than installing them ad-hoc. Off by default for self-host.

Mirrors the existing browser-use addendum pattern: a single gated module
chained into appendSystemPrompt at both RunnerConfigBuilder build sites
(chat + issue), so it applies on both cold starts and continuation runs.
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.

2 participants