Skip to content

delegate-mcp: per-task delegation profiles (parked) #124

Closed

Description

@Alter-Igor

Parked follow-up from #104 (done 2026-10-05).

Idea

Let oc_start_session pass its own delegation profile (CAS field names), narrower than the owner's box-wide OPENCODE_DELEGATE_DYNAMIC_PROFILE.

Why it is parked

  • The delegation gate cannot tell which session made a call. The box's MCP calls carry no session identity, and approvals are already box-wide for the same reason.
  • A session identity set inside the box could be set by any session (the box is one trust zone). So a per-task profile could only ever be a convenience, like oc_start_session {keystone}, never a wall. The owner's box-wide profile stays the wall.
  • No current task needs it. The box-wide profile plus approvals cover today's use.

If picked up

Decide first whether a convenience-only narrowing is worth it. If yes: a per-session header on the ks-dynamic MCP entry, read by the gate, that can only narrow the box-wide profile.

Activity

  1. Alter-Igor commented on Nov 3, 2026

    @Alter-Igor
    OwnerAuthor

    🔒 HELD — Delivery Program Director (LIF-001-44 Wave 3 WS-09)

    ARCH-GATE-01: PASS (Model: google/gemini-3.8-flash via Synapse)

    • Workstream: WS-09 (delegate-task-profiles — delegate/-p watcher bug: headless builder detaches from launcher PID, so watchers report it dead while it works #261, delegate-mcp: per-task delegation profiles (parked) #124)
    • Design Summary:
      1. delegate/-p watcher bug: headless builder detaches from launcher PID, so watchers report it dead while it works #261 (packages/opencode/src/plugin/opencodealt-docs.ts): Export HEADLESS_WATCHER_GUIDANCE and include it in DOCS_SYSTEM_LINE and DOCS_TEMPLATE so /docs and session system prompts explicitly document that headless runs use opencodealt run (-p on opencode serve is --password) and that Windows .cmd/.bat launcher shims can detach/exit while the worker continues — programmatic watchers must track session activity (oc_status / oc_events / transcript updates), never a launcher shim PID.
      2. delegate-mcp: per-task delegation profiles (parked) #124 (�lterspective/delegate-mcp/mcp-gate/src/{policy,mcp,server}.ts, src/gate/client.ts, src/supervisor/workspaces-state.ts, src/tools/{sessions,send,delegate-task}.ts):
        • Add strict monotonic narrowing (isVisibleWithNarrowing / decideWithNarrowing) in mcp-gate/src/policy.ts: a per-task profile can only narrow the owner's box-wide OPENCODE_DELEGATE_DYNAMIC_PROFILE (intersection of visibility, union of deny/approval requirements; �pprovals: 'listed' on a narrower profile never downgrades �pprovals: 'risky' on the base profile).
        • Support POST /v1/profile on �dminHandler (host-only admin network authenticated with GATE_ADMIN_TOKEN) and x-opencode-delegate-profile header on rontHandler (failing closed with HTTP 400 if malformed).
        • Accept delegationProfile (CAS field names) on oc_start_session and delegate_task, persist in HostSessionState / SessionRecord, and push delegationProfile ?? null to ctx.gate.setTaskProfile(...) on session start and oc_send so task profiles never leak across sessions.
  2. Alter-Igor commented on Nov 3, 2026

    @Alter-Igor
    OwnerAuthor

    🔓 RELEASED — Merged to dev in PR #283 ($mergedSha, head 6b20d60). Verified by ARCH-GATE-02: PASS, FRESH-QA: PASS, and all 8 CI + CodeRabbit checks green.

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 request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions