Skip to content

enhancement(runtime): preserve sandbox boundary negotiation across safe continuations #3731

Description

@yihanzhu

Problem

#3496 bounds invalid, unresolved, and denied sandbox-boundary negotiation while one live active Turn is running. That state is intentionally local to the Turn's ToolRuntime.

A safe-boundary continuation, crash recovery, or Runtime restart creates a new execution segment. The resumed segment must remember an explicit client denial for the same logical Turn so that recovery cannot reopen a denied negotiation.

Invalid/unresolved correction budgets remain local to each execution segment. Recovery may therefore open another bounded correction window. This additional retry/cost risk is an accepted tradeoff for avoiding cross-segment durable accounting and negotiation-history reconstruction.

Desired outcome

Preserve explicit denial across safe continuations and restart recovery without persisting authority in prompt text or trusting model-generated history.

  • Restore denial from authoritative Host-owned request-log evidence scoped to the trusted continuation chain.
  • Distinguish explicit client decisions from lifecycle cleanup, including host_restarted, turn_stopped, turn_terminal, and embedded abort/end-of-turn cleanup. Do not guess client decisions from ambiguous or legacy records.
  • Start each new execution segment with fresh invalid/unresolved counters and no inherited finalization flag, while retaining the existing limits within the segment.
  • Keep provider-replay lineage, claim, and digest validation as a separate continuation integrity requirement.
  • Cover direct and Code Mode-hidden calls without exposing hidden arguments or results.
  • Reset negotiation state for a genuinely new user Turn.
  • Never grant or widen sandbox authority from restored control state; the live ExecutionBoundary remains the sole authority.
  • Keep CLI/activation outcomes honest if a resumed Turn must end as a permission handoff or ask for a corrected declaration.

Acceptance criteria

  1. An explicit client-denied boundary negotiation cannot be reopened by a safe continuation or Runtime restart of the same logical Turn.
  2. Invalid and unresolved correction budgets are per execution segment. Each new segment starts with zero correction counts and no inherited finalization flag; the existing segment-local limits remain enforced.
  3. Capabilities allowed by the current live ExecutionBoundary remain usable after restoration. Restored denial state never grants or widens authority.
  4. Only authoritative evidence attributable to the trusted continuation chain restores denial. Lifecycle closures and ambiguous or legacy records are not inferred to be client decisions. Required authority read failures must not silently become a clean state. Existing provider-replay lineage, claim, and digest checks remain fail-closed.
  5. A genuinely new user Turn starts with no inherited denial and a clean negotiation budget.
  6. Tests using a real ToolRuntime cover direct tools, Code Mode-hidden calls, denial across continuation and crash/restart recovery, lifecycle cleanup including embedded stop/abort and end-of-turn cleanup, fresh per-segment budgets, live-boundary capability use, and new-Turn reset.

Non-goals

  • Preserving invalid/unresolved counters or finalization state across execution segments.
  • Reconstructing sandbox negotiation from RuntimeEvent history or introducing a durable cross-segment counter table.
  • Adding broad filesystem or Homebrew runtime grants.
  • Persisting a stale sandbox diagnostics snapshot.
  • Treating model declarations or prompts as execution authority.

Context

简体中文

本 issue 现在只要求:明确的客户端拒绝必须跨续跑和重启保留。invalid/unresolved 修正次数每个执行段重新计算,不继承上一段的收尾标记,段内继续执行现有限制。

我们接受恢复后可能多几次尝试和额外成本,以避免跨段持久计数和协商历史重建。系统停止、重启、取消和结束清理不能被当作客户端拒绝,含糊或旧记录不能用于猜测决定。新的用户 Turn 不继承旧拒绝;真实权限仍由当前 ExecutionBoundary 决定;上下文重放的完整性校验继续保留。

AI use

OpenAI Codex assisted with analysis and drafting. I reviewed the proposal and take responsibility for it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions