Skip to content

Gate sandbox-only prompt sections on local_mode#267

Open
Abhilekh-Meda wants to merge 1 commit into
huggingface:mainfrom
Abhilekh-Meda:prompt/gate-sandbox-sections-on-local-mode
Open

Gate sandbox-only prompt sections on local_mode#267
Abhilekh-Meda wants to merge 1 commit into
huggingface:mainfrom
Abhilekh-Meda:prompt/gate-sandbox-sections-on-local-mode

Conversation

@Abhilekh-Meda
Copy link
Copy Markdown

@Abhilekh-Meda Abhilekh-Meda commented May 17, 2026

Summary

The system prompt asserted sandbox-only details (sandbox_create,/app/ paths, "session sandbox") unconditionally, then a postscript in ContextManager appended a "actually ignore that" paragraph in local mode. The agent had to hold two contradictory frames and pick the right one at runtime.

This PR moves the mode split into the Jinja template:

  • Five sandbox-only sections in system_prompt_v3.yaml are wrapped in {% if not local_mode %} / {% else %} gates, each with a paralllel local-mode variant carrying the equivalent information.
  • ContextManager._load_system_prompt passes local_mode and cwd into template.render().
  • The 16 line postscript is deleted

Verification

  • Sandbox rendering is identical to the pre-change output. Non-local users see zero change.
  • Local rendering carries the equivalent info the postscript used to (no sandbox, working directory, no sandbox_create, no /app/ paths). Now natively in the prompt instead of as a contradicting postscript.
  • All unit tests pass.

##Out of scope

There is similar pattern with autonomous / headless mode asking the LLM to self assess. The autonomous gate would need new plunmbing (autonomous: bool).

Test plan

  • Sandbox render unchanged (diff checked)
  • Local render contains no sandbox_create / /app/ references
  • Full unit test suite passes
  • Manual smoke test: confirm normal startup

The system prompt asserted sandbox-only details (sandbox_create,

/app/ paths, "session sandbox") unconditionally, then a postscript
in ContextManager appended a "actually ignore that" paragraph in
local mode. The agent had to hold two contradictory frames and pick
the right one at runtime.

Wrap the five sandbox-specific sections in {% if not local_mode %}
gates with parallel local-mode variants that carry the equivalent
information natively, and delete the postscript. Sandbox-mode
rendering is byte-for-byte identical to before.
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.

1 participant