Skip to content

apps server operator capabilities and auth

bondiano edited this page Nov 12, 2026 · 1 revision

Operator capabilities and auth

Active contributors: Vassiliy Kuzenkov.

The server distinguishes configured automation clients, GitHub users and signed integration requests. Repository roles gate shared decisions, while reader sessions keep tour progress and follow-up exchanges private. This page explains implementation boundaries; use the API reference for the full route/DTO contract.

Identity and repository access

flowchart TD
    Bearer["Configured bearer token"] --> Client["Client identity and configured repository scope"]
    OAuth["GitHub OAuth callback"] --> Person["Person identity and sign-in grants"]
    Cookie["Stored session-token digest"] --> Kind["Client or person session"]
    Kind --> Client
    Kind --> Person
    Client --> Scope["Tenant, connection, repository and required role"]
    Person --> Scope
    Scope --> Read["Reader action: stored grants"]
    Scope --> Change["Repository decision by person: current GitHub permission"]
    Scope --> Private["Reader's own progress/exchange"]
Loading

Caller in crates/sych-app/src/server/caller.rs prioritizes an explicit bearer token, otherwise reads the sych_session cookie. Client tokens are compared in constant time. Client access is constrained by tenant, role and configured connection/owner/name scopes or *.

GitHub sign-in uses a connection's App user-authorization settings. A short-lived state cookie binds the callback to the browser; a validated return path remains under /ui/. The user token is used for sign-in identity/repository reads and then dropped, not saved as a long-lived user credential.

Server sessions last eight hours. The browser holds a random token in an HttpOnly, SameSite=Lax cookie, Secure when configured for HTTPS; storage holds its SHA-256 digest. /auth/token can create a session acting as a configured API client. Removing that client from configuration invalidates its sessions.

GitHub repository role Server role
admin, maintain Maintainer
write Writer
triage Triage
read Reader

Reads use the person's grants captured at sign-in. Repository-changing actions requiring more than reader access recheck current collaborator permission with GitHub, rather than relying only on an eight-hour-old grant. Reader-owned tour progress and private exchanges deliberately use reader access. Custom/unrecognized levels do not create additional server roles.

Foreign repositories are absent from lists and return 404 by ID. Caller::scope and views::readable are complementary: checking a general role is not enough without checking the resource or filtering the list.

Browser writes and request identity

Cookie-authenticated non-GET/HEAD requests require an Origin matching the configured public origin. Bearer authentication is separate from cookie-origin validation. Deployment and all trust controls are covered in Security.

State-changing command handlers use api::idempotent. Its key is scoped by tenant, actor and endpoint; the digest also includes path resource identity and raw body. A repeat replays the stored response, a different body/target conflicts, and an unfinished request returns REQUEST_IN_PROGRESS. This prevents a successful request retry from deliberately creating another generation; it is not a general exactly-once transaction across all external work.

Not every HTTP POST is a shared mutation: handoff only computes a package from a stored result. Authentication routes and signed webhooks/slash commands have their own contracts.

Capability map

Capability Minimum access and important boundary
Read repositories, changes, results, snapshots, finding history, analytics or usage Reader, filtered to accessible repositories
Request/rerun/cancel review; inspect jobs; authorize publication recreation Writer on the repository; committed results remain immutable
Record finding feedback Triage; see Findings and policy
Create/revoke waiver or record suggestion decision Maintainer on the repository
Start playground review Maintainer and an enabled tenant playground budget
Read/reveal/finish tour, record fact, ask comprehension question, export handoff Reader; private session or read-only output
Record tour risk decision Maintainer; creates the same scoped waiver as the waiver API
Read administration Configured maintainer client of *, not a GitHub person

Manual requests in crates/sych-app/src/server/requests.rs reread current PR state and refuse a closed change. Publication requires both the request and trusted connection to permit it. A deep request selects the deep role route where configured, not a new unbounded budget; an explicitly pinned model profile takes precedence.

Local sych publish, sych cancel and sych rerun act as configured API clients with the required role and repository scope. sych reconcile --allow-create records an audited duplicate-risk decision rather than claiming the prior write never happened. The publication page explains eligibility and recovery.

Playground

A playground try reviews current PR inputs and current target-tip policy with the default or deep profile. It uses the same job machinery but records mode = PLAYGROUND:

  • It does not advance desired generation or supersede normal reviews; later pushes do not supersede it by generation.
  • It cannot publish, including through a later explicit publish command.
  • It contributes no finding lineage and is omitted from the change's review revisions, review analytics/totals, weekly report and run metrics.
  • Its real jobs, model attempts and spend still count in operational and budget accounting.

The handler requires budgets.playground_daily.max_cost_micro_usd; otherwise an authorized maintainer receives PLAYGROUND_DISABLED. The dedicated tenant-wide daily pool supplements normal run/tenant caps, rather than replacing them. Creation is audited as PLAYGROUND_REQUESTED; readable tries are listed separately, newest 50.

Private tours, questions and handoff

crates/sych-app/src/server/tours.rs reads an already stored tour, newest or explicitly named. It does not generate one on GET. Answers remain hidden until the caller reveals them; progress is keyed by caller actor. Completing/dismissing a tour is never approval and is not published.

The returned view marks a tour stale if the result revision differs or a newer normal review generation exists. It returns code references rather than source bodies. Pruned tour data is an explicit TOUR_UNAVAILABLE conflict, not an empty tour.

crates/sych-app/src/server/questions.rs dispatches step-bound follow-ups:

Kind Execution and meaning
COMPREHENSION Calls the configured models over the run's pinned mirror source under budgets.followup_session; needs an engine and available source
FACT_REQUEST Stores the caller's human statement, not independently verified evidence
RISK_DECISION Validates maintainer access and waiver terms, records a repository waiver, then records the private exchange

Exchanges belong to that actor and do not rewrite the tour, result or obligation assessments. Comprehension can fail with SOURCE_UNAVAILABLE or NO_ANSWER; missing execution capability is a dependency error. A risk decision's exchange is private, but the waiver it creates is a shared repository risk decision.

crates/sych-app/src/server/handoff.rs packages selected findings from the committed result as handoff@1, without inference or publication. It rejects foreign findings and optional snapshot mismatches. It neither applies a fix nor grants an authoring agent permission to change the review. See Tours and handoff for the underlying artifacts and CLI workflow.

Administration and operational visibility

crates/sych-app/src/server/admin.rs restricts tenant-wide views to maintainer clients scoped to *. These views include configured connections/build pins, admission decisions without payloads, redacted startup configuration and digest sends. A human GitHub maintainer is not automatically a tenant operator.

Job views require writer access; unresolved publication views require reader access. Audit reads show repository actions only where the caller maintains them. Actions without a single repository, such as sign-in, are visible only to a tenant-wide operator. Audit records are retained rather than treated as ordinary prunable history.

Health probes are unauthenticated: liveness reports process life; readiness tests database access and a writable artifact directory, not model/provider readiness. The main /metrics route checks the peer IP against metrics_allow, not forwarded headers. An optional SYCH_METRICS_BIND listener serves only metrics without that allowlist and must be isolated by deployment policy. See Monitoring and Deployment.

The explicit sych doctor --scm-smoke path in crates/sych-app/src/server/smoke.rs creates, reads, updates, finds and deletes a marked comment. It is a real external write test, not a passive health probe.

Key source files

File Responsibility
crates/sych-app/src/server/caller.rs Authentication extraction, roles, origin and repository checks
crates/sych-app/src/server/auth.rs OAuth/browser sessions, token exchange, logout and /v1/me
crates/sych-adapters/src/github/oauth.rs GitHub user token exchange and accessible-repository reads
crates/sych-app/src/server/api.rs Shared request validation/idempotency and review/feedback/waiver handlers
crates/sych-app/src/server/requests.rs Current-state manual/playground generation
crates/sych-app/src/server/playground.rs Playground authorization, budget enablement and separate listing
crates/sych-app/src/server/tours.rs Private progress, answer reveal and stale detection
crates/sych-app/src/server/questions.rs Step follow-ups, pinned-source comprehension and waiver reuse
crates/sych-app/src/server/handoff.rs Read-only selected-finding package
crates/sych-app/src/server/admin.rs Tenant-wide operator-only reads
crates/sych-app/src/server/queue.rs Jobs, unresolved publications and audited recreation request
crates/sych-app/src/server/ui.rs Same-origin static dashboard delivery and response headers

Change entry points

  • Extend authorization in Caller, then test revoked permissions, cross-repository visibility and cookie origin behavior in crates/sych-app/tests/auth.rs and crates/sych-app/tests/api.rs.
  • Add operator pages through scoped view handlers; use crates/sych-app/tests/admin.rs and crates/sych-app/tests/queue.rs to distinguish client operators from GitHub people.
  • Preserve playground exclusion and real cost accounting with crates/sych-app/tests/playground.rs.
  • Change reader workflows with crates/sych-app/tests/tour_questions.rs and crates/sych-app/tests/handoff.rs; coordinate UI changes through the dashboard.

Counts and byline scope are defined in the server inventory.

Clone this wiki locally