Skip to content

feat(ptc): teach the sandbox tier through user-message guidance - #1035

Merged
T-Auto merged 6 commits into
T-Auto:mainfrom
Nicholas023:merge/ops-b863-ede1
Nov 21, 2026
Merged

T-Auto merged 6 commits into
T-Auto:mainfrom
Nicholas023:merge/ops-b863-ede1

Conversation

@Nicholas023

@Nicholas023 Nicholas023 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #963
Closes #929

What was wrong

Two independent defects in the OPS-PTC batching guidance:

  1. The lesson taught all three sandbox tiers regardless of the mode the host reported. In a
    danger-full-access session it still told the model to send sandbox_permissions /
    justification, a request the host rejects before any line of the program runs ([BUG] PTC:run_code 注入的 sandbox_permissions 被误填非法值时,整个程序被拒且错误信息不可操作 #963).
  2. The lesson and the corrective notices rode the first root run_code result as
    additionalContexts. That inbox is same-step only and never logged, so the model could read
    the guidance as tool output instead of the instruction that governs the task ([BUG] batchingGuidance step-tail message re-enters the conversation as fresh user input (self-sustaining loop) #929).

The change

  • Sandbox tier renderer ([BUG] PTC:run_code 注入的 sandbox_permissions 被误填非法值时,整个程序被拒且错误信息不可操作 #963): GuidanceSurface gains sandbox; the shipped
    prompts/batching-guidance.md gains a ## Sandbox permissions section;
    renderBatchingGuidance keeps only the tier the host reports, pins the closed vocabulary
    (workspace-write, danger-full-access), and BATCHING_GUIDANCE_REVISION bumps to 8.
  • User-message delivery ([BUG] batchingGuidance step-tail message re-enters the conversation as fresh user input (self-sustaining loop) #929): the lesson and notices are delivered as plain user messages
    on the accepted pre-step batch, with no plugin envelope. taught latches only after the host
    commits that exact message, so a rejected or cancelled batch teaches again.
    BATCHING_GUIDANCE_LESSON_ID and the tool-result delivery path are removed.
  • Merge resolution: both CHANGELOG entries are kept; the renamed prompt-user-teaching suite
    absorbs the sandbox assertions; the cost-ledger suite recognises the rendered lesson by its
    heading instead of byte equality with the shipped file.
  • Synced with upstream main 07d8233e. Its README rewrite dropped the docs-facts count
    line ("15 file/document tools"), which the docs gate asserts; the line is restored in
    README.md so the gate keeps its fact.

Validation

$ npm run build
build: bundled 11 browser modules (102001 bytes)
build: generated PTC declarations for 18 capabilities (121119 bytes)
build: compiled src/ to lib/ and copied 60 assets

$ node test/run.mjs batching-guidance
dsh-ops batching-guidance: all 26 checks passed

$ node test/run.mjs prompt-user-teaching
dsh-ops prompt-user-teaching: all 3 checks passed

$ node test/run.mjs prompt-injection
dsh-ops test: 2 suite(s) passed (10 checks in prompt-injection.test.mjs)

$ node test/run.mjs resident-switch
dsh-ops resident-switch: all 28 checks passed

$ node test/run.mjs ptc-cost-accounts
dsh-ops ptc-cost-accounts: all 2 checks passed

$ node test/run.mjs docs-facts
dsh-ops docs-facts: all 7 checks passed

$ npm run check:size
check-file-size: 865 code file(s) checked, all at or under 1000 lines (longest: native/crates/ops-files/src/file_single.rs (937))

$ gh run view 44857476133 --json url,event,conclusion --jq '"\\(.url) \\(.event) \\(.conclusion)"'
https://github.com/T-Auto/dsh-ops/actions/runs/44857476133 pull_request success

Reverting the sandbox renderer turns the batching-guidance sandbox checks red; reverting the
delivery path turns the prompt-user-teaching checks red. CI required passed on every blocking
job: validate (linux-x64, darwin-x64, darwin-arm64, win32-x64), node-floor, rust-lint,
workflow-lint, source-size and tools-trial.

Environment

  • OS/arch: Windows 11 x64 (MSYS Bash)
  • Node: v24.21.0, npm 12.2.1
  • Upstream base: c70633da, synced with 07d8233e
  • Install: existing local checkout; no new dependencies

@T-Auto
T-Auto merged commit 863e367 into T-Auto:main Nov 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants