Repository navigation
feat(container): Phase 2 (DO-native) + short idle teardown - #122
Merged
Merged
Conversation
Flip FLUE_NATIVE=1 and the container to the thin Dockerfile so the agent brain and conversation live in the FlueJaredAgent Durable Object. The container becomes a disposable git/gh sandbox that Cloudflare tears down ~10m after its last exec (sleepAfter 2h -> 10m, centralized in SANDBOX_SLEEP_AFTER). Because the DO persists the conversation, the next event resumes context and re-clones the repo into a fresh sandbox — so we get delete-when-idle + resume-on-next-event without a fragile in-container session restore. Trade-off: Lore only runs in-container (Phase 1). In Phase 2 model traffic goes direct to OpenRouter until a standalone Lore gateway is deployed (LORE_GATEWAY_URL). Instant rollback: set FLUE_NATIVE=0 and flip the image back to Dockerfile.phase1. Validated live on getsentry/cli#1365: dispatch -> DO -> skills + gh/bash tool exec in the thin sandbox -> correct SKIPPED decision, history synced from the DO to D1, no exceptions. Co-authored-by: Cursor <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
jared | e609a7c | Aug 05 2026, 04:57 PM |
| // set back to "0" and flip the container image to Dockerfile.phase1. | ||
| // Note: Lore runs in-container (Phase 1 only) — in Phase 2 model traffic goes | ||
| // direct to OpenRouter until a standalone Lore gateway (LORE_GATEWAY_URL) is set. | ||
| "FLUE_NATIVE": "1", |
There was a problem hiding this comment.
Phase 2 still writes provider API keys into the disposable untrusted sandbox
With FLUE_NATIVE=1 the container is a thin git/gh sandbox, but ensureSandboxReady's thin path still writes OPENROUTER_API_KEY, ANTHROPIC_API_KEY, and OPENAI_API_KEY to /tmp/flue-env.sh where no Phase 2 process needs them and the agent executes commands driven by untrusted webhook/repo content — skip writing provider keys when thinSandbox is set.
Evidence
- This line sets
FLUE_NATIVE: "1", soisFlueNative()inapps/server/src/lib/github/dispatch.tsand the check inapps/server/src/routes/webhooks/sentry.ts:318passthinSandbox: truetoensureSandboxReady. - The thin branch of
ensureSandboxReady(apps/server/src/lib/containers/dispatch.ts) callswriteEnvFile, which unconditionally writesOPENROUTER_API_KEY,ANTHROPIC_API_KEY,OPENAI_API_KEY, andSENTRY_DSNto/tmp/flue-env.sh; the keys are passed in fromenv.OPENROUTER_API_KEYetc. at both call sites. - In Phase 2 no container process consumes that file for model traffic: the agent brain runs in the
FlueJaredAgentDO and model calls resolve the Worker-sideOPENROUTER_API_KEY(apps/server/src/lib/lore/provider.ts,agents/models.ts). - The sandbox is an untrusted execution environment: it clones repos from dispatched webhook events and the DO agent runs arbitrary
exec()in it viacloudflareSandbox(agents/jared.ts); prompts embed the raw webhook payload (formatEventPrompt).session-ingest-token.tsexplicitly refuses to write the shared internal token into sandboxes because "they execute untrusted repo code," but the provider keys are still written. - A prompt-injection or malicious repo script executed by the agent can read
/tmp/flue-env.shand exfiltrate the keys over the sandbox's network access (used for git clone / gh / reporter POSTs), enabling paid LLM API abuse.
Identified by Warden · security-review · 8NN-UZS
3 of 4 tasks
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
Answers the lifecycle question: delete the container when work is done, and resume prior context on the next event. We get this by moving to the intended Phase 2 topology instead of hand-rolling a fragile in-container session restore.
FLUE_NATIVE=1+ thin container image (./container/Dockerfile). The agent brain and full conversation now live in theFlueJaredAgentDurable Object; the container is a disposable git/gh sandbox.sleepAfter2h → 10m, centralized inSANDBOX_SLEEP_AFTER. In Phase 2 the container is only active during DOexec()calls, so this is an idle-safe teardown — it never fires mid-work (each exec resets the timer), and conversation survives in the DO regardless.Why not a manual
sandbox.destroy()on "done"?Arming a hard destroy from the agent-finish hook would need a reentrant self-call into the same DO (deadlock-prone) or a timer that can't tell whether the agent is still mid-work.
sleepAfteris the platform-native, idle-aware teardown and composes cleanly with DO persistence.Trade-off (intentional, agreed)
Lore only runs in-container (Phase 1). In Phase 2, model traffic goes direct to OpenRouter until a standalone Lore gateway is deployed (
LORE_GATEWAY_URL). Follow-up: stand up a standalone Lore service.Rollback
Instant: set
FLUE_NATIVE=0and flip the image back toDockerfile.phase1, then redeploy.Test plan
biome+tsc+vitest(54 passing)jared.getsentry.workers.dev(Version77aab56e)getsentry/cli#1365: dispatch → DO brain →activate_skill+gh/bashtool exec in the thin sandbox → correctSKIPPEDdecision; history synced from the DO to D1; no exceptions in logs.Made with Cursor