A0: Architecture, decisions, and contracts for the optional execution gateway #85
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
P1
P2
P3
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#86 M01: Resource registry, state, and collectors for executable resources
Creatidy/scarcity-router
#87 M02: Routing core, policy, and client-requirement binding for executable targets
Creatidy/scarcity-router
#89 M04: Generic OpenAI-compatible HTTP adapter and Ollama integration
Creatidy/scarcity-router
#88 M03: OpenAI-compatible gateway and execution coordinator
Creatidy/scarcity-router
#91 M06: Codex adapter: CLI/App Server with Desktop and VS Code installations
Creatidy/scarcity-router
#90 M05: Native worker, pairing, and execution transport
Creatidy/scarcity-router
#92 M07: ZCode adapter: feasibility proof and experimental integration
Creatidy/scarcity-router
#93 M08: MCP, REST, and CLI compatibility; optional remote mode
Creatidy/scarcity-router
#94 M09: Configuration, web UX, and diagnostics
Creatidy/scarcity-router
#95 M10: Distribution, installation, update, and end-to-end acceptance
Creatidy/scarcity-router
Reference
Creatidy/scarcity-router#85
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Produce the coherent architecture specification for the owner-approved optional execution gateway extension — without a rewrite and without breaking recommendation-only operation — and record the superseding product decisions that authorize it.
This is the program-map issue for the execution-gateway program. The module issues M01–M10 are separate Forgejo issues (linked in the program map below and via Forgejo dependencies). A0 is documentation/contract work only; it implements no runtime behavior.
Analysis baseline:
develop@fce4311b934771f0005cada53163864790edd0e2(2026-09-19).Program map (module issues)
Dependency edges (blocked-by, cycle-free): M01→A0; M02→A0; M03→A0,M01,M02; M04→A0,M03; M05→A0,M03; M06→A0,M05 (stage 2 only; stage 1 verification exempt); M07→A0,M05 (stage 2 only; stage 1 verification exempt); M08→A0; M09→A0,M03; M10→A0,M01,M02,M03,M04,M05.
Recommended first useful execution vertical slice: M01/M02 → M03/M04, with the minimum M09/M10 support each slice needs — a user should be able to use real API/Ollama resources through one OpenAI-compatible endpoint before all local CLI adapters are complete. Then M05 and M06; M07 runs as an independent research/integration track; M08 guards compatibility throughout; M09 and M10 contribute their per-slice minimums rather than being postponed entirely.
User value
A user can point any OpenAI-compatible client (one
base_url, one client API key, one model/profile identifier) at a single Scarcity Router endpoint and have requests served from the best available authorized resource — API providers, Ollama/local inference, or approved local Codex/ZCode adapters — under the existing least-scarce-capable routing discipline, while every existing recommendation-only user and interface keeps working unchanged.Product decision being implemented (owner-approved, 2026-09-19)
Scarcity Router remains one independent Apache-2.0 OSS repository and gains an OPTIONAL execution gateway alongside recommendation-only mode. This intentionally supersedes the previous blanket prohibition on inference proxying and the removal of Ollama support. It does NOT remove recommendation-only mode, does not turn Scarcity Router into an autonomous coding/agent framework, does not grant arbitrary command execution on hosts, and does not build issue-to-PR orchestration, repository management or a generic agent workflow framework. Repositories and client-side tools remain controlled by the client; SSH is a way a user may reach a machine, not a router orchestration protocol.
The goal is efficient use of heterogeneous AI access: subscriptions, eligible promotions, metered APIs, prepaid APIs and local models/local GPU. The same model name must not be assumed to mean the same resource, entitlement, quota pool, cost model or promotional eligibility.
Relationship to current code (what exists today)
scarcity_router/selector.py,scarcity.py,policy.py,selection_types.py,simulation.py,selection_app.py(balanced selector; catalog v3 with nine calibrated identities; policy v8; capacity contract v3; machine-interface v1).cli.py:status/select/simulate/install-config), loopback REST (server.py:/healthz,/v1/status,/v1/select,/v1/simulate), stdio MCP (mcp.py:scarcity_status/scarcity_select/scarcity_simulate), shared logical parsing inmachine_api.py.providers/openai_codex*.py) with the D-039ExecutionEligibilitycontract (eligibility.py,providers/openai_eligibility.py), Z.ai Coding Plan (providers/zai*.py).scarcity-router0.1.0 wheel with three console scripts (D-034); default user config~/.config/scarcity-router/selector-policy.json(D-036).docs/product.mdnon-goals,docs/security.mdinvariants.Related but NOT repurposed: issue #82 / decision D-039 (execution-eligibility telemetry) is merged work this program builds on; its scope is complete and it remains a separate open issue for its own closeout.
Existing decisions and documents that A0 must supersede or amend (explicit list)
Superseding decisions are recorded in
docs/decisions.mdwith the next free D-numbers; history is never rewritten:docs/machine-interfaces.mdnon-goals — amended: the existing v1 recommendation surfaces keep their frozen semantics untouched; a NEW, separately versioned OpenAI-compatible execution surface is introduced (never silently added to v1).docs/security.md.docs/product.mdnon-goals and README boundary text — rewritten to the two-mode product; every invariant that remains true (security invariants, provider-edge discipline, quota-never-changes-capability, licensing) stays unchanged.Scope
docs/architecture.md,docs/product.md,docs/security.md,docs/machine-interfaces.md,docs/providers.md,docs/capacity-model.md,docs/selection-policy.md,docs/roadmap.md,AGENTS.md,README.mdanddocs/decisions.mdto the two-mode product.tool_calls, tool results, structured output, reasoning controls, context limits, error semantics, usage reporting, cancellation); threat model; supported deployment topologies; migration plan.base_url+api_key+modelclients but never replace the full requirement contract; reuse the existing task/profile model — no second simplified scoring system, no mandatory LLM request classifier. If the caller explicitly requests a concrete model/effort/target, it is never silently replaced.selectcan subsequently execute the selected target through the gateway without triggering an unexpected second routing decision, and freeze that a recommendation is not automatically a reservation, a capacity guarantee or an execution guarantee.Non-goals
scarcity run <task>-style interface; no reset-card redemption or similar benefit-consuming actions (they remain information unless a separate explicit decision authorizes acting on them); no general task scheduler; an execution mode with undefined/unbounded start time must not silently replace a synchronous HTTP request.Contracts / interfaces affected
Machine-interface v1 (preserved; additive changes only per D-028 versioning rules), a new versioned OpenAI-compatible execution surface (new contract), worker protocol (new contract), catalog/policy artifacts (additive evolution per the D-032 compatibility discipline), capacity contract v3 (preserved; extensions only via explicit versioning),
ExecutionEligibilityv1 (preserved, D-039).Dependencies
None — this issue is the program root. M06/M07 Stage-1 feasibility evidence may inform A0 but does not block it; A0 must not wait for adapter implementations, and adapter implementation issues must not wait for A0 beyond their declared dependency edges (the Forgejo dependency graph encodes this DAG; Stage-1 research in M06/M07 is explicitly exempt from those edges).
Acceptance criteria
docs/decisions.mdrecords the superseding decisions above with provenance, date/version, confidence, rationale and human-reviewable diffs; no decision is changed silently.verify=false; no shared default password; no bearer secrets in URLs; request-body, context/output, concurrency, execution-time and spending limits; router-loop protection (router → router → router); provider credentials bound to configured origins; SSRF protection; noAuthorizationforwarding across unsafe redirects; explicit bounded localhost-HTTP exceptions only where justified; no generic shell API; no root/Administrator execution by default; no Docker socket mounting; no arbitrary repository mounting; no uncontrolled client-supplied subprocess flags/environment variables; session, filesystem and tool isolation; no accidental import of unrelated conversation history or global plugins; no prompt/response logging by default; no secret logging; redacted diagnostics; minimal audit metadata with bounded retention; logs created by local runtimes accounted for; provider subscription/promotional terms respected; several apps owned by one user must not automatically imply the right to share one personal subscription with multiple independent users.Security considerations
A0 defines the boundaries only (see threat model above); implementation lands in the module issues. No credential values, account identifiers or prompt content may appear in any A0 document, example or fixture.
Risks
Evidence still required
Validation gate (unchanged)
uv sync --only-dev && make check && uv run basedpyright && git diff --checkfor any documentation PR; one feature branch fromdevelop, one PR targetingdevelop, left open for human review.