Merge remote-tracking branch 'origin/main' into region-ha-p2-console
17 files changed,
+1,179
−36
docs/superpowers/plans/2026-11-01-team-service.md+286 −0docs/superpowers/specs/2026-11-01-team-service-design.md+462 −0docs/superpowers/specs/2026-11-01-team-service-integration-audit.md+59 −0docs/superpowers/specs/2026-11-01-team-service-review.md+75 −0internal/console/apicli.go+4 −3internal/console/apiinteractive_test.go+37 −2internal/console/authcli_test.go+72 −0internal/console/fleets_test.go+20 −0internal/console/icons.go+56 −0internal/console/icons_test.go+7 −6internal/console/mobilenav_test.go+10 −5internal/console/svcprincipal.go+16 −0internal/console/templates/appmark.html+1 −0internal/console/templates/apps.html+6 −2internal/console/templates/layout.html+25 −5internal/console/templates/navindex.html+25 −10internal/edge/localhold_probed_test.go+18 −3
CI passed — run details
diff --git a/docs/superpowers/plans/2026-11-01-team-service.md b/docs/superpowers/plans/2026-11-01-team-service.md| new file mode 100644 |
| index 000000000..0a938b7a3 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-01-team-service.md |
| @@ -0,0 +1,286 @@ |
| +# Team service implementation plan |
| + |
| +Status: independently reviewed; ready for the bounded local prototype. |
| +No implementation has started. Live milestones retain their explicit gates. |
| +Spec: [team service design](../specs/2026-11-01-team-service-design.md). |
| + |
| +This plan is for implementation agents. Complete one milestone before |
| +expanding authority. New paths and API names below are proposals; existing |
| +integration points must be revalidated against the implementation branch. |
| +All source changes use isolated branches and review requests. Follow the |
| +repository's current forge and CI configuration, not an obsolete remote name. |
| + |
| +Execution order: first M0, M1 and M5's fixture workflow, exposed through a |
| +local test driver. This is the bounded prototype. M2, M3 and M4 gate the live |
| +pilot; console UI and real connections do not delay the first fixture result. |
| +The local driver is a test harness, not a shipped box-local `carlos` command. |
| + |
| +## M0: contracts and integration fixtures |
| + |
| +Create `internal/team/model.go`, `policy.go` and fixture-only adapter |
| +interfaces. Add no public routes, real credentials or background jobs. |
| + |
| +Define typed Job, Step, Attempt, Action, Event, Artifact, Memory and Grant |
| +records from the spec. Model authorization results, typed waiting reasons, |
| +usage (including unknown usage) and adapter capability declarations. Specify |
| +versioned JSON shapes, maximum request/event/artifact sizes and schema |
| +migrations. Unknown versions, operations and policy fields fail closed. |
| +Define account-scoped conversation events separately from job events. Grants |
| +are authoritative in the console; local records contain only references and |
| +audit snapshots. The fake Authority supplies the same revocation contract. |
| + |
| +Define these interfaces around explicit account and job scope: |
| + |
| +| Interface | Contract | |
| +|---|---| |
| +| Authority | Validate actor/target/operation against a current grant; never resolve a service's minter as its authority | |
| +| Provider | Start bounded turn, consume events/usage, cancel, query outcome if supported; report actual model/effort | |
| +| Runner | Claim/renew/stop/status, confined execution and artifact export; fence on every request | |
| +| Action adapter | Classify replay safety, execute immutable request, reconcile receipt/key | |
| +| Work tracker | Read external work and publish milestones; does not own attempt leases | |
| +| Verifier | Evaluate immutable evidence against the exact candidate SHA | |
| + |
| +Implement fakes with deterministic clock, crash points, duplicate deliveries, |
| +lost replies, delayed billing and provider unavailability. The Oficina seam |
| +test uses a synthetic reconciliation task with evidence requirements and no |
| +Git/app fields. Do not build a business connector in this phase. |
| + |
| +Acceptance: schemas and policy tests prove cross-account requests and unknown |
| +actions are refused; both software and business-shaped fixtures use the same |
| +job contract. No live network needed. |
| + |
| +## M1: durable execution and budget ledger |
| + |
| +Create `internal/team/store.go`, `scheduler.go`, `budget.go`, `actions.go` |
| +and `outbox.go`, with focused tests. Use the module's existing SQLite driver. |
| +Keep transactions short and perform remote calls after intent persistence. |
| + |
| +Persist job revisions/events atomically. Claim steps conditionally and issue |
| +fences. Enforce step dependencies, attempt caps and job/account concurrency. |
| +Implement reservation, settlement and uncertain-outcome handling before |
| +connecting a real provider. Retain reservations across restarts. |
| + |
| +Cancellation blocks admission first, fences old attempts and records runner |
| +stop acknowledgements. Recovery checks outstanding actions before requeueing. |
| +Provide an explicit restore-quarantine state for future deployment recovery. |
| +Outbox retries use stable logical keys and never silently drop failed sync. |
| + |
| +Acceptance includes process termination at every boundary: after intent, |
| +after reservation, after dispatch, before receipt, after receipt and before |
| +outbox acknowledgement. No test may assume a timeout means no remote effect. |
| +Test renewal after expiry, even by the same runner. Startup pauses admission, |
| +checks the external incarnation marker and revalidates grants with Authority. |
| +Missing/unclean markers cause quarantine; only successful reconciliation can |
| +clear it automatically. A later hosted test must exercise the activator's |
| +automatic DB restore. Console restore invalidates the grant authority epoch. |
| +Provide a restricted audited settlement for irreconcilable usage; unknown |
| +usage is conservatively charged, never silently released as free capacity. |
| +Run focused tests and targeted race tests for claim/budget contention. |
| + |
| +Pin transaction order in tests: online versioned authority admission, then |
| +one transaction checking stored fence/revision/grant version/state/budget and |
| +recording dispatching. Admissions expire after five seconds. Claim/cancel |
| +mutate the same row; cancelled jobs cannot be reclaimed. New claims create |
| +new attempts/workspaces, with only broker-accepted checkpoints importable. |
| +Renewals recheck authority; observed revocation cancels the attempt. Charge |
| +late usage against open reservations even after cancellation, deduplicated by |
| +receipt. Give outbox delivery the same replay/authority path as actions. |
| +The per-call output ceiling is 4,000 generated tokens, including reasoning. |
| + |
| +## M2: authority broker and runner isolation |
| + |
| +Create `internal/team/broker.go` and a separate runner supervisor entry point |
| +under `cmd/team-runner`. Broker and runner communicate over an authenticated |
| +protocol with version and payload limits. A runner is enrolled for explicit |
| +accounts/capabilities; polling never lists other accounts' jobs. |
| + |
| +The supervisor creates one isolated workspace per attempt with an explicit |
| +environment, working directory, process/memory/disk limits and egress policy. |
| +Neither repository hooks nor generated commands can read host credentials or |
| +reach production, metadata services or local control sockets. A worker's |
| +broker handle grants only its current attempt and expires with its lease. |
| + |
| +Choose an existing sandbox facility only after negative tests prove the |
| +required isolation on the selected machine. If CARLOS has no supported way |
| +to provision or manage it, specify/build that product capability; do not add |
| +an SSH/SSM prerequisite. A local test adapter may use synthetic isolated |
| +fixtures, but it must not be advertised as production-safe execution. |
| + |
| +Acceptance: traversal/symlink escape, hostile hooks, stale fence, forged |
| +runner identity, wrong account, copied capability, direct network bypass, |
| +child process survival, disk exhaustion and revoked grant are all refused or |
| +contained. Failure to establish confinement blocks the live pilot. |
| + |
| +For the first shared-machine runner, use unprivileged bubblewrap with private |
| +user/mount/PID/network namespaces and an attempt-scoped broker Unix socket. |
| +Kill the whole PID namespace or delegated cgroup and verify it is empty; |
| +process-group termination is not sufficient. Prove this with a setsid child. |
| +Do not require sudo or new root services. Inspect the existing CARLOS |
| +isolated-exec facilities before a later hosted implementation. Preserve the |
| +machine's Go cache defaults and validate read-only cache sharing/overlays. |
| + |
| +## M3: console authority, API and conversation |
| + |
| +Add proposed `internal/console/apiteam.go` and tests, `internal/team/http.go`, |
| +`conversation.go`, `memory.go`, `cmd/team/main.go`, and CLI client/dispatch |
| +files following existing root command conventions. |
| + |
| +Implement the short-lived console delegation and online introspection |
| +contract before forwarding browser or CLI requests. Test expiry, revocation, |
| +audience, account, operation, spoofed headers, CSRF and console outage. |
| +Persistent job grants must remain independently revocable and owner-bounded. |
| +Do not grant existing service roles new authority through a wildcard route. |
| +Use person-only registrations and extend the existing `closedDoors` equality |
| +test. It already permits explicit empty role sets; no new role vocabulary is |
| +needed for these doors. A separate authenticated service endpoint performs |
| +introspection, without granting Admin automatic access. |
| +Handlers must also resolve a person and check account membership. Update the |
| +route test's expected count and wildcard substitution fixtures as necessary. |
| + |
| +Proposed remote API operations: create/list/get/cancel job; append/read |
| +conversation events; view evidence/usage; list/correct/delete preferences; |
| +view/revoke job grants. Use caller-generated idempotency keys for writes and |
| +revision checks for updates. Pagination and event cursors are account-scoped. |
| +Approval records bind an exact action/target/payload and expire; changing an |
| +action requires fresh authorization under the applicable policy. |
| + |
| +Build the smallest console view: conversation, work list and job detail. |
| +Provide proposed `carlos team` operations through the console API; no local |
| +DB mode. Add headings for the implemented verbs to `docs/site/cli.md`. |
| +Run the existing copy-review pipeline for all actual UI/CLI explanatory copy |
| +and docs prose. The current spec is an agent implementation contract, not |
| +approved product wording. |
| + |
| +Memory tests cover access revocation after caching, inferred versus explicit |
| +preferences, correction/deletion invalidation and summary provenance. First |
| +use synthetic data; privacy/retention and encryption are gates for real data. |
| +Test account switching in one conversation and provider-session isolation: |
| +recent history must exclude another account even when the user can access |
| +both, unless all source and destination policies permit that transfer. |
| + |
| +Acceptance: a user can report and inspect a fixture job from browser or CLI, |
| +close/reopen the conversation, cancel it and inspect evidence. A foreign user |
| +cannot infer job existence through lists, streams, artifacts or error shapes. |
| + |
| +## M4: supported integrations |
| + |
| +Add adapters under `internal/team/integrations` with recorded contract tests. |
| +Preserve a fake option for every integration so tests remain hermetic. |
| + |
| +1. Use metered API authentication for the first live providers. Prove bounded |
| + calls, event parsing, cancellation, usage and confined tools before live |
| + work. Keep another provider for independent review; unavailable review |
| + produces a visible waiting state. Confirm provider account selection and |
| + model explicitly. Do not silently switch accounts or providers on limits. |
| + Subscription-CLI integration is deferred until its enforceable bounds are |
| + documented. Use isolated per-attempt harness home/config/session storage; |
| + include all retained provider state in deletion and retention tests. |
| +2. Bind one Amadan repository. Reuse discussions, dependencies, branch review |
| + and handoff APIs. Audit write idempotency; add a supported operation-key |
| + contract where absent, or stop on uncertain outcomes. Do not edit Amadan's |
| + database or repurpose CI claims as general-purpose job leases. |
| + Use a dedicated disclosed agent whose verified writer reach is limited to |
| + the pilot repo. If that scope is unavailable, implement it upstream first. |
| + Put operation IDs in created records for positive read-back evidence; |
| + absence of a marker alone never permits a replay. Defer payload rewrites |
| + without concurrency protection. |
| +3. Implement the configured forge's branch/review adapter. Publishing uses a |
| + broker-held credential, exact target/ref/head checks and an operation |
| + receipt. No unrestricted push/merge credential reaches repository code. |
| + The first live forge is Amadan. Defer the GitHub adapter. Require branch CI |
| + with no production credentials or deployment hooks, validate trusted CI |
| + definitions before publication and pin default-branch protections. |
| +4. Add a minimal CARLOS read-only diagnostic grant before a monitoring |
| + connector. Existing instance/operate roles are not a read-only grant. |
| + Preview creation is optional for the first bug and needs a separately |
| + scoped temporary-app/expiry policy before use. |
| + |
| +Acceptance: contract tests pin methods, auth and failure semantics. An |
| +integration gap becomes a dependency with its own change request, not an |
| +adapter that bypasses the platform. Persist upstream IDs and commit hashes. |
| + |
| +## M5: software workflow and experiment |
| + |
| +Implement a capability definition for reproduce -> implement -> review -> |
| +verify -> publish. Definitions name tools, evidence predicates and model |
| +routing policy. They do not contain permanent model conversations. |
| + |
| +Start with an intentionally broken local fixture. Preserve base/candidate |
| +snapshots and use trusted check definitions. Verify the original symptom on |
| +both. Test reviewer rejection, stale review after edits, failing checks, |
| +changed upstream head and publication acknowledgement loss. A successful |
| +result names the exact candidate and includes all required evidence. |
| +Freeze the reproduction artifact by hash before implementation, store it |
| +outside the worker's writable checkout and run that exact copy on base and |
| +candidate. A test that weakens/replaces it must be rejected. The fixture |
| +workflow runs after M1, before live dependencies. |
| +Compile errors, skipped/missing tests and zero matched tests are invalid |
| +reproduction evidence, never a passing candidate or the expected base failure. |
| + |
| +Before live use, prepare the pilot manifest: selected account/app/repository, |
| +machine, approved providers/data destinations, connection method, bounded |
| +budgets, permitted branch operations, retention and expiry. Set all other |
| +operations to deny. The user approves any remaining live authority here, |
| +after the fixture result and isolation evidence are reviewable. Existing |
| +explicit scope remains valid; do not ask again for every permitted call. |
| +Name the manifest approver, broker-credential operator and runner-machine |
| +owner. Classify real repository/conversation data and state retention for |
| +raw logs, artifacts, harness sessions and provider-hosted state. Record which |
| +bounds are enforced, not just estimated. API connections require their own |
| +explicit billing scope; design-review CLI credentials are not that scope. |
| + |
| +Run a small set of real bugs and compare with the current manual workflow. |
| +Record human intervention minutes, accepted/rejected fixes, elapsed time, |
| +tokens/cost including coordination and review, rework and regressions. Keep |
| +subscription usage distinct from metered API charges. Do not merge or deploy |
| +as part of this pilot. |
| + |
| +## Required failure matrix |
| + |
| +| Case | Required result | |
| +|---|---| |
| +| Two runners claim one step | One accepted current fence | |
| +| Old runner acts after lease expiry | Broker refuses; old artifacts cannot satisfy evidence | |
| +| Same runner renews after deadline | Renewal refused; a new claim gets a new fence | |
| +| Reclaimed attempt reuses stale workspace | Rejected; only accepted checkpoints can be imported | |
| +| Remote action succeeds, response lost | Reconcile or wait; never blind replay | |
| +| Cancel during remote action | Stop new work; show in-flight effect separately | |
| +| Scheduler/runner restarts | Restore intents/reservations before admission | |
| +| Backup predates revocation | Quarantine; stale grants cannot resume work | |
| +| Concurrent jobs/children reserve final budget | At most available capacity admitted | |
| +| Usage missing or price unknown | Retain reservation or refuse; no free retry assumption | |
| +| Usage arrives after cancellation | Open reservation settles exactly once; job outcome stays terminal | |
| +| Account access revoked after caching | No cached content returned or new actions admitted | |
| +| Log/support text requests more authority | Remains untrusted evidence; policy unchanged | |
| +| Reviewer absent or same implementation run | No verified success | |
| +| Candidate/check definitions change | Previous verification invalidated | |
| +| Implementer replaces reproduction | Hash-pinned reproduction still fails; no success | |
| +| Reproduction compiles badly, skips or matches no test | Invalid evidence; cannot satisfy success | |
| +| Candidate changes remote CI to obtain secrets | Publication refused before triggering CI | |
| +| Amadan unavailable or ambiguous write | Work visibly waiting/sync pending; no false completion | |
| +| Worker attempts host filesystem/network access | Isolation blocks it; no credential exposure | |
| +| Worker forks a detached setsid child | Entire containment unit is stopped | |
| +| Account switch or provider resume carries foreign context | Assembly/resume refused or scoped content excluded | |
| +| Repeated metric signal | One investigation per dedupe/cooldown policy, when enabled later | |
| + |
| +## Validation, rollout and deferred work |
| + |
| +For source implementation, use focused tests while iterating and run the |
| +repo's complete required build/vet/test/format/cross-compile gate before |
| +landing. Tests invoking `carlos` use `carlosTestEnv` and a scratch cwd. Leave |
| +Go cache defaults alone. No integration test may discover a real login from |
| +HOME or ancestor `.carlos/config` files. |
| + |
| +Ship the capability disabled by default. A service outage leaves app serving |
| +and ordinary CARLOS administration working. Additive schemas and API versions |
| +must allow stopping the service without breaking the console. Rollback pauses |
| +admission first; do not roll a binary back across an incompatible job schema. |
| + |
| +This design-only branch changes no executable code; validate document links, |
| +source references, whitespace, scope consistency and independent review. Do |
| +not claim implementation tests or live results for these documents. |
| + |
| +Deferred: remote sandbox vendor selection, multi-region scheduling, broad |
| +autonomous remediation, automatic merge/deploy, customer-support connectors, |
| +business connectors, model benchmarking and a team flow visualization. The |
| +first experiment must establish useful work and recoverability before these. |
diff --git a/docs/superpowers/specs/2026-11-01-team-service-design.md b/docs/superpowers/specs/2026-11-01-team-service-design.md| new file mode 100644 |
| index 000000000..107b914e0 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-01-team-service-design.md |
| @@ -0,0 +1,462 @@ |
| +# Team service: delegated work for CARLOS and Oficina |
| + |
| +Status: independently reviewed implementation contract; ready for the local |
| +prototype. Live use remains gated by the implementation plan. |
| +Date: 2026-11-01. |
| +Companion: [implementation plan](../plans/2026-11-01-team-service.md). |
| +Evidence: [integration audit](2026-11-01-team-service-integration-audit.md) and |
| +[independent review](2026-11-01-team-service-review.md). |
| + |
| +## Outcome and scope |
| + |
| +Build an integrated CARLOS capability that carries a request from a main |
| +conversation to a verified result. Run orchestration as a separate service. |
| +CARLOS supplies software operations; Oficina can later supply business |
| +operations using the same job, authority and evidence contracts. |
| + |
| +The first experiment accepts one bug in an explicitly selected repository, |
| +reproduces it, prepares a change, obtains independent review, runs the |
| +repository's checks and opens a reviewable change request. It stops there. |
| +Automatic merge, deployment, production infrastructure changes, customer |
| +messages and financial actions are outside the experiment's grant. |
| + |
| +The first deliverable is this spec and its reviewed implementation plan. |
| +It does not authorize deploying the service or enrolling machines/accounts. |
| +Implementation starts with fake providers and local fixtures. A live pilot |
| +needs a concrete target repository, credential connection and finite budget. |
| + |
| +Product decisions from the conversation: |
| + |
| +- One main conversation; optional focused job conversations. Session and |
| + context-window management are internal work. |
| +- Keep anthropomorphism low. Use coordinator, capability, job, run and |
| + evidence. No invented staff biographies, personalities or staged dialogue. |
| +- Integrate with the existing console login and accounts. The service is |
| + independently deployable; the edge does not depend on its availability. |
| +- Preferences are inspectable, sourced and correctable. Inferred taste does |
| + not grant authority. |
| +- Use supported CARLOS API/CLI operations. Missing functionality is a product |
| + gap to implement, never permission to use AWS, a box shell or a local DB. |
| +- Autonomous improvement is a later trigger for the same job workflow, with |
| + explicit policy and measured outcomes. |
| + |
| +## Components and ownership |
| + |
| +Implement the first service in the platform Go module as `cmd/team` with |
| +domain code under `internal/team`. It has its own process and application |
| +database. Existing `cmd/console` and the `carlos` CLI are clients. These are |
| +proposed paths, not commands or packages that exist today. |
| + |
| +```mermaid |
| +flowchart LR |
| + UI[CARLOS console and CLI] --> C[Coordinator and context selection] |
| + O[Future Oficina client] --> C |
| + C --> J[Durable jobs and scheduler] |
| + J --> B[Policy and action broker] |
| + J --> R[Isolated runners] |
| + B --> P[Provider adapters] |
| + B --> A[Amadan and forge APIs] |
| + B --> K[CARLOS APIs] |
| + R --> B |
| +``` |
| + |
| +The coordinator proposes structured jobs and tool requests. Ordinary code |
| +validates them, admits work and enforces limits. A model cannot mint grants, |
| +raise a budget, edit enforcement policy or declare its own review sufficient. |
| + |
| +The team database is authoritative for execution state, reservations, action |
| +receipts and job events. Amadan is authoritative for its discussions, tasks, |
| +dependencies and reviews. Store links and publish selected execution events |
| +through an outbox; do not make two writable copies of the same state. |
| +An Amadan task status is not an execution lock or an authorization decision. |
| + |
| +Each job belongs to exactly one CARLOS account. An explicit binding maps it |
| +to a repository and any app. Never infer a mapping from matching names or |
| +email addresses. Cross-account programmes consist of separately authorized |
| +child jobs. Their summaries remain account-labelled and access-filtered. |
| + |
| +One personal conversation can navigate several accounts. Retrieval checks |
| +current access before returning any account content, including titles, |
| +counts, citations, summaries and cached context. A turn must select its |
| +account before model context is assembled. A cross-account overview merges |
| +only separately authorized summaries; it does not silently send all private |
| +contexts to every worker. |
| + |
| +Conversation events carry their own ID, sequence, owner, account/personal |
| +scope and source references. Generated content inherits its sources' scope; |
| +an account-derived summary cannot become personal memory. Build a turn only |
| +from personal and selected-account events. Multi-account events require all |
| +source grants and destination permissions, or are omitted. Provider state |
| +follows the same boundary. The live pilot uses one account only. |
| + |
| +## Records and invariants |
| + |
| +Use SQLite transactions in the service's application database, following the |
| +platform's single-writer app contract. The pilot proves process-crash recovery; |
| +it does not claim HA or host-loss recovery. Deployment durability and restore |
| +procedures are a separate release gate. |
| + |
| +| Record | Required fields and constraints | |
| +|---|---| |
| +| Job | ID, account, requester, target binding, outcome, evidence requirements, policy version, state, revision, budget ID, parent ID, created/updated timestamps | |
| +| Step | Job ID, capability/version, dependencies, state, expected input/artifact hashes; dependency graph must be acyclic | |
| +| Attempt | Step ID, attempt number, runner ID, fence generation, lease deadline, provider/model/effort, usage, terminal result; one active attempt per step | |
| +| Action | Account/job/step, logical action key, immutable canonical arguments hash, fence, grant reference, reservation, state, external receipt | |
| +| Event | Job-local increasing sequence, type, actor, payload reference, source timestamp; appended in the same transaction as state changes | |
| +| Artifact | Account/job, content hash, media type, byte limit, provenance, visibility, storage reference; no credentials | |
| +| Memory | Subject, account or personal scope, assertion, explicit/inferred status, source references, version, expiry/deletion state | |
| +| Grant | Issuer, actor, account, app/repo targets, allowed operations, provider/data destinations, budget, expiry, revocation/version; separate from memory | |
| +| Outbox | Unique action/event key, destination, delivery state, last error, external receipt | |
| + |
| +Job states: `queued`, `running`, `waiting`, `verifying`, `succeeded`, `failed`, |
| +`cancelled`. Waiting has a typed reason such as approval, provider limit, |
| +budget, dependency, runner unavailable or uncertain external outcome. |
| +Only the scheduler writes state transitions. Every transition checks the |
| +expected revision and appends an event atomically. Terminal jobs are immutable; |
| +additional work is a linked new job. Late usage updates the separate ledger |
| +and audit stream without changing a terminal job's outcome. |
| + |
| +Success requires the configured evidence predicate. For a software fix that |
| +includes a failing reproduction on the base, a passing reproduction on the |
| +candidate, required checks, independent review and the exact published head. |
| +A model's narrative or a successful provider exit code cannot satisfy this. |
| +Any changed candidate invalidates the previous checks and review. |
| +Freeze the reproduction artifact by content hash before implementation. |
| +Verification obtains that exact artifact from the trusted artifact store, |
| +outside the implementation workspace. A candidate cannot replace or weaken |
| +it; an authorized reproduction change restarts reproduction and review. |
| +Compile errors, skips, missing targets and zero matched tests count as neither |
| +the expected base failure nor a candidate pass. Run the frozen artifact under |
| +trusted base-revision check definitions and record the actual test count. |
| + |
| +## Leases, external actions and cancellation |
| + |
| +A runner claims a step transactionally. The initial lease is 60 seconds and |
| +renews every 15 seconds. A successful new claim increments a monotonically |
| +increasing fence. Every accepted event, artifact registration and broker |
| +action carries that fence. Stale runners cannot publish accepted results or |
| +begin new external actions. A runner stops work when renewal fails; the |
| +broker independently enforces the deadline. |
| +Renewal after the deadline is refused even to the previous holder. A fresh |
| +claim is required; artifacts made during the gap cannot inherit its new fence. |
| +A fresh claim creates a new Attempt and fresh workspace. Only previously |
| +accepted, hash-verified checkpoints may be imported through the broker; do |
| +not re-register files left by the expired worker. Enforce one active attempt |
| +with a partial unique index. The short lease may consume an attempt during a |
| +scheduler stall; tuning it later must preserve the same fencing semantics. |
| + |
| +Lease expiry does not prove a process stopped and does not undo an external |
| +request. Record an action intent and reserve its budget before dispatch. |
| +Retries keep the logical action key and canonical arguments, even when the |
| +attempt changes. A different payload under the same key is a conflict. |
| + |
| +Adapters must classify operations as read-only, externally idempotent, |
| +reconcilable by receipt/key, or unsafe to replay. Reconcile a lost response |
| +before dispatching again. If the external system cannot prove whether an |
| +operation happened, set `waiting/uncertain_external_outcome`; do not guess. |
| +This applies to discussions, comments, change requests and paid inference. |
| +The design promises controlled retries, not exactly-once external delivery. |
| + |
| +Cancel first revokes further admission and increments the fence, then asks |
| +the runner supervisor to terminate the attempt's whole containment unit |
| +(a delegated cgroup or private PID namespace, including detached children). |
| +A process-group kill alone is insufficient because a child can call setsid. |
| +Persist the stop |
| +request and its acknowledgement. Report cancellation complete only once the |
| +runner is confirmed stopped or isolated; report outstanding external effects |
| +and reservations separately. Do not declare an already-dispatched action |
| +reversed. A replacement attempt cannot conflict with an unresolved prior |
| +action or a worker whose resource use has not been contained. |
| +Claim and cancel update the same step row under the same revision guard. |
| +Cancel clears its holder, increments its fence and sets a non-claimable state; |
| +a concurrent claim cannot revive a cancelled job. Observed grant revocation |
| +triggers this cancel path, and renewal rechecks authority before extension. |
| + |
| +Scheduler startup reconciles attempts, actions and reservations before |
| +admitting replacements. Restoring a database backup starts in quarantine: |
| +no replay or autonomous writes until current grants and outstanding external |
| +effects have been reconciled. A restored local grant must never revive |
| +authority revoked outside that backup. |
| +All starts begin with admission paused and require fresh console validation |
| +of each continuing job grant. Keep a writer-incarnation/clean-shutdown marker |
| +outside the replicated application DB. A missing/mismatched marker or unclean |
| +shutdown enters recovery quarantine; ordinary crash recovery can clear it |
| +after online authority and action reconciliation. Uncertain effects remain |
| +waiting. The CARLOS activator can restore a missing DB automatically, so a |
| +restore test must exercise that path, not just an explicit import command. |
| +If the console authority store itself is restored, invalidate outstanding |
| +grants by rotating its authority epoch before enabling team admission. This |
| +restore procedure is a production release gate, not a claim of existing code. |
| + |
| +## Identity and enforcement |
| + |
| +The console remains the authority for CARLOS membership. The browser uses |
| +the existing same-origin console session and CSRF protection. The console |
| +proxies team requests after account checks; it does not give its cookie or |
| +session signing key to the team service. CLI requests follow the same gates. |
| +Preserve byte-identical scope refusals and the existing owner/fresh-auth order. |
| + |
| +Add an opaque, short-lived delegation and introspection contract to the |
| +console. Bind the delegation to the team-service audience, actor, account, |
| +target and permitted operation; store only its hash. The team service uses a |
| +separate transport identity to introspect it. Introspection checks expiry, |
| +revocation and current membership, and refuses on dependency failure. Do not |
| +trust an account/actor header supplied by the browser or a worker. |
| + |
| +Persistent job grants are separately recorded by an authorized person. They |
| +bind the finite job policy and are rechecked with current account membership |
| +at each broker admission. A normal user can grant only a subset of their own |
| +authority. Account-wide settings and standing autonomous policies require |
| +the account owner. Existing service roles must not silently gain team access. |
| +The new contract needs explicit console/API tests before a live integration. |
| +The console is the authoritative store for job grants and revocations; the |
| +team DB holds references and audit snapshots only. Every action admission |
| +revalidates online. Console failure pauses action admission and does not |
| +affect app serving. Team browser/CLI doors are person-only initially: register |
| +an empty `svcrole.Set{}` and add them to `closedDoors` in `svcroutes_test.go`. |
| +The existing coverage test already supports this exact closed-door list. |
| +Runner and service-introspection endpoints use their own audience-scoped |
| +transport identities; an existing Admin service role is not sufficient. |
| +Registration is only part of the gate: each person-only handler resolves the |
| +person and checks current account membership explicitly. Extend the existing |
| +route test's expected count and wildcard fixtures for new patterns. |
| + |
| +The broker holds connector credentials in protected storage outside worker |
| +filesystems. Workers receive an attempt-scoped broker handle, never a human's |
| +CLI credentials, provider login tokens, production environment or admin keys. |
| +The broker checks account, target, operation, current grant, fence and budget |
| +on every call, including calls suggested by retrieved text. |
| + |
| +Current CARLOS `instance` and `operate` roles are too broad for unattended |
| +read-only diagnostics. Add an explicitly read-only scope/role with a tested |
| +door catalogue, or a narrowly scoped delegation facility. Do not solve this |
| +by handing a worker an existing broad role and relying on its prompt. |
| + |
| +The pilot's allowlist permits repository reads, isolated edits/tests and |
| +broker-mediated publication to its selected review branch. It refuses main |
| +pushes, merge, deploy, credential creation, infrastructure, billing and |
| +customer communication. For remote changes, validate the repository, ref and |
| +candidate hash at the broker; disable untrusted git hooks and credential |
| +helpers in worker checkouts. No unrestricted shell with host network access. |
| +The broker's admitted/dispatching transition is the action's cancellation |
| +boundary. Recheck the current fence and online grant immediately before it; |
| +after that point cancellation reports an in-flight effect. A replacement |
| +cannot redispatch an unresolved logical action under a new key. Persist the |
| +step's intended logical operation identity before asking for execution. |
| +Order admission as follows: introspect Authority outside the DB transaction; |
| +receive its current grant version/epoch and an admission valid for at most |
| +five seconds; then transactionally compare the stored step fence, revision, |
| +locally observed grant version, job state and reservation before writing |
| +dispatching. Expired admissions require fresh introspection. Record the |
| +authority version used. A revocation concurrent with this sequence has a |
| +bounded race window; do not promise instant revocation. Renewals and the next |
| +admission observe it, with at most one lease period of continued local work. |
| + |
| +## Runners and provider connections |
| + |
| +Start with one trusted runner supervisor on one of docs-t1/tito-studio. Both |
| +are possible later placements, not automatically enrolled. A worktree is an |
| +edit boundary; use a tested sandbox to confine code and command execution. |
| +The supervisor controls process lifetime, filesystem mounts, network egress |
| +and CPU/memory/process/disk quotas. Workers cannot reach host HOME, other |
| +jobs, local daemon sockets, metadata services or the supervisor's credentials. |
| +Bind any local service to loopback or the explicitly selected Tailscale IP. |
| + |
| +For the shared-machine pilot, select unprivileged bubblewrap with private |
| +user/mount/PID/network namespaces. Mount only an attempt-scoped broker Unix |
| +socket for permitted external operations; an empty network namespace prevents |
| +direct egress. Verify actual namespace and resource-containment support before |
| +enrolment. Bubblewrap 0.11.0 is installed on docs-t1 and the unprivileged-userns |
| +setting is enabled; this is availability evidence, not an isolation test. |
| +No sudo or new root-managed units are part of this plan. Review CARLOS's |
| +existing isolated-exec implementation (`instancefs`, instance-control and |
| +instance unit templates) for later hosted runners; it is not automatically |
| +available to an unprivileged worker on these machines. |
| + |
| +Use default shared Go build caches where permitted by machine policy; do not |
| +create caches in `/tmp`. Repository code must not gain write access to a |
| +trusted cross-job cache: the runner needs a validated cache-sharing policy or |
| +an isolated writable layer. Scratch goes to disk and is cleaned after each |
| +attempt. Missing isolation is a refusal, not a fallback to an ordinary shell. |
| +Keep the machine's default Go cache unchanged. Expose a prevalidated cache |
| +read-only with an attempt-local writable overlay if needed; any module fetch |
| +uses a separately permitted broker path. Never share worker-writable cache |
| +content as trusted input to another job. |
| + |
| +Provider adapters implement start, streamed events, usage, cancel and resume |
| +capability discovery. Record the actual model and effort; never silently |
| +substitute another provider or send data to an unapproved destination. |
| +Use separate credentials for inference and deployment authority. |
| + |
| +Use officially supported provider authentication. Claude's unmodified CLI can |
| +use its own user-completed sign-in; a custom Claude API integration uses the |
| +user's API/cloud-provider credentials. Never collect subscription session |
| +tokens into the team database. Codex has documented app-server integration; |
| +confirm the chosen authentication mode's eligibility during implementation. |
| +An existing CLI login is not blanket permission to build a hosted credential |
| +relay. Open-weight models implement the same adapter and data-access contract. |
| + |
| +Select the first live adapter only after a capability probe verifies event |
| +format, cancellation, isolated tool execution, usage and authentication. Keep |
| +the provider harness outside the untrusted code sandbox. If tool calls cannot |
| +be intercepted and confined, that adapter is ineligible for autonomous runs. |
| +Remote runners use the same protocol; E2B and EC2 are deferred backend choices. |
| + |
| +The first live pilot uses metered API adapters, with per-request input/output |
| +limits, a currency cap and explicit provider connections. CLI subscription |
| +adapters remain a later capability: a harness that cannot bound its internal |
| +calls cannot claim enforcement of these token/currency ceilings. The native |
| +CLI accounts used to review this design do not authorize live pilot billing. |
| +Each harness has an isolated attempt-specific home/config/session directory; |
| +no user HOME or shared resume history. Credential delivery uses a supported |
| +connection mechanism outside worker reach. Harness transcripts, caches, |
| +provider-hosted session IDs and resume state are included in retention and |
| +deletion. Never resume a provider session into another job/account. |
| + |
| +## Budgets and context |
| + |
| +Reserve capacity before every provider request, tool action and child job. |
| +In one transaction, check both parent-job and account limits against spent |
| +plus reserved use. Settled child usage is charged once to the common ledger. |
| +Lost responses retain their reservation until reconciled. Retries, review, |
| +retrieval, summaries and coordinator turns are included, not hidden overhead. |
| +Reserve the request's maximum allowed usage before dispatch, then settle down |
| +to measured usage. Conversation turns use bounded conversation jobs charged |
| +to the same account ledger even before a software job exists. A restricted, |
| +audited operator settlement can close irreconcilable reservations using a |
| +conservative charge; it never turns unknown use into zero-cost retries. |
| +Accept settlement against an open reservation even after its attempt is |
| +cancelled or expired. Deduplicate settlements by provider receipt so late |
| +usage cannot disappear or be charged twice. |
| + |
| +Initial pilot ceilings, to be explicitly configured before live work: |
| +two concurrent attempts; depth one; two attempts per step; 24 provider calls; |
| +45 minutes per job and 20 per attempt; 200,000 total input tokens and 40,000 |
| +total generated tokens, including reasoning; 32,000 input and 4,000 generated |
| +tokens per call. Reserve those per-call ceilings at the configured prices. |
| +API billing additionally requires a finite currency cap and versioned rate |
| +table. These numbers are proposed ceilings, not authorization to spend. |
| + |
| +An adapter must enforce a bounded request or be refused. Subscription usage |
| +is recorded as calls/tokens/time and reported separately from metered cost; |
| +do not invent a dollar value. If provider accounting cannot establish a hard |
| +financial bound, label the estimate and restrict the live pilot accordingly. |
| +Local cancellation cannot guarantee a provider stopped billing remotely. |
| + |
| +Persist original conversation events, then build each turn from a bounded |
| +recent window, relevant decision records and scoped retrieval. Summaries |
| +retain source references and can be regenerated. Immutable decisions and |
| +grants are never reconstructed from model summaries. A full context window |
| +creates a new bounded model turn, not a new conversation the user must manage. |
| + |
| +Explicit preferences may be reused within their scope. Inferred preferences |
| +remain tentative until confirmed and cannot widen access. Corrections and |
| +deletions invalidate derived summaries and retrieval caches; deletion also |
| +covers replicas/backups according to a documented retention policy. Until |
| +that policy and encryption are implemented, the fixture pilot uses synthetic |
| +data only. Keep secrets and raw customer-support content out of broad memory. |
| +The live manifest classifies repository code and conversation content and |
| +sets retention for artifacts, raw logs, harness state and provider retention. |
| +Encryption and this policy must be verified before real data is connected. |
| + |
| +## Amadan, verification and UI |
| + |
| +Keep execution claims in the scheduler. Amadan discussion claims are visible |
| +work ownership and do not replace fenced worker leases. Publish milestones |
| +through an outbox and show delivery failure. Account/repo bindings and current |
| +access are checked before every read and publication. A remote dependency |
| +closure can make work eligible; it cannot approve an action or enlarge scope. |
| +Outbox delivery uses the same action classification, reservation and |
| +reconcile-before-redeliver path as broker actions. A separate retry loop must |
| +not bypass replay safety or authority checks. |
| + |
| +Start with the configured forge's existing review mechanism. The platform |
| +checkout currently uses Amadan as `origin`; the infrastructure design repo |
| +uses GitHub. Do not hard-code GitHub for every job. A GitHub-backed target |
| +produces a PR; an Amadan-backed target uses its branch/review API. Repository |
| +rules and required CI apply to the exact candidate SHA. No merge in the pilot. |
| +Select Amadan as the first live forge; defer the GitHub adapter. This design |
| +and implementation live in carlos/platform on Amadan, per Paul's direction. |
| +Use a dedicated disclosed agent with writer reach limited to the |
| +pilot repo and no owner grant. Verify effective reach; if available grants |
| +cannot achieve it, add the upstream scope contract before live publication. |
| +Keep that credential in the broker, whose fixed allowlist refuses merge and |
| +default/protected refs. Record default-branch protections in the manifest. |
| + |
| +Include logical operation IDs in published records for reconciliation, but |
| +do not treat a text marker or an eventually consistent list as proof of |
| +absence. Retry a missing result only with an upstream idempotency contract or |
| +definitive outcome evidence; otherwise wait. Payload-rewrite operations such |
| +as claim/attach/task-set need concurrency protection before automated use; |
| +omit them in the first pilot if unavailable. Read-only tracking and creation |
| +of verified review artifacts are sufficient. |
| + |
| +The reviewer receives the brief, base/candidate diff and test evidence in a |
| +fresh context, with read-only tools and a different provider family where |
| +available. It cannot approve its own implementation. Provider unavailability |
| +puts the job in waiting; a fallback needs an existing policy grant. |
| + |
| +Verification executes trusted base-revision check definitions as well as the |
| +candidate's required checks; changing CI configuration must not weaken the |
| +acceptance gate. Record which checks ran, against which commit, and preserve |
| +their exit status and bounded logs. An independent test of the reported |
| +symptom is required, not only tests written alongside the proposed fix. |
| +Publishing can itself trigger CI with broader credentials. The pilot repo |
| +must run branch checks without production/deployment secrets or privileged |
| +untrusted-code access. Freeze trusted CI definitions and review any changes |
| +to CI/hooks before publication; a safe local worker alone does not make |
| +remote CI safe. |
| + |
| +The console view contains the main conversation, work list, job evidence, |
| +cost/usage and decisions requiring attention. Specialists are capabilities; |
| +models and runner controls are optional detail. Existing `team.html` manages |
| +account members and must not be repurposed accidentally. Names and UI copy |
| +remain provisional and go through the normal copy-review workflow when built. |
| +Every shipped CLI verb is API-backed and documented in `docs/site/cli.md`. |
| + |
| +## Later autonomy and acceptance |
| + |
| +Later triggers can consume platform metrics and support signals. Aggregate |
| +and deduplicate them in ordinary code. A standing policy specifies signal, |
| +account/app scope, observation window, cooldown, objective, protected metrics, |
| +budget and allowed action class. Untrusted messages/logs are evidence, never |
| +policy. Recommendations, prepared changes and executable remedies are distinct |
| +permissions. Failed experiments stop; they do not recursively create work. |
| + |
| +Support replies, refunds and account changes need their own connectors and |
| +grants. No existing mail/alert credential becomes customer-support authority. |
| +Measure results against a baseline and include regressions and recurrence. |
| +Automatic rollout requires an independently verified recovery procedure for |
| +that action; data changes are not assumed reversible. |
| + |
| +Accept the first slice only when a fixture bug reaches a correctly scoped |
| +review artifact, and the failure tests in the plan pass. Then measure a small |
| +live batch against the current manual workflow: accepted fixes, human minutes, |
| +elapsed time, total usage/cost, rework and unauthorized-action attempts. |
| +Do not claim savings from a single successful demonstration. |
| + |
| +Before live enrolment, name the account owner who approves the manifest, the |
| +service operator who rotates broker connections and clears quarantine, and |
| +the machine owner responsible for runner limits/cleanup. These are operational |
| +responsibilities; a model cannot assign itself any of them. The ordinary |
| +CARLOS CLI remains available if the team service is unavailable. |
| + |
| +## Evidence inspected |
| + |
| +Local source snapshots: platform `b5b0a53a0da1d9c8c936729fa5c0553e5363f987`; |
| +Amadan `2cb256bb1f0df560fe39245649a76b88d806d155`. These are inspection points, |
| +not claims about deployed versions. Revalidate integration contracts before |
| +implementation against the chosen base. |
| + |
| +- Platform: `internal/console/svcprincipal.go`, `authcli.go`, |
| + `svcscope_test.go`, `alertwatch.go`; `internal/svcrole/svcrole.go`. |
| +- Amadan: `internal/hub/discuss_claim.go`, `discuss_block.go`, |
| + `discuss_attach.go`; CLI help for task, branch review and handoff contracts. |
| +- Private journal: original platform design and service-principal plan. |
| + Historical specs explain intent; current source determines actual reach. |
| +- Provider contracts: |
| + [https://code.claude.com/docs/en/legal-and-compliance](https://code.claude.com/docs/en/legal-and-compliance), |
| + [https://developers.openai.com/siwc/token-sharing-open-source/codex-app-server](https://developers.openai.com/siwc/token-sharing-open-source/codex-app-server). |
| + |
| +The linked audit and review record distinguish verified source findings, |
| +accepted design corrections and gates for later live implementation. |
diff --git a/docs/superpowers/specs/2026-11-01-team-service-integration-audit.md b/docs/superpowers/specs/2026-11-01-team-service-integration-audit.md| new file mode 100644 |
| index 000000000..596d7ec41 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-01-team-service-integration-audit.md |
| @@ -0,0 +1,59 @@ |
| +# Team service integration audit |
| + |
| +Implementation-agent evidence, 2026-11-01. Sonnet (`claude-sonnet-5-5`) |
| +performed a read-only source audit; the coordinating agent checked the |
| +authority, claim and retry findings against the named source files. |
| + |
| +Inspection snapshots: platform `b5b0a53a0da1d9c8c936729fa5c0553e5363f987`; |
| +Amadan `2cb256bb1f0df560fe39245649a76b88d806d155`. These checkouts are not a |
| +statement of what is deployed or the latest remote main. Revalidate before |
| +building adapters. Historical design comments can lag current behaviour. |
| + |
| +| Integration | Existing evidence | Consequence for implementation | |
| +|---|---|---| |
| +| CARLOS principal resolution | `internal/console/svcprincipal.go:CLIPrincipal`, `NewServicePrincipal` | Reuse fixed account/app binding; never borrow the minter's memberships. Existing service tokens use revocation, with no automatic expiry. | |
| +| Route authority | `internal/console/authcli.go:registerCLIRoutes`, `internal/svcrole/svcrole.go` | Closed role catalogue and person-only routes already exist. Register new routes explicitly and test exact reach. | |
| +| Diagnostics | `authcli.go` registrations for logs, errors and analytics | `instance` and `operate` can read these but also perform writes. A read-only autonomous connector needs narrower authority. | |
| +| Fleet metrics | `internal/console/metricsview.go`, `apistatusinstances.go` | Existing metric loading is behind the console; do not grant bucket credentials or use box-local state. Confirm an authorized API shape for any new metric feed. | |
| +| Control-plane release protection | `internal/console/controlplane.go:refuseServiceControlPlane` | Existing service credentials cannot promote/rollback protected apps. Team integration must preserve that restriction. | |
| +| Rate limits | `authcli.go` service create/write/ship limiters | Request-rate limits are not durable job/token/cost budgets. Implement the execution ledger separately. | |
| +| Amadan identity | `internal/hub/cliauth.go`, `agents_api.go` | Use disclosed agent identity and supported grants. Audited agent grants are namespace-wide; workers must not receive these credentials. | |
| +| Work ownership | `internal/hub/discuss_claim.go` | Claim fields identify a holder and time, with no expiry, heartbeat or fence. Keep scheduler leases separate. | |
| +| Dependencies | `internal/hub/discuss_block.go` | Existing dependency and cycle semantics can inform scheduling. Closure is not action authorization. | |
| +| Tasks/reviews/handoffs | `internal/hub/discuss_api.go`, `discuss_assign.go`, `discuss_attach.go` | Reuse published workflow records. Review verdicts are informational; enforce independent verification in the service. | |
| +| Create/reply retry | `internal/hub/discuss_api.go` create/reply/task handlers | No caller operation key found in audited hub paths. A local outbox key alone cannot prevent duplicate remote creates after a lost response. | |
| + |
| +## Findings that require further verification |
| + |
| +The audit did not inspect every CLI path, the repository-instance update |
| +implementation, provider harness isolation, or all temporary-app features. |
| +It cannot establish global absence from a keyword search. |
| + |
| +- Preview/temporary-app support must be inventoried against the selected |
| + implementation base. The pilot can omit previews; do not file a duplicate |
| + feature solely because a route containing the word `preview` was absent. |
| +- Hub claim/handoff updates use read-modify-write. The audit did not establish |
| + whether the repository instance performs additional concurrency checks. |
| + Regardless, these records are not fenced execution leases. |
| +- An Amadan agent namespace token is broader than one repository job. The |
| + broker needs a fixed mapping, a narrow tool surface and a documented |
| + credential blast radius; stronger upstream scopes remain a product gap. |
| +- An independently reported review verdict is not a guarantee of separation |
| + of duties or approval of the exact candidate commit. |
| + |
| +## Audit recommendations not adopted |
| + |
| +The audit suggested temporarily using an app-scoped `instance` credential |
| +for diagnostics and namespace tokens for workers. Those credentials carry |
| +more authority than the pilot requires. The spec instead requires broker |
| +handles and a read-only diagnostic grant before live monitoring. |
| + |
| +The audit also suggested local idempotency keys as a sufficient first step |
| +for remote creates. They are necessary for intent tracking but insufficient |
| +for replay safety. The spec requires upstream idempotency, reconciliation |
| +that proves the outcome, or a waiting state for uncertain results. |
| + |
| +Next dependency work is defined in the |
| +[implementation plan](../plans/2026-11-01-team-service.md). No credentials were |
| +minted, no production operations performed and no source code changed by this |
| +audit. |
diff --git a/docs/superpowers/specs/2026-11-01-team-service-review.md b/docs/superpowers/specs/2026-11-01-team-service-review.md| new file mode 100644 |
| index 000000000..241ec14ca |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-01-team-service-review.md |
| @@ -0,0 +1,75 @@ |
| +# Team service independent review |
| + |
| +Implementation-agent review record, 2026-11-01. |
| + |
| +Integration audit: Sonnet, actual model `claude-sonnet-5-5`. |
| +Architecture reviewer: Fable, actual model `claude-fable-5-1`, high effort. |
| +Both ran through the unmodified Claude CLI with read-only source tools. |
| +No reviewer could edit files, run shell commands or contact live services. |
| +The requested Claude account was selected per process; the default login was |
| +not changed. Credentials and account identifiers are not part of this record. |
| + |
| +## Round 1 |
| + |
| +Fable accepted the local fake-provider prototype with plan corrections and |
| +identified blockers for live access. It found no need to replace the overall |
| +architecture. Disposition against the revised spec and plan: |
| + |
| +| Finding | Resolution | |
| +|---|---| |
| +| Publication credentials and replay | Dedicated repo-limited agent identity; broker enforces refs/operations. Upstream scope gaps block live publication. Markers are positive evidence only; ambiguous outcomes wait. Payload rewrites need concurrency protection. | |
| +| Shared-machine confinement | Select unprivileged bubblewrap with private namespaces and scoped Unix broker socket; prove isolation before live use. Terminate the whole PID namespace/cgroup, including setsid children. | |
| +| Cross-account conversation history | Scope conversation events at write time; inherited source scopes govern summaries and retrieval. First live pilot is single-account. | |
| +| Provider session state | Isolated attempt-specific harness state; retention includes caches, transcripts and provider resume IDs. | |
| +| Subscription accounting mismatch | First live adapters use bounded metered API requests. Subscription CLI support is deferred until its actual enforceable bounds are specified. | |
| +| Restore and revocation | Console owns grants/revocations. Every startup pauses admission; external markers detect uncertainty, online reconciliation precedes resume, console restore rotates authority epoch. | |
| +| Slow fixture sequence | Execute M0, M1 and fixture-M5 first. Live integrations/UI are later gates. | |
| +| Person-only doors | Reuse empty role sets and the existing `closedDoors` test. The review's claim that coverage forbids every empty set was disproved by `svcroutes_test.go:193-213`. No new role vocabulary is needed. | |
| +| Mutable reproduction | Freeze the reproduction by hash outside the implementation workspace and verify that exact artifact. | |
| +| Renewal after expiry | Refuse renewal; require a new claim/fence. | |
| +| Reservation ceilings and stranded usage | Reserve the maximum admitted request; conservative audited settlement for irreconcilable usage. | |
| +| Shared build caches | Preserve machine defaults. Validate read-only caches and attempt-local overlays; no trusted worker-writable cross-job cache. | |
| +| Console runtime dependency | Explicit online authority checks; outages pause admission, not app serving. | |
| +| Real data and retention | Require a live manifest classifying repository/conversation data and covering every retained copy. | |
| +| Forge scope | Amadan is the first live integration; GitHub adapter deferred. Design-repo GitHub PR is a separate existing workflow. | |
| +| Operational responsibility | Live manifest names approver, credential/quarantine operator and runner-machine owner. | |
| + |
| +The coordinating review also added a publication check for remote CI: |
| +branch publication must not run untrusted code with production credentials |
| +or deploy hooks. Trusted check definitions and their hashes are evidence. |
| + |
| +## Round 2 |
| + |
| +Fable returned **ACCEPT** for the design and plan for M0, M1 and the fixture |
| +workflow in M5, and for the later gated milestones. Its exact verdict begins: |
| + |
| +> **Verdict: ACCEPT** the design and plan for the bounded local prototype |
| +> (M0, M1, M5 fixture workflow) and as the contract for the later gated |
| +> milestones. No remaining finding blocks local coding. |
| + |
| +It withdrew the closed-door coverage finding after reading the equality test. |
| +It left transaction/type precision notes for implementation; these are now |
| +also explicit in the spec and plan: |
| + |
| +- Online authority check followed by a transaction over stored fence, |
| + revision, grant version, state and reservation. Admission expires after |
| + five seconds; record the bounded concurrent-revocation window. |
| +- Claim and cancellation update the same step row; cancellation prevents a |
| + subsequent claim from reviving the job. |
| +- A new claim has a new attempt and workspace. Only accepted, hash-verified |
| + checkpoints may cross attempts. |
| +- Reserve a per-call generated-token maximum of 4,000, including reasoning. |
| +- Settle late usage against an open reservation after cancellation or expiry, |
| + without changing the terminal job outcome or double-charging receipts. |
| +- Outbox publication uses the same replay-safety and authority path as other |
| + broker actions. |
| +- Observed revocation cancels the attempt; renewals also recheck authority. |
| +- Skips, missing tests, compile errors and zero test matches are invalid |
| + reproduction evidence. |
| +- The 60-second lease is a deliberate pilot tradeoff; later tuning preserves |
| + fencing. Handler person/membership checks and route-test wildcard/count |
| + updates remain explicit M3 work. |
| + |
| +No live pilot or production operation is authorized by either review. The |
| +review accepts an implementation contract, not an unbuilt system's security |
| +or operational readiness. |
diff --git a/internal/console/apicli.go b/internal/console/apicli.go| index b37cde32e..9f46c68e5 100644 |
| --- a/internal/console/apicli.go |
| +++ b/internal/console/apicli.go |
| @@ -391,11 +391,12 @@ func (s *Server) handleAPICreateApp(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| addr := auditActor(p, acct) |
| - // allowCreate picks the person or the service create budget from the |
| + // allowAppCreate picks the person or the service create budget from the |
| // principal (svcprincipal.go) — a person keyed on the ADDRESS as before |
| // (a token-keyed counter is one the holder of several tokens resets at |
| - // will), a service on its NAME, own budget from the operator's. |
| - if !s.allowCreate(p, time.Now()) { |
| + // will), a service on its NAME, own budget from the operator's. An |
| + // ops-account owner has no limit (#500). |
| + if !s.allowAppCreate(p, time.Now()) { |
| jsonError(w, http.StatusTooManyRequests, |
| "app creation limit reached for today — use the console's New app form") |
| return |
diff --git a/internal/console/apiinteractive_test.go b/internal/console/apiinteractive_test.go| index 16944ad8f..ec2d0cfa3 100644 |
| --- a/internal/console/apiinteractive_test.go |
| +++ b/internal/console/apiinteractive_test.go |
| @@ -422,11 +422,46 @@ func TestInteractiveRefusalsInOrder(t *testing.T) { |
| } |
| } |
| // With the live marker's session gone from the hub, the same request is |
| - // admitted: the walk's world was otherwise whole. |
| + // admitted: the walk's world was otherwise whole. release only dropped |
| + // the hub's copy, so the admission's write still finds Bob's marker in |
| + // the record and owes it an end row of its own: lost, alongside Alice's |
| + // new session ending cancelled. |
| s.interactive.release(liveID) |
| ws := ixStart(t, fx, fx.alice, ixOpenArgv()) |
| + defer ws.Close() |
| + after, _ := ixRecord(t, fx, ixHost) |
| + if after.Interactive == nil || after.Interactive.ID == liveID { |
| + t.Fatalf("the admitted session's marker: %+v, want a fresh id replacing %s", after.Interactive, liveID) |
| + } |
| + newID := after.Interactive.ID |
| ws.Close() |
| - ixWaitEvents(t, fx, "interactive-end", 1) |
| + |
| + // Exactly one end row for each of the two known ids, and nothing else: |
| + // Bob's old marker lost, Alice's new session cancelled. |
| + want := map[string]struct{ reason, by string }{ |
| + liveID: {interactive.EndLost, "bob@keymail.dev"}, |
| + newID: {interactive.EndCancelled, "alice@keymail.dev"}, |
| + } |
| + seen := map[string]bool{} |
| + for _, e := range ixWaitEvents(t, fx, "interactive-end", 2) { |
| + d := ixEndRow(t, e) |
| + if seen[d.ID] { |
| + t.Fatalf("interactive-end: a second row for %s: %+v", d.ID, e) |
| + } |
| + seen[d.ID] = true |
| + w, ok := want[d.ID] |
| + if !ok { |
| + t.Fatalf("interactive-end: unknown id %s: %+v", d.ID, e) |
| + } |
| + if d.Reason != w.reason || e.Address != w.by { |
| + t.Errorf("interactive-end %s: reason %q by %q, want %q by %q", d.ID, d.Reason, e.Address, w.reason, w.by) |
| + } |
| + } |
| + for id := range want { |
| + if !seen[id] { |
| + t.Errorf("interactive-end: no row for %s", id) |
| + } |
| + } |
| } |
| func TestInteractiveOnAHostClaimConsole(t *testing.T) { |
diff --git a/internal/console/authcli_test.go b/internal/console/authcli_test.go| index 8074b5acb..14580fbd8 100644 |
| --- a/internal/console/authcli_test.go |
| +++ b/internal/console/authcli_test.go |
| @@ -675,6 +675,78 @@ func TestPersonBudgetsAreUnchanged(t *testing.T) { |
| } |
| } |
| +// TestOpsOwnerSkipsTheCreateBudget is #500: an owner of the ops account |
| +// creates apps in any account of theirs past cliCreateBurst, because a |
| +// benchmark run signed in as the platform owner ran out of it. Owning some |
| +// other account is not enough: carol owns the same demo account and still |
| +// stops at the ordinary limit. |
| +func TestOpsOwnerSkipsTheCreateBudget(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + const demoID = 4242 |
| + if err := fx.st.CreateAccount(demoID, "cdef", "Demo", "paul@keymail.dev", time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, addr := range []string{"paul@keymail.dev", "carol@keymail.dev"} { |
| + if err := fx.st.AddMember(demoID, addr, RoleOwner, time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + paul := cliToken(t, fx, "paul@keymail.dev", "code-ops-owner-budget") |
| + for i := 0; i < cliCreateBurst+2; i++ { |
| + name := fmt.Sprintf("bench-%d", i) |
| + if status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/cdef/new", map[string]string{"name": name}, paul); status != http.StatusOK { |
| + t.Fatalf("ops owner create %d = %d %v, want no daily limit", i, status, out) |
| + } |
| + } |
| + carol := cliToken(t, fx, "carol@keymail.dev", "code-demo-owner-budget") |
| + for i := 0; i < cliCreateBurst; i++ { |
| + name := fmt.Sprintf("carol-%d", i) |
| + if status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/cdef/new", map[string]string{"name": name}, carol); status != http.StatusOK { |
| + t.Fatalf("demo owner create %d = %d %v", i, status, out) |
| + } |
| + } |
| + status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/cdef/new", map[string]string{"name": "carol-over"}, carol) |
| + if status != http.StatusTooManyRequests { |
| + t.Errorf("demo owner create %d+1 = %d %v, want 429: only ops owners skip the limit", cliCreateBurst, status, out) |
| + } |
| +} |
| + |
| +// TestOpsOwnerExemptionEndsWithOwnership: the exemption is read on every |
| +// create, so an ops owner who is removed from the ops account is back on |
| +// the ordinary budget at once. Exempt creates spent none of it. |
| +func TestOpsOwnerExemptionEndsWithOwnership(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + const demoID = 4242 |
| + if err := fx.st.CreateAccount(demoID, "cdef", "Demo", "dana@keymail.dev", time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, id := range []int64{OpsAccountID, demoID} { |
| + if err := fx.st.AddMember(id, "dana@keymail.dev", RoleOwner, time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + dana := cliToken(t, fx, "dana@keymail.dev", "code-ops-owner-removed") |
| + for i := 0; i < cliCreateBurst+2; i++ { |
| + name := fmt.Sprintf("exempt-%d", i) |
| + if status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/cdef/new", map[string]string{"name": name}, dana); status != http.StatusOK { |
| + t.Fatalf("ops owner create %d = %d %v", i, status, out) |
| + } |
| + } |
| + if err := fx.st.RemoveMember(OpsAccountID, "dana@keymail.dev"); err != nil { |
| + t.Fatal(err) |
| + } |
| + for i := 0; i < cliCreateBurst; i++ { |
| + name := fmt.Sprintf("after-%d", i) |
| + if status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/cdef/new", map[string]string{"name": name}, dana); status != http.StatusOK { |
| + t.Fatalf("create %d after removal = %d %v, want the whole budget left", i, status, out) |
| + } |
| + } |
| + status, out := postJSON(t, fx.ts.URL+"/api/cli/apps/cdef/new", map[string]string{"name": "after-over"}, dana) |
| + if status != http.StatusTooManyRequests { |
| + t.Errorf("create %d+1 after removal = %d %v, want 429", cliCreateBurst, status, out) |
| + } |
| +} |
| + |
| // TestTwoNamedServicesHaveSeparateBudgets is Minor 5 (Task 5 review): two |
| // DIFFERENT named services in one account must not share a budget just |
| // because they share an account — closing this alongside C32's empty-name |
diff --git a/internal/console/fleets_test.go b/internal/console/fleets_test.go| index 117279db8..e14742e66 100644 |
| --- a/internal/console/fleets_test.go |
| +++ b/internal/console/fleets_test.go |
| @@ -16,6 +16,7 @@ import ( |
| "crypto/sha256" |
| "encoding/hex" |
| "errors" |
| + "fmt" |
| "io" |
| "net/http" |
| "net/url" |
| @@ -59,6 +60,25 @@ func openTestReg(t *testing.T, fx *consoleFixture) *registry.Registry { |
| return reg |
| } |
| +// TestFleetCreateKeepsTheBudgetForOpsOwners: #500 lifted the app create |
| +// budget for ops owners, not the fleet one. Fleet names are global and |
| +// have no delete door, so paul (an ops owner) still stops at cliCreateBurst. |
| +func TestFleetCreateKeepsTheBudgetForOpsOwners(t *testing.T) { |
| + fx, token := fleetFixture(t, "code-fleet-budget") |
| + for i := 0; i < cliCreateBurst; i++ { |
| + name := fmt.Sprintf("acme-%d", i) |
| + if status, body := postJSON(t, fleetsURL(fx, fx.sqid)+"/new", |
| + map[string]string{"name": name, "bucket": name + "-data"}, token); status != http.StatusOK { |
| + t.Fatalf("create %s = %d %v, want 200", name, status, body) |
| + } |
| + } |
| + status, body := postJSON(t, fleetsURL(fx, fx.sqid)+"/new", |
| + map[string]string{"name": "acme-over", "bucket": "acme-over-data"}, token) |
| + if status != http.StatusTooManyRequests { |
| + t.Errorf("create %d+1 = %d %v, want 429", cliCreateBurst, status, body) |
| + } |
| +} |
| + |
| // TestFleetCreateListRoundTrip: create, then list, and the created fleet |
| // comes back with an empty (never null) boxes array. |
| func TestFleetCreateListRoundTrip(t *testing.T) { |
diff --git a/internal/console/icons.go b/internal/console/icons.go| index b0ddf2d32..e80849051 100644 |
| --- a/internal/console/icons.go |
| +++ b/internal/console/icons.go |
| @@ -129,11 +129,67 @@ const ( |
| iconFastForward template.HTML = iconOpen + |
| `<polygon points="13 19 22 12 13 5 13 19"/>` + |
| `<polygon points="2 19 11 12 2 5 2 19"/></svg>` |
| + // Lucide: activity. |
| + iconActivity template.HTML = iconOpen + `<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" /></svg>` |
| + |
| + // Lucide: chart-no-axes-combined. |
| + iconChartNoAxesCombined template.HTML = iconOpen + `<path d="M12 16v5" /> <path d="M16 14.639V21" /> <path d="M20 10.656V21" /> <path d="m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15" /> <path d="M4 18.463V21" /> <path d="M8 14.656V21" /></svg>` |
| + |
| + // Lucide: chevron-right. |
| + iconChevronRight template.HTML = iconOpen + `<path d="m9 18 6-6-6-6" /></svg>` |
| + |
| + // Lucide: credit-card. |
| + iconCreditCard template.HTML = iconOpen + `<rect width="20" height="14" x="2" y="5" rx="2" /> <line x1="2" x2="22" y1="10" y2="10" /> <path d="M6 14h2" /></svg>` |
| + |
| + // Lucide: database. |
| + iconDatabase template.HTML = iconOpen + `<ellipse cx="12" cy="5" rx="9" ry="3" /> <path d="M3 5V19A9 3 0 0 0 21 19V5" /> <path d="M3 12A9 3 0 0 0 21 12" /></svg>` |
| + |
| + // Lucide: flag. |
| + iconFlag template.HTML = iconOpen + `<path d="M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528" /></svg>` |
| + |
| + // Lucide: globe. |
| + iconGlobe template.HTML = iconOpen + `<circle cx="12" cy="12" r="10" /> <path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /> <path d="M2 12h20" /></svg>` |
| + |
| + // Lucide: layout-grid. |
| + iconLayoutGrid template.HTML = iconOpen + `<rect width="7" height="7" x="3" y="3" rx="1" /> <rect width="7" height="7" x="14" y="3" rx="1" /> <rect width="7" height="7" x="14" y="14" rx="1" /> <rect width="7" height="7" x="3" y="14" rx="1" /></svg>` |
| + |
| + // Lucide: mail. |
| + iconMail template.HTML = iconOpen + `<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" /> <rect x="2" y="4" width="20" height="16" rx="2" /></svg>` |
| + |
| + // Lucide: server. |
| + iconServer template.HTML = iconOpen + `<rect width="20" height="8" x="2" y="2" rx="2" ry="2" /> <rect width="20" height="8" x="2" y="14" rx="2" ry="2" /> <line x1="6" x2="6.01" y1="6" y2="6" /> <line x1="6" x2="6.01" y1="18" y2="18" /></svg>` |
| + |
| + // Lucide: shield. |
| + iconShield template.HTML = iconOpen + `<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" /></svg>` |
| + |
| + // Lucide: sliders-horizontal. |
| + iconSlidersHorizontal template.HTML = iconOpen + `<path d="M10 5H3" /> <path d="M12 19H3" /> <path d="M14 3v4" /> <path d="M16 17v4" /> <path d="M21 12h-9" /> <path d="M21 19h-5" /> <path d="M21 5h-7" /> <path d="M8 10v4" /> <path d="M8 12H3" /></svg>` |
| + |
| + // Lucide: trash. |
| + iconTrash template.HTML = iconOpen + `<path d="M10 11v6" /> <path d="M14 11v6" /> <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" /> <path d="M3 6h18" /> <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></svg>` |
| + |
| + // Lucide: users. |
| + iconUsers template.HTML = iconOpen + `<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /> <path d="M16 3.128a4 4 0 0 1 0 7.744" /> <path d="M22 21v-2a4 4 0 0 0-3-3.87" /> <circle cx="9" cy="7" r="4" /></svg>` |
| ) |
| // icons maps each Lucide slug to its vendored markup. Slugs are the Lucide |
| // names so the mapping back to lucide.dev stays obvious. |
| var icons = map[string]template.HTML{ |
| + "activity": iconActivity, |
| + "chart-no-axes-combined": iconChartNoAxesCombined, |
| + "chevron-right": iconChevronRight, |
| + "credit-card": iconCreditCard, |
| + "database": iconDatabase, |
| + "flag": iconFlag, |
| + "globe": iconGlobe, |
| + "layout-grid": iconLayoutGrid, |
| + "mail": iconMail, |
| + "server": iconServer, |
| + "shield": iconShield, |
| + "sliders-horizontal": iconSlidersHorizontal, |
| + "trash": iconTrash, |
| + "users": iconUsers, |
| + |
| "external-link": iconExternalLink, |
| "chevron-down": iconChevronDown, |
| "check": iconCheck, |
diff --git a/internal/console/icons_test.go b/internal/console/icons_test.go| index 89fbe3ada..e626a31d6 100644 |
| --- a/internal/console/icons_test.go |
| +++ b/internal/console/icons_test.go |
| @@ -205,12 +205,13 @@ func TestVendoredIconsAreSelfContained(t *testing.T) { |
| t.Errorf("icon %q reaches outside the page (%q): %s", slug, bad, s) |
| } |
| } |
| - // No width/height of their own: they size from the .icon CSS rule so |
| - // one icon at a 0.9rem menu row and the same icon in body text are the |
| - // same shape at two sizes, not two hand-tuned copies. (The leading |
| - // space is what keeps stroke-width, a different thing entirely, out |
| - // of this check.) |
| - if strings.Contains(s, " width=") || strings.Contains(s, " height=") { |
| + // CSS sizes the outer SVG. Shapes inside its viewBox, such as rect, |
| + // need their own dimensions to draw the icon. |
| + opening, _, ok := strings.Cut(s, ">") |
| + if !ok { |
| + t.Fatalf("icon %q has no opening SVG tag: %s", slug, s) |
| + } |
| + if strings.Contains(opening, " width=") || strings.Contains(opening, " height=") { |
| t.Errorf("icon %q hardcodes a size instead of sizing from the text: %s", slug, s) |
| } |
| } |
diff --git a/internal/console/mobilenav_test.go b/internal/console/mobilenav_test.go| index 4d9b3a342..fa066772a 100644 |
| --- a/internal/console/mobilenav_test.go |
| +++ b/internal/console/mobilenav_test.go |
| @@ -10,7 +10,8 @@ import ( |
| ) |
| var ( |
| - indexLinkRE = regexp.MustCompile(`<a id="nav-([^"]+)" href="([^"]+)"[^>]*>([^<]+)</a>`) |
| + indexLinkRE = regexp.MustCompile(`(?s)<a id="nav-([^"]+)" href="([^"]+)"[^>]*>(.*?)</a>`) |
| + indexLabelRE = regexp.MustCompile(`<span class="index-label">([^<]+)</span>`) |
| mobileBackRE = regexp.MustCompile(`<div class="mobile-back"><a href="([^"]+)" rel="up">([^<]+)</a></div>`) |
| mobileHeadRE = regexp.MustCompile(`<h1 class="mobile-title">([^<]+)</h1>`) |
| ) |
| @@ -34,7 +35,11 @@ func indexRows(t *testing.T, body string) []indexRow { |
| } |
| var rows []indexRow |
| for _, m := range indexLinkRE.FindAllStringSubmatch(list, -1) { |
| - rows = append(rows, indexRow{m[1], html.UnescapeString(m[2]), html.UnescapeString(m[3])}) |
| + label := indexLabelRE.FindStringSubmatch(m[3]) |
| + if len(label) != 2 { |
| + t.Fatalf("index row %q has no label: %s", m[1], m[3]) |
| + } |
| + rows = append(rows, indexRow{m[1], html.UnescapeString(m[2]), html.UnescapeString(label[1])}) |
| } |
| return rows |
| } |
| @@ -302,9 +307,9 @@ func TestPhoneViewStyle(t *testing.T) { |
| if blk := cssBlock(t, body, "body[data-view] header :is(.switcher, .brand, .account-links)"); !strings.Contains(blk, "display: none") { |
| t.Errorf("a phone account page still shows the header nav: %s", blk) |
| } |
| - for _, sel := range []string{".index-nav a", ".mobile-back a"} { |
| - if blk := cssBlock(t, body, sel); !strings.Contains(blk, "min-height: 2.75rem") { |
| - t.Errorf("%s is under the 44px touch target: %s", sel, blk) |
| + for sel, height := range map[string]string{".index-nav a": "3.75rem", ".mobile-back a": "2.75rem"} { |
| + if blk := cssBlock(t, body, sel); !strings.Contains(blk, "min-height: "+height) { |
| + t.Errorf("%s is missing its %s minimum touch target: %s", sel, height, blk) |
| } |
| } |
| } |
diff --git a/internal/console/svcprincipal.go b/internal/console/svcprincipal.go| index 12a1c1482..7d5214c93 100644 |
| --- a/internal/console/svcprincipal.go |
| +++ b/internal/console/svcprincipal.go |
| @@ -591,6 +591,22 @@ func (s *Server) allowCreate(p Principal, now time.Time) bool { |
| return s.cli.svcCreate.allow(principalKey(p), now) |
| } |
| +// allowAppCreate is allowCreate for app creation, where an owner of the |
| +// ops account skips the person budget (#500). The budget is a ceiling on a |
| +// stolen token, and the platform owner's token already carries the whole |
| +// platform; their benchmark runs create dozens of apps a day on demo |
| +// accounts. Apps only: fleet names are global with no delete door, so |
| +// fleet creation keeps allowCreate as it is. A store error is not an |
| +// exemption, and an exempt create spends nothing. |
| +func (s *Server) allowAppCreate(p Principal, now time.Time) bool { |
| + if p.Kind == PrincipalUser { |
| + if role, err := s.store.Role(OpsAccountID, p.Address); err == nil && role == RoleOwner { |
| + return true |
| + } |
| + } |
| + return s.allowCreate(p, now) |
| +} |
| + |
| // allowTemporaryCreate is /new-temporary's budget: one limiter for both |
| // principal kinds, keyed like allowCreate (principalKey), separate from it |
| // so neither kind of create spends the other's day. |
diff --git a/internal/console/templates/appmark.html b/internal/console/templates/appmark.html| new file mode 100644 |
| index 000000000..18806a0c6 |
| --- /dev/null |
| +++ b/internal/console/templates/appmark.html |
| @@ -0,0 +1 @@ |
| +{{define "app_mark"}}<span class="app-mark" aria-hidden="true">{{if .}}{{printf "%.1s" .}}{{else}}{{icon "layers"}}{{end}}</span>{{end}} |
diff --git a/internal/console/templates/apps.html b/internal/console/templates/apps.html| index e70c9caaa..a27c28f15 100644 |
| --- a/internal/console/templates/apps.html |
| +++ b/internal/console/templates/apps.html |
| @@ -12,7 +12,7 @@ |
| <tr class="app-head" role="row"><th role="columnheader" scope="col">App</th><th role="columnheader" scope="col">Running at</th><th role="columnheader" scope="col">{{$.RegionCopy.PickerLabel}}</th><th role="columnheader" scope="col">Health</th><th role="columnheader" scope="col">{{$.StatusCopy.ObservedLabel}}</th></tr> |
| {{range .Apps}} |
| <tr role="row" data-app-row> |
| - <td role="cell" class="app-name"><a href="{{$.Nav}}/apps/{{.App}}">{{.App}}</a></td> |
| + <td role="cell" class="app-name"><a href="{{$.Nav}}/apps/{{.App}}">{{template "app_mark" .App}}<span class="app-label">{{.App}}</span></a></td> |
| <td role="cell" class="app-host">{{if .URL}}<a href="https://{{.URL}}">{{.URL}}</a>{{else}}—{{end}}</td> |
| <td role="cell" class="app-region">{{if .Region.Known}}{{.Region.Text}}{{range .Elsewhere}}<br><span class="small">{{.Line}}</span>{{end}}{{else}}—{{end}}</td> |
| <td role="cell" class="app-health"><span class="chip chip-health-{{.Verdict}}">{{.VerdictLabel}}</span></td> |
| @@ -24,6 +24,8 @@ |
| <style> |
| .app-list .app-meta-label { display: none; } |
| .app-list tr[data-app-row] { position: relative; } |
| +.app-list .app-name a { display: inline-flex; align-items: center; gap: 0.65rem; max-width: 100%; min-height: 44px; } |
| +.app-label { min-width: 0; overflow-wrap: anywhere; } |
| .app-list .app-name a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--rst-radius-sm); } |
| .app-list .app-name a:focus-visible { outline: none; } |
| .app-list .app-name a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; } |
| @@ -32,6 +34,7 @@ |
| .app-list tr[data-app-row]:has(.app-name a:hover) { background: var(--accent-soft); } |
| } |
| @media (max-width: 800px) { |
| +.tablewrap.app-list .app-mark { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; } |
| .tablewrap.app-list { overflow: visible; } |
| .tablewrap.app-list > table { display: block; width: 100%; margin: 0; } |
| .tablewrap.app-list > table > tbody { display: block; } |
| @@ -40,7 +43,8 @@ |
| .tablewrap.app-list > table > tbody > tr[data-app-row]:last-child { border-bottom: 0; } |
| .tablewrap.app-list > table tr[data-app-row] > td { display: block; min-width: 0; margin: 0; padding: 0; border: 0; overflow-wrap: anywhere; white-space: normal; } |
| .tablewrap.app-list > table tr[data-app-row] > td.app-name { grid-area: name; padding-left: 0; font-size: 17px; line-height: 24px; font-weight: 600; } |
| -.tablewrap.app-list td.app-name a, .tablewrap.app-list td.app-host a { display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; overflow-wrap: anywhere; } |
| +.tablewrap.app-list td.app-name a { display: inline-flex; align-items: center; gap: 0.65rem; max-width: 100%; min-height: 44px; overflow-wrap: anywhere; } |
| +.tablewrap.app-list td.app-host a { display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; overflow-wrap: anywhere; } |
| .tablewrap.app-list td.app-name a { font-size: 17px; font-weight: 600; text-decoration: none; } |
| .tablewrap.app-list > table tr[data-app-row] > td.app-host { grid-area: host; font-size: 13px; line-height: 1.4; color: var(--muted); } |
| .tablewrap.app-list > table tr[data-app-row] > td.app-health { grid-area: health; align-self: center; font-size: 12px; line-height: 20px; } |
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html| index e33cfcf1e..c884d723c 100644 |
| --- a/internal/console/templates/layout.html |
| +++ b/internal/console/templates/layout.html |
| @@ -493,13 +493,13 @@ |
| .settings-nav a { white-space: nowrap; } |
| .settings-content { padding: 1rem 1rem 0.25rem; } |
| .flow-line { display: block; } |
| - .flow-stage + .flow-stage { margin-top: 1.6rem; } |
| + .flow-stage + .flow-stage { margin-top: 2.25rem; } |
| .flow-stage + .flow-stage::before { |
| - left: 1rem; top: -1.2rem; width: 0; height: 0.85rem; |
| + left: 1rem; top: -1.75rem; width: 0; height: 0.85rem; |
| border-top: 0; border-left: 1px dashed var(--wire); |
| } |
| .flow-stage + .flow-stage::after { |
| - left: 1rem; top: -0.34rem; transform: translateX(-50%); |
| + left: 1rem; top: -0.9rem; transform: translateX(-50%); |
| border: 0.28rem solid transparent; border-bottom: 0; border-top-color: var(--wire); |
| border-left-color: transparent; |
| } |
| @@ -1044,10 +1044,30 @@ |
| .index-nav { display: flex; flex-direction: column; max-width: 32rem; margin: 0 0 2rem; border: 1px solid var(--rule); border-radius: var(--rst-radius); background: var(--bg); box-shadow: var(--shadow-module); overflow: hidden; } |
| .index-nav a:last-child { border-bottom: 0; } |
| .index-nav a { |
| - display: flex; align-items: center; min-height: 2.75rem; box-sizing: border-box; |
| - padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--rule); |
| + display: flex; align-items: center; box-sizing: border-box; |
| + gap: 0.75rem; min-height: 3.75rem; padding: 0.75rem 0.875rem; border-bottom: 1px solid var(--rule); |
| color: var(--ink); text-decoration: none; overflow-wrap: anywhere; |
| } |
| + .index-context { display: flex; align-items: center; gap: 0.875rem; max-width: 32rem; margin: 0.25rem 0 1.5rem; } |
| + .index-context-copy { min-width: 0; } |
| + .index-context h1 { margin: 0; } |
| + .index-context .eyebrow { margin: 0 0 0.25rem; font-size: 0.7rem; overflow-wrap: anywhere; } |
| + .index-meta { margin: 0.375rem 0 0; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; } |
| + .index-meta code { font-size: 0.75rem; } |
| + .app-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 0.6rem; font: 600 1rem/1 var(--mono); text-transform: uppercase; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--rack-edge); box-shadow: var(--shadow-raised); } |
| + .app-mark .icon { width: 1rem; height: 1rem; } |
| + .index-context > .app-mark { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; } |
| + .index-context-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 2.75rem; height: 2.75rem; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--rack-edge); border-radius: 0.75rem; box-shadow: var(--shadow-raised); } |
| + .index-context-icon .icon { width: 1.4rem; height: 1.4rem; } |
| + .index-nav .index-icon { display: flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 0.5rem; background: light-dark(#f0e4ef, #382435); color: var(--accent-strong); box-shadow: inset 0 1px 0 var(--rst-depth-hl), 0 1px 1px var(--rst-depth-ambient); } |
| + .index-nav .index-icon .icon { width: 1.125rem; height: 1.125rem; } |
| + .index-label { flex: 1; min-width: 0; } |
| + .index-chevron { display: flex; flex: none; color: var(--muted); opacity: 0.65; } |
| + .index-chevron .icon { width: 1rem; height: 1rem; } |
| + .index-nav :is(.index-key-fleet, .index-key-instances, .index-key-placement, .index-key-domains, .index-key-email) .index-icon { background: light-dark(#e4edf9, #1e3049); color: light-dark(#32629c, #9cbfee); } |
| + .index-nav :is(.index-key-team, .index-key-availability, .index-key-protection, .index-key-storage) .index-icon { background: light-dark(#e1f0ed, #1b3833); color: light-dark(#28685e, #99d2c5); } |
| + .index-nav :is(.index-key-settings, .index-key-general, .index-key-logs, .index-key-environments) .index-icon { background: light-dark(#ececf0, #2c2d34); color: var(--muted); } |
| + .index-nav .index-key-delete .index-icon { background: light-dark(#f7e9e8, #3b2425); color: var(--bad); } |
| /* The box clips to its rounded corners, so the end rows take the same |
| curve (their background and focus ring follow it) and the ring sits |
| 3px inside, where the clip cannot reach it. */ |
diff --git a/internal/console/templates/navindex.html b/internal/console/templates/navindex.html| index 8b0b57626..87a153b82 100644 |
| --- a/internal/console/templates/navindex.html |
| +++ b/internal/console/templates/navindex.html |
| @@ -1,17 +1,32 @@ |
| +{{define "index_icon"}}{{if eq .Key "apps"}}{{icon "layout-grid"}}{{else if eq .Key "fleet"}}{{icon "server"}}{{else if eq .Key "team"}}{{icon "users"}}{{else if eq .Key "settings"}}{{icon "sliders-horizontal"}}{{else if eq .Key "billing"}}{{icon "credit-card"}}{{else if eq .Key "overview"}}{{icon "layout-grid"}}{{else if eq .Key "instances"}}{{icon "server"}}{{else if eq .Key "releases"}}{{icon "layers"}}{{else if eq .Key "logs"}}{{icon "menu"}}{{else if eq .Key "errors"}}{{icon "triangle-alert"}}{{else if eq .Key "availability"}}{{icon "activity"}}{{else if eq .Key "analytics"}}{{icon "chart-no-axes-combined"}}{{else if eq .Key "protection"}}{{icon "shield"}}{{else if eq .Key "activity"}}{{icon "activity"}}{{else if eq .Key "general"}}{{icon "sliders-horizontal"}}{{else if eq .Key "domains"}}{{icon "globe"}}{{else if eq .Key "placement"}}{{icon "server"}}{{else if eq .Key "pipeline"}}{{icon "layers"}}{{else if eq .Key "environments"}}{{icon "layers"}}{{else if eq .Key "storage"}}{{icon "database"}}{{else if eq .Key "email"}}{{icon "mail"}}{{else if eq .Key "features"}}{{icon "flag"}}{{else if eq .Key "errors-analytics"}}{{icon "activity"}}{{else if eq .Key "delete"}}{{icon "trash"}}{{else if eq .Key "new"}}{{icon "plus"}}{{else}}{{icon "layers"}}{{end}}{{end}} |
| {{define "nav_index"}}{{template "top" .}} |
| {{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}} |
| {{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}} |
| -{{if or (eq .IndexOf "account") (eq .IndexOf "accounts")}} |
| -<h1 id="index-title">{{if eq .IndexOf "accounts"}}Accounts{{else}}{{.Account.Name}}{{end}}</h1> |
| -<nav class="index-nav" aria-labelledby="index-title"> |
| -{{else}} |
| -<div class="pagehead"> |
| - <p class="eyebrow">App · {{.Account.Name}}</p> |
| - <h1>{{if eq .IndexOf "settings"}}Settings{{else}}{{.AppName}}{{end}}</h1> |
| +<div class="index-context"> |
| + {{if eq .IndexOf "accounts"}}<span class="index-context-icon" aria-hidden="true">{{icon "user-round"}}</span>{{else if eq .IndexOf "account"}}<span class="index-context-icon" aria-hidden="true">{{icon "layers"}}</span>{{else}}{{template "app_mark" .AppName}}{{end}} |
| + <div class="index-context-copy"> |
| + {{if eq .IndexOf "accounts"}} |
| + <h1 id="index-title">Accounts</h1> |
| + <p class="index-meta">{{.Address}}</p> |
| + {{else if eq .IndexOf "account"}} |
| + <p class="eyebrow">Account</p> |
| + <h1 id="index-title">{{.Account.Name}}</h1> |
| + <p class="index-meta"><code>{{.Account.Sqid}}</code><span aria-hidden="true"> · </span>{{.Role}}</p> |
| + {{else if eq .IndexOf "settings"}} |
| + <p class="eyebrow">{{.Account.Name}} · {{.AppName}}</p> |
| + <h1 id="index-title">Settings</h1> |
| + {{else}} |
| + <p class="eyebrow">App · {{.Account.Name}}</p> |
| + <h1 id="index-title">{{.AppName}}</h1> |
| + {{end}} |
| + </div> |
| </div> |
| -<nav class="index-nav" aria-label="{{if eq .IndexOf "settings"}}Settings sections{{else}}App sections{{end}}"> |
| -{{end}} |
| - {{range .IndexLinks}}<a id="nav-{{.Key}}" href="{{.Href}}">{{.Label}}</a> |
| +<nav class="index-nav" {{if or (eq .IndexOf "accounts") (eq .IndexOf "account")}}aria-labelledby="index-title"{{else}}aria-label="{{if eq .IndexOf "settings"}}Settings sections{{else}}App sections{{end}}"{{end}}> |
| + {{range .IndexLinks}}<a id="nav-{{.Key}}" href="{{.Href}}" class="index-row index-key-{{.Key}}"> |
| + <span class="index-icon" aria-hidden="true">{{template "index_icon" .}}</span> |
| + <span class="index-label">{{.Label}}</span> |
| + <span class="index-chevron" aria-hidden="true">{{icon "chevron-right"}}</span> |
| + </a> |
| {{end}} |
| </nav> |
| {{template "bottom" .}}{{end}} |
diff --git a/internal/edge/localhold_probed_test.go b/internal/edge/localhold_probed_test.go| index 20feb2257..190f252a8 100644 |
| --- a/internal/edge/localhold_probed_test.go |
| +++ b/internal/edge/localhold_probed_test.go |
| @@ -381,10 +381,25 @@ func TestProbedDeadlineMidPassDoesNotEject(t *testing.T) { |
| } |
| func TestProbedHoldSurvivesReload(t *testing.T) { |
| - a := deadAddr(t) |
| var hits atomic.Int64 |
| - e, srv := probedEdge(t, []string{a}, fastHealth(), probedHold()) |
| - listenLater(t, a, 200*time.Millisecond, countingHandler(&hits)) |
| + // The upstream stays bound for the whole test: releasing a port and |
| + // rebinding it later lets another process take it in between. The dialer |
| + // refuses until up flips, which stands in for the upstream not listening. |
| + upstream := httptest.NewServer(countingHandler(&hits)) |
| + defer upstream.Close() |
| + a := upstream.Listener.Addr().String() |
| + var up atomic.Bool |
| + var plain net.Dialer |
| + hold := probedHold() |
| + hold.dialer = func(ctx context.Context, network, addr string) (net.Conn, error) { |
| + if !up.Load() { |
| + return nil, refusedErr() |
| + } |
| + return plain.DialContext(ctx, network, addr) |
| + } |
| + e, srv := probedEdge(t, []string{a}, fastHealth(), hold) |
| + avail := time.AfterFunc(200*time.Millisecond, func() { up.Store(true) }) |
| + defer avail.Stop() |
| reloaded := make(chan error, 1) |
| go func() { |
| time.Sleep(100 * time.Millisecond) |