Skip to main content
Blitz
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage
Edit page

021 · Service

The per-user service and its API (spec_021_service)

Status Implemented. Reverse-engineered from 53f8c53 (2026-09-24) and kept with the code since; its paths checked 2026-09-27 (//tools/specs).
Source proto/blitz/v1/{session,workspace,turn,worker}.proto, buf.yaml, buf.gen.yaml; apps/service/main.go (blitzd), pkg/service/service.go, pkg/service/server/*.go, pkg/service/servicetest; pkg/socket; proto (generated, never edited); apps/cli/service.go
Tests apps/service/*_test.go, pkg/service/service_test.go, pkg/service/server/*_test.go, apps/cli/attach_test.go, service_test.go
Depends on spec_018_workspace
Used by spec_022_client, spec_023_workers, spec_024_desktop

1. Purpose

blitzd, its own program (apps/service), runs one engine process per user that holds every workspace a client opens, runs scheduled jobs, and exposes api.Backend over Connect (gRPC, gRPC-Web or plain JSON) on a Unix socket. The CLI and the desktop app share one copy of each workspace through it. Handlers only translate between protos and pkg/engine; they hold no logic.

  • SVC-00 blitzd [--socket PATH] [--config FILE]: no arguments (a usage error, exit 2, as a bad flag or a service already answering on the socket); --version; --license[=full|third-party] prints the NOTICE, the Apache License or the third-party notices and exits without starting. It takes no model, agent or workspace flags: each workspace’s configuration decides. blitz serve, from before blitzd existed, is kept as a hidden command that runs blitzd (found as in SVC-50) with the same arguments, so login items installed by older versions keep working.

2. Transport and security

  • SVC-00a Since 2026-10-04 (the thin CLI, spec_020_cli CLI-14). --idle-exit DURATION stops the service cleanly after that long with nothing to do: no request in flight, no turn running in any workspace, no background run going (Server.IdleFor; the CLI starts the shared service with 15m when there’s no login item). Hidden flags for a private service a client starts for a run of its own: --exit-with-stdin (stop when stdin, the client’s pipe, closes; such a service never runs the jobs’ schedules, which would run them twice and open every workspace with an enabled job, keeping it from the shared service), and the run’s settings over every workspace’s configuration: --model, --agent, --agency, --plugin-dir, --add-dir (as sandbox.allowed_paths), --session-dir, --trust-project, --append-system-prompt-file. blitzd doctor [--config] [--dir] [--model] [--agent] [--agency] [--plugin-dir] [--add-dir] [--online] runs the setup checks (spec_020_cli §6), exit 1 when one fails. WorkspaceService.ForgetProjectTrust forgets the decision about a workspace’s project settings and reopens it without them (unless a turn runs); ConfigService.ListModels takes providers and returns each model with Blitz’s price.
  • SVC-00b 2026-11-05 (scan N26-service#26: an eval run, a health check or a scheduled reflection makes no turn, so --idle-exit could stop the service mid-way through one). Nothing to do also means no eval run (EV-09a), health check or scheduled reflection going.
  • SVC-01 Socket: $BLITZ_SOCKET or ~/.blitz/run/blitz.sock (blitzd --socket overrides it). The service is never on a network port: it runs shell commands. (On Windows the tray serves the desktop page on a loopback port, behind a cookie only its own link gives: spec_036_windows WIN-11–13.)
  • SVC-02 Listen: create the directory 0700 and chmod it (no window where others could reach the socket), refuse if a service already answers (ErrRunning → exit 2), replace a stale socket, chmod the socket 0600. The socket is removed on exit.
  • SVC-61 2026-11-05 (scan N26-pkg-small-2#21: BLITZ_SOCKET=~/blitz.sock made the home folder 0700, and BLITZ_SOCKET=~/notes.txt deleted notes.txt). Listen chmods the folder only when it creates it, and always ~/.blitz/run; a folder that was there keeps its mode. It removes only a stale socket: another kind of file at the path is an error, left as it is.
  • SVC-03 HTTP/1.1 and unencrypted HTTP/2 (for gRPC clients); read-header timeout 10 s. Clients use base URL http://blitz with a dialer to the socket.
  • SVC-04 Shutdown on SIGINT/SIGTERM: stop accepting, wait up to 10 s for calls in progress, then close (turns still running are cut off); the scheduler stops its runs; all workspaces close.
  • SVC-06 GetServiceInfo reports the service’s version (the release, or dev), the program it runs from (os.Executable at start; the file may have been replaced or removed since), when it started, its process ID, and replaced: whether the program file is no longer the one it started from (another file in its place, as a package install or a new build leaves, or none; os.SameFile against the file at start), so clients can tell a stale service (desktop DSK-51a). Services older than it answer Unimplemented.
  • SVC-06a ListLogDays and ReadLog read the service’s own diagnostic log (spec_003_observability LOG-06), in its log.dir (WithLogDir): the days there are and the directory; a day’s records by level and text, newest first, with the file and how many matched. DeleteLogDay deletes a past day’s log (DeleteLogDay, LOG-06): today’s is being written (LOG_IN_USE), and a day with no log, or logging off, is LOG_NOT_FOUND. With log.level = "off" there’s no directory: no days, no records. A bad day or level is invalid_argument.
  • SVC-06b Built 2026-11-18, refined 2026-11-28. GetServiceInfo’s settings_changed says global settings that require a service restart changed since the service started (config.RestartStamp: global resource connectors, MCP servers, and daemon logging/session/worker infrastructure): hot-reloaded settings (models, providers, API keys, permissions, personality, voice, search) do not flag it. The desktop app asks when Settings closes if a restart-requiring change was made (spec_024_desktop DSK-51c).
  • SVC-05 Clients name their workspaces in each request. Request messages are limited to 32 MiB (an added image is the largest).

3. Workspaces in the service

  • SVC-10 Every request names its workspace by absolute directory. The server keys workspaces by canonical path (symlinks resolved), opens one on first use with a fresh configuration per workspace (a workspace owns and mutates its config), streaming on, warnings to the log, and the shared job store.
  • SVC-11 Opening is asynchronous and de-duplicated: callers for the same workspace share one open; other workspaces don’t wait. A caller whose context ends gets Canceled. After close, requests get SHUTTING_DOWN.
  • SVC-12 The workspace lock (spec_018_workspace WS-03) means a workspace held by the shared service can’t also be opened by a private one (blitz --local, WORKSPACE_BUSY) until the shared one closes it, which it does when asked and no turn runs there.
  • SVC-14 CloseWorkspace refuses while a turn runs in any of the workspace’s sessions (TURN_RUNNING, FailedPrecondition): closing would cut off the turn (maybe another client’s), and a turn waiting for an approval would hold the close forever. Closing an idle workspace is safe for jobs: the scheduler reopens workspaces when a run is due.
  • SVC-14a 2026-11-21 (security review terminal#3: trusting a project closed and reopened its workspace, ending the shells in its terminals, a build or an unsaved editor in one). CloseWorkspace, and the reopen after TrustProject or ForgetProjectTrust, also refuses while terminals are open in the workspace (TERMINALS_RUNNING, FailedPrecondition): the trust decision is saved and applies when it next opens (reopened false).
  • SVC-13 Images: each workspace keeps the 16 most recently used prepared images by ID for later turns (LoadImage/AddImage return IDs; Turn.image_ids refer to them; unknown → UNKNOWN_IMAGE). PDFs are images here too, with their pages (spec_011_images IMG-50). Every attachment carries its kind and, for audio and video, seconds; one the model can’t take is UNSUPPORTED_MEDIA.
  • SVC-13a Added content: Turn.context (ContextBlock: kind web_page, web_selection or console, URL, title, HTML or text), what the user added from the desktop app’s web preview (spec_038_electron EL-104). The engine (withAdded) gives it to the agent after the prompt’s @ mentions, each block’s HTML made into text (textutil.HTMLToText, the web fetch tool’s), cut to 64 KB a block and 256 KB in all with a note, inside <user-added-content> with the note that it’s data written by the page’s authors, not instructions; a block can’t close its own fence. The transcript records the prompt with [added: <titles>], as it does [images: …].

4. Services

Service RPCs
SessionService ListSessions, GetActiveSession, NewSession, OpenSession, LoadSession, ListSessionTools, SaveSnapshot, RenameSession, DeleteSession (SES-23; SESSION_OPEN, SESSION_NOT_FOUND), RunTurn (server stream), Steer, Approve, Answer, GetUsage (the active session’s, or with session_id another saved one’s; its totals by model and purpose, and with calls its ledger, spec_056_conversation_adapters CA-125; SESSION_NOT_FOUND), Compact, SearchSession
WorkspaceService GetServiceInfo, ListLogDays, ReadLog, DeleteLogDay (SVC-06, SVC-06a), ListWorkspaces, CloseWorkspace, GetSandbox, ListAgents, SetAgent, GetModel, SetModel, PinModel, UnpinModel, GetModelSettings, UpdateModelSettings (every [model_settings] key, including reasoning_effort and thinking_budget), GetSettings (includes permission_mode, effort, the speech model with why it can’t be used, speech_model and speech_error, and what the active agent’s model takes as attachments, accepted_media: spec_011_images IMG-63), SetSetting, SetPermissionMode, ListCommands, ListPermissionRules (with problem: why rules were left out at the last reload), AddPermissionRule, RemovePermissionRule, ListSkills, GetSkill, ListEnvs, RemoveEnv, PruneEnvs, ListMCPServers, ListTools, ReloadMemory, ReloadAgentFiles (/reload, spec_012_memory MEM-25), AddMemory, ListLocales, SetLocale, ListCheckpoints, Undo, GetDiff (with git, every change since the last commit and new files: WS-61), GetGitStatus (the branch and changed files, and whether git is installed, for the desktop’s status bar and Changes; a repository with no commit yet is one), InitGitRepo (git init in a workspace that isn’t in a repository; NO_GIT, GIT_FAILED), DraftCommit (the staged files, everything staged first with stage_all, and a commit message the suggestions model, else the reviewer’s, else the main one, drafts from the staged diff, cut at 24,000 characters with secrets redacted, following the style of the last ten subjects; nothing asked with nothing staged; a failing model gives problem, its redacted summary, instead of an error; NOT_A_REPOSITORY, GIT_FAILED), Commit (what’s staged, git commit -F -, the repository’s hooks run, two minutes at most; the new commit’s short hash and subject; NOT_A_REPOSITORY, NOTHING_STAGED, EMPTY_MESSAGE, GIT_FAILED), FetchRemote, Pull, Push, ResolveConflict, CompleteMerge, AbortMerge (the workspace’s remote, SVC-36), ListBranches, SwitchBranch, CreateBranch, MergeBranch (its branches, SVC-37), ListApprovals, RevokeApprovals, ListProcesses, GetProcessOutput, KillProcess (a background process records the session whose turn started it; each call names the client’s sessions and sees only their processes, UNKNOWN_PROCESS otherwise), AuditShell, SetSessionModel, PreviewSessionModel (on SessionService: a conversation’s own model, spec_056_conversation_adapters CA-100, CA-130), MoveSession (on SessionService, for /cd, SES-18; SessionInfo.origin says what started a session, SES-24), ListTasks, GetTask, StopTask, WatchTasks (a stream: active tasks and waiting requests, ready, then changes), ListTaskRequests (spec_032_background_agents; Approve and Answer also answer tasks’ requests), GetProjectSettings, TrustProject (records the decision and reopens the workspace unless a turn runs in it; PROJECT_CHANGED for content changed since it was shown, spec_031_project_config), LoadImage, AddImage, ReadStoredFile (a file in the attachment store by its reference: one a model made, spec_056_conversation_adapters CA-71; FILE_NOT_FOUND, UPLOAD_TOO_LARGE over 32 MB), GetSearchProvider, SearchWeb
FileService ListDir, ReadFile, ReadPreview (images, PDFs and sound), WriteFile, WriteBinaryFile (bytes, as WriteFile writes text: an exported PDF, spec_024_desktop DSK-93), CreateFolder, RenameFile, DeleteFile, FindFiles, StatFiles (spec_029_files §3; reasons FILE_CHANGED with current_version, BAD_PATH, FILE_NOT_FOUND, FILE_EXISTS)
ConfigService DescribeConfig, GetSignIn, SignIn, SignOut, SetApiKey, SecureApiKey, RemoveApiKey, SetProvider, SetConfigValue, DescribePermissions, AddPermission, RemovePermission, CheckPermission, SetReadOnlyDefaults, GetConfigFile, SaveConfigFile, CheckConfigFile, GetSettingsReference (SVC-35), ListModels (SVC-55)
WorkerService ListWorkers (one workspace or every registered one), CreateWorker, EnableWorker, DisableWorker, DeleteWorker (WK-01c), RunWorker, ListWorkerRuns, GetWorkerRun, WatchWorkerRun (server stream), GetWorkerSpec, UpdateWorker, UndoWorkerRun, ListRunningWorkerRuns, StopWorkerRun (WK-53a), RewriteWorker (WK-53b)
  • SVC-35 ConfigService edits the settings of a scope — workspace an absolute directory, "" the global settings — through pkg/config (spec_002_config §6), in the service’s settings directory (--config). It never returns a key, only where each comes from, nor an api provider header’s value (only whether it has one, spec_002_config CFG-44). A change reloads the open workspaces it touches (every one for the global scope): each reloads its configuration and rebuilds its model and its agents’ pinned models (Workspace.ReloadProviders; only the providers and the default model change; other settings apply when a workspace next opens; a pin that can’t be built keeps its model), and the response carries the scope’s workspace’s model error, if any. A workspace whose model couldn’t be built tries again (Workspace.RetryModel) when GetModel asks and before each turn or job run, so a sign-in made outside Blitz (gcloud’s Application Default Credentials, ant auth login) is noticed without a settings change. Invalid input (a relative directory, an unknown provider or setting, a file that doesn’t decode) is InvalidArgument.
  • SVC-36 Since v0.6.3. The workspace’s remote, for the desktop’s Changes view (spec_024_desktop DSK-90b; pkg/engine/gitremote.go). GetGitStatus also reports remote, the branch’s upstream, ahead and behind (as of the last fetch), a merge or rebase in progress (operation) and the files in conflicts. FetchRemote fetches the upstream’s remote (else every remote) with --prune. Pull runs git pull --autostash, adding --no-rebase only when none of pull.rebase, branch.<name>.rebase and pull.ff is set (git refuses divergent branches unasked); its outcome is UP_TO_DATE, FAST_FORWARD, MERGED, REBASED or CONFLICTS (not an error: the merge or rebase waits), with the commits it brought in. Push pushes to the upstream, or publishes the branch (--set-upstream to origin, or the only remote) and returns remote/branch. ResolveConflict settles a conflicted file: MINE, THEIRS (swapped into git’s terms during a rebase, whose “ours” is the upstream; a side that deleted the file deletes it) or RESOLVED (git add, refused while conflict markers remain). CompleteMerge commits the merge (git commit --no-edit) or continues the rebase, which may stop on the next commit’s conflicts; AbortMerge runs git merge --abort or git rebase --abort. Git never prompts or opens an editor (GIT_TERMINAL_PROMPT=0, GIT_EDITOR=true, GIT_MERGE_AUTOEDIT=no) and has two minutes. Settings that run commands — core.sshCommand, core.gitProxy, core.askPass, credential helpers, filter drivers, merge drivers, remote.*.uploadpack/receivepack, protocol.*.allow, gpg.*.program — are taken from the user’s global and system config only: the agent can write the repository’s .git/config, so when it (or what it includes, or the worktree’s config) sets one, these actions refuse with REPO_CONFIG_COMMAND naming the key. The exception is a credential helper whose value is exactly Blitz’s own (engine.TrustCredentialHelper: the running service’s git-credential, which answers only for the organization’s service), as Blitz sets it in a folder shared with an organization (spec_053_enterprise EN-61). Hooks run, as Commit’s do. Errors: NOT_A_REPOSITORY, NO_REMOTE, NO_UPSTREAM, GIT_BUSY (a merge or rebase waits), PUSH_REJECTED (the remote has commits the branch hasn’t), REMOTE_AUTH (credentials wanted), NO_MERGE, CONFLICTS_REMAIN, MARKERS_REMAIN, NOT_CONFLICTED, BAD_PATH, INVALID_CHOICE, GIT_FAILED.
  • SVC-37 2026-10-16 (the owner’s request). The workspace’s branches, for the desktop’s Changes view (spec_024_desktop DSK-90c; pkg/engine/gitbranches.go). ListBranches lists the local branches, then the remotes’ branches no local branch tracks (a remote’s HEAD left out), each newest commit first, with current, a local branch’s upstream, and its last commit’s subject and time. SwitchBranch runs git switch to a local branch (--no-guess), or to a remote’s (origin/feature) with --track, which makes a local branch that tracks it; uncommitted changes come along unless they clash (LOCAL_CHANGES, nothing changed). CreateBranch runs git switch --create at the current commit, keeping uncommitted changes. MergeBranch runs git merge --no-edit --autostash with a local or remote branch: its outcome is UP_TO_DATE, FAST_FORWARD, MERGED or CONFLICTS (as a pull’s: the merge waits for ResolveConflict, CompleteMerge and AbortMerge, where “mine” is the current branch and “theirs” the merged one), with the commits it brought in. GetGitStatus also reports merging, the branch a merge in progress brings in (git name-rev of MERGE_HEAD over the local and remote branches; empty when it isn’t a branch’s tip), so the Changes view names it. A name must pass git check-ref-format --branch and can’t start with -. These check out files and merge them, which runs filters, merge drivers and hooks, so they take SVC-36’s care: they refuse while a merge or rebase waits (GIT_BUSY), the repository’s own config may not set a command (REPO_CONFIG_COMMAND), and git never prompts or opens an editor. Errors: NOT_A_REPOSITORY, NO_BRANCH, BRANCH_EXISTS, BAD_BRANCH_NAME, LOCAL_CHANGES, MERGE_SELF (merging the current branch), GIT_BUSY, REPO_CONFIG_COMMAND, GIT_FAILED.

5. Turns over the stream

  • SVC-20 RunTurn(workspace, session_id, Turn) streams TurnEvent{author, oneof: accepted | text | tool_call | tool_result | approval_request | question | tasks | finished | notice}. Events are sent under a lock (the agent and approval requests can produce them concurrently). The last event is always finished{output, before, after, leftover, error}; a hook refusal finishes with reason PROMPT_BLOCKED. Cancelling the call interrupts the turn. A notice (text, error, transient) is Blitz’s own message about the turn, not the agent’s: a transcript message that couldn’t be saved (WS-28). Since v0.6.3 a transient notice is a passing status, the model’s connection failing and being retried (spec_015_models MDL-51b): the desktop shows it in a snackbar and doesn’t keep it in the chat; the terminal prints it as a line.
  • SVC-20a 2026-11-26 (issue #128: on Linux, a container starting or a VPN toggling had Chromium end every connection, the loopback’s too, with ERR_NETWORK_CHANGED; the turn’s stream dropped, the chat said “network error” and the service, taking the dropped call for a stop, ended the turn). A turn with a turn_id outlives its call (pkg/service/server/liveturn.go). RunTurnRequest.turn_id is the caller’s name for the turn (letters, digits, -, _, up to 64; a UUID; else INVALID_TURN): the turn runs in the service with the call’s values and not its end, its events kept (the latest 5000) and numbered from 1 in RunTurnResponse.seq. A stream that ends leaves it running; the same request sent again joins it, and is sent the events after after_seq (0: from the first kept), without the approval requests and questions already answered, then those to come, to finished. A request never starts a turn twice: one the service doesn’t know is started only with after_seq 0 and a turn, and is otherwise UNKNOWN_TURN (NotFound), as is another workspace’s; an ended turn is kept five minutes for a caller that lost its last events. StopTurn(workspace, turn_id) stops it and answers once it has ended (an ended one is no error; UNKNOWN_TURN). Left with no stream for a minute, it’s stopped, so a client that died leaves no turn spending; the service closing stops them all (SVC-04). Without a turn_id a turn ends with its call, as SVC-20 says. The desktop page runs every turn with one (spec_024 DSK-21b), and so, since 2026-11-26 (the owner: “do it now”), does the terminal’s client (pkg/client Remote.Run, attached to the socket or over the network): it asks for its turn again from the last seq when the stream fails with no reason from the service, after 100 ms, 250 ms, 500 ms, 1 s, then every 2 s, for 45 s; Ctrl-C (its context ending) calls StopTurn and waits for it; and a terminal that’s killed leaves its turn to the minute’s wait. A service that doesn’t number its events is never asked again.
  • SVC-21 accepted marks the prompt recorded; from then on the client may Steer.
  • SVC-22 Approval broker: the workspace’s approver and question prompter become approval_request{request_id, tool, kind, detail, diff, scope_label} / question{request_id, question, options} events on the running turn’s stream, and the agent waits until Approve(request_id, decision) or Answer(request_id, text) arrives, or the turn ends. Request IDs are random 96-bit hex. Answering an unknown or expired request → NotFound UNKNOWN_REQUEST. Decisions: DENY, ONCE, SESSION (until the service restarts), ALWAYS (saved); unspecified → INVALID_DECISION.
  • SVC-23 An approval or question outside a turn with a client (e.g. from a job) is refused (no client is attached to answer).

6. Errors

  • SVC-30 Errors are Connect errors with an ErrorInfo{reason, metadata, message} detail, mapped from pkg/engine typed errors. Reasons: UNKNOWN_COMMAND, BAD_RULE, UNKNOWN_MODE, BYPASS_NEEDS_SANDBOX, UNSAFE_NOT_HERE, MAX_TURNS, COST_LIMIT, TIME_LIMIT (a turn stopped at a limit; Turn.max_cost_usd and Turn.timeout carry the limits), INVALID_WORKSPACE, OPEN_FAILED, WORKSPACE_BUSY, SHUTTING_DOWN, NO_ACTIVE_SESSION, SESSION_NOT_FOUND, RESUME_FAILED, SNAPSHOT_NAME_TAKEN, NO_NOTE, NO_GOAL, PROMPT_BLOCKED, INVALID_TURN, UNKNOWN_REQUEST, INVALID_DECISION, UNKNOWN_AGENT, AGENT_IN_USE (a global agent switched off in the workspace whose agent it is, spec_040_studio STU-15), BAD_MODEL_REF, INVALID_SETTING, UNKNOWN_SETTING, INVALID_AGENCY, UNKNOWN_LOCALE, NOTHING_TO_COMPACT, OUTPUT_LIMIT (the turn’s last model reply stopped at max_tokens, cut off: a tool call it was writing is dropped), MODEL_REFUSED, BLOCKED, RECITATION, MALFORMED_TOOL_CALL (the turn’s last reply was a refusal, stopped by the provider’s safety filters, stopped for repeating protected material, or a tool call that couldn’t be read twice; spec_056 CA-31), CONTEXT_LENGTH (the conversation is longer than the model reads even summarised, CA-111), UNDO_CONFLICT, NOTHING_TO_UNDO, GIT_FAILED, NO_GIT, IMAGES_DISABLED, UNKNOWN_IMAGE, NO_FETCH, NO_SEARCH, SCRIPTS_DISABLED, SKILL_NOT_FOUND, UNKNOWN_WORKER, WORKER_INVALID, WORKER_EXISTS, WORKER_DISABLED, WORKERS_DISABLED, HASH_MISMATCH, RUN_IN_PROGRESS, RUN_NOT_RUNNING, UNKNOWN_RUN, TOO_MANY_RUNS, NO_SCHEDULER, INTERNAL.
  • SVC-30a 2026-11-05 (scan N26-service#1, #2, #29, #36: the list above was a third of the reasons the service sends, and many errors had no ErrorInfo at all). Every error has a reason, and every reason is listed here (TestReasonsAreListed in pkg/service/server reads the service’s source and this item, and fails on a reason sent and not listed, or listed and not sent). An error with no reason of its own has its Connect code’s name: INVALID_ARGUMENT (a request the service can’t take: a field it can’t read, a folder that isn’t one), and, rarely, another code’s name (FAILED_PRECONDITION; a call cancelled or out of time is left without one, so a client reads it as its context’s error); an error the service didn’t expect is INTERNAL. A scope that isn’t an absolute folder is INVALID_WORKSPACE. A job’s run that ended badly carries RUN_<STATUS> in its record and its watch’s last event: RUN_FAILED, RUN_LIMITED, RUN_SKIPPED, RUN_STOPPED. A refusal by the organization’s service passes its own code on, upper-cased (TERMS_REQUIRED, FORBIDDEN, …; REFUSED when it gives none); CONFLICT when it reports one, except a submission to share, refused with its own code even then (spec_053 EN-95); UNREACHABLE when it can’t be reached. SIGN_IN_RUNNING is AlreadyExists for an organization’s sign-in as for a provider’s. The rest, by what sends them. Turns and sessions: TURN_RUNNING, TERMINALS_RUNNING, SESSION_BUSY, SESSION_OPEN, STEER_TOO_LATE, NOT_REWIND_POINT, CANT_REWIND_CONVERSATION, UNKNOWN_REWIND_MODE, PROJECT_CHANGED, APPROVALS_STILL_SAVED, SANDBOX_UNAVAILABLE, UNSUPPORTED_MEDIA, UNKNOWN_PROCESS, UNKNOWN_TASK, NO_AGENT_BROWSER, UNKNOWN_TURN. Search: SEARCH_DISABLED, UNKNOWN_SEARCH_SOURCE, UNKNOWN_SEARCH_MODE, EMPTY_SEARCH, NO_EMBEDDINGS. Git and Changes: NOT_A_REPOSITORY, GIT_BUSY, NOTHING_STAGED, EMPTY_MESSAGE, NO_REMOTE, NO_UPSTREAM, REMOTE_AUTH, PUSH_REJECTED, LOCAL_CHANGES, NO_BRANCH, BAD_BRANCH_NAME, BRANCH_EXISTS, MERGE_SELF, NO_MERGE, NOT_CONFLICTED, MARKERS_REMAIN, CONFLICTS_REMAIN, INVALID_CHOICE, REPO_CONFIG_COMMAND, LOG_NOT_FOUND, LOG_IN_USE, BAD_PATH. Files: FILE_NOT_FOUND, FILE_EXISTS, FILE_CHANGED, READ_ONLY, BAD_FILTER, BAD_REVISION, IGNORED_ELSEWHERE, NO_PREVIEW, NOT_A_TABLE, NO_UPLOAD, UPLOAD_TOO_LARGE, NOT_IN_TRASH. Language servers: NO_SERVER, SERVER_MISSING, SERVER_FAILED, UNKNOWN_DOCUMENT, UNTRUSTED, STALE. Settings and sign-ins: MANAGED, UNKNOWN_PROVIDER, INVALID_PROFILE, NO_TOOL, SIGN_IN_FAILED, MCP_SERVER_EXISTS, MCP_SERVER_NOT_FOUND, CONNECTOR_NOT_FOUND, CONNECTOR_GLOBAL, CONNECTOR_NOT_TRUSTED, NO_BROWSER, NO_BROWSER_PROFILE. Studio: INVALID_PATH, SKILL_EXISTS, AMBIGUOUS, NO_REGISTRY, REGISTRY_FAILED, NOT_OFFERED, NOT_INSTALLED, SCENARIO_NOT_FOUND, RULE_NOT_FOUND, GUARDRAIL_NOT_FOUND, EVAL_NOT_FOUND, EVAL_NOT_RUNNABLE, EVAL_RUN_NOT_FOUND, WORKFLOW_NOT_FOUND, RUN_NOT_FOUND, UNKNOWN_HOOK (a git hook no workflow runs on: pre-commit and pre-push are, spec_043 WF-32), TASK_NOT_FOUND, NOT_ANSWERABLE, ANSWER_INVALID, COMPOSE_NOT_FOUND, COMPOSE_FAILED, HEALTH_CHECK_RUNNING, HEALTH_CHECK_FAILED, NO_INSTRUCTIONS. The organization (spec_053_enterprise): NOT_CONNECTED, NOT_SIGNED_IN, INVALID_ADDRESS, NOT_FOUND, CLONE_FAILED, FOLDER_IN_THE_WAY, NOT_SYNCED, NOT_ORG_WORKSPACE, ANSWERED, CONFLICTS, NO_CHANGES, PUSH_FAILED, ALREADY_SHARED, INSIDE_REPOSITORY, SECRETS_FOUND, SECRETS_UNCHECKED, REQUIRED (an asset of the organization’s library it requires, which the person can’t switch off, EN-83), CATALOG_REMOVED (Unimplemented: the retired catalog’s calls, kept in the API, EN-97). The specification (spec_057_spec_driven): SPEC_NOT_READY (a spec approved without force has errors or open questions). Pictures (spec_058_pictures): PICTURE_NOT_FOUND (a session or picture that isn’t there), PICTURE_NOT_TAKEN (a setting the model doesn’t take, PIC-62). The terminal (spec_062_terminal): UNKNOWN_TERMINAL, TOO_MANY_TERMINALS, TERMINAL_UNSUPPORTED, TERMINAL_NOT_READING (input what runs in it hasn’t taken for 5 s, TRM-13a), TERMINAL_EXITED (input for a shell that has exited). Voice (spec_063_voice VOX-31): VOICE_OFF, VOICE_NOT_SET_UP, VOICE_MODEL, VOICE_BUSY, UNKNOWN_VOICE.
  • SVC-30b 2026-11-05 (scan N26-desktop-4#25: the desktop page showed a bare reason code, WORKSPACE_BUSY, when an error or a run’s end came without a message). Each reason listed here has words in the catalogs (desktop.error.reason.<REASON>, in every shipped language; TestReasonsHaveWords fails on one listed without them). The page shows the service’s message, and the reason’s words when there is none (errors.reasonText); a reason with no words (an organization’s code passed on) shows as it is.
  • SVC-31 Errors reported inside a response (e.g. a failed save, a turn failure) use the same ErrorInfo.

7. API evolution

  • SVC-40 Protos live in proto/blitz/v1 (package blitz.v1), linted with buf STANDARD, breaking-change checked with FILE. Their Go code is generated by Bazel and never committed: one package, github.com/retail-cortex/blitz/proto/blitz/v1 (blitzv1), holds the messages and Connect’s clients and handlers (protoc-gen-connect-go with package_suffix=; //proto/blitz/v1:blitzv1_go_proto). So is the desktop page’s TypeScript (//apps/desktop/web:api_ts, protoc-gen-es pinned by the page’s lockfile). CI checks the protos’ formatting and breaking changes with buf (spec_025_release REL-04).
  • SVC-41 A deliberate breaking change is declared with a Breaking-API: <why> line in the commit message, which CI’s buf breaking step honours.

8. Login item (blitz service)

  • SVC-50 The login item lives in pkg/loginitem, shared by the CLI and the desktop app (which installs, restarts and stops the service itself, DSK-51a). On Linux, installing restarts a running unit, so a reinstall runs the new program. install: finds blitzd beside the real (symlinks resolved) blitz executable, else on PATH (neither: usage error), and registers it; macOS writes ~/Library/LaunchAgents/dev.blitz.service.plist (RunAtLoad, KeepAlive on unsuccessful exit, stdout/stderr to ~/.blitz/logs/service.log) and launchctl bootout/bootstrap gui/<uid>; Linux writes ~/.config/systemd/user/blitz.service (Restart=on-failure, WantedBy=default.target), daemon-reload, enable --now. Other OSes: usage error. Prints that it must be re-run after upgrading, and warns about API keys set only in the shell environment (a login item doesn’t see them) by reloading the config without them.
  • SVC-51 uninstall stops and removes the item; status reports whether the item is installed and whether the service answers.
  • SVC-52 loginitem.Start and Restart start or restart the login item’s service (systemctl --user start|restart blitz.service; launchd: bootstrap if unloaded, then kickstart, with -k to restart); without the item they are ErrNotInstalled.
  • SVC-53 The tray (apps/tray, blitz-tray): an icon in the system tray, a white bolt on a transparent background (apps/tray/icons/*.svg; a template icon on macOS, which tints it to suit the menu bar), filled while the service answers on its socket and outlined when it doesn’t, with a tooltip and a first, disabled menu line saying so (“Blitz service: running (v1.4.0)”, “stopped” for a login item that isn’t running, “not running”); then Start the service (while it’s stopped), Stop the service and Restart the service (while it runs), Open Blitz, Open the logs, since v0.7.1 MCP servers and Jobs (submenus, shown while the service runs and answers: spec_009_mcp MCP-48, spec_023_workers WK-57; since v0.8.0 the runs going on under the service’s line, and a submenu per workspace with its jobs and workflows instead of Jobs, with icons, and the icon pulsing while anything runs: spec_038_electron EL-111), Quit the tray (the service keeps running). It asks every 2 s (Probe: the socket, and GetServiceInfo for the version and process). Start, Stop and Restart go through the login item when there is one (SVC-52), else Start runs blitzd from beside the tray or PATH on its own, and Stop asks the service to stop (Shutdown), then sends the process that answered SIGTERM; each waits for the service to be (or not be) running, up to 15 s, and says “Couldn’t: …” in the first line for 5 s when it fails. Open Blitz runs the bundle the tray is in (macOS: the nearest .app above it, Blitz.app/Contents/Resources/app/bin in the Electron app) or blitz-desktop (Linux: the Electron app’s, three folders up from resources/app/bin, then beside the tray, then on PATH) (on Windows it serves and opens the page: spec_036_windows); Open the logs opens the running service’s log folder in the file manager (what ListLogDays says, the log.dir it started with), else log.dir of the global settings. The menu is in the desktop app’s language (its Interface language, from ~/.blitz/desktop.json; System follows the system’s languages: macOS’s list, then LANGUAGE, LC_ALL, LC_MESSAGES, LANG), from the same catalogs (tray.* keys). One tray at a time: it holds ~/.blitz/run/tray.lock (flock; LockFileEx on Windows) while it runs, and a second one exits. On macOS the tray is an accessory app (NSApplicationActivationPolicyAccessory, apps/tray/dock_darwin.go), set before its menu bar item: run from Blitz.app/Contents/MacOS it would otherwise take the bundle’s Info.plist and show a second Blitz icon in the Dock and the app switcher.
  • SVC-53a Since v0.7.0 (the Electron trial, spec_036_windows WIN-14). blitz-tray --serve --page <dir> serves the desktop page for a window that shows it, with no icon and without the tray’s lock (a tray can show its icon beside it): the page in <dir> (it must have index.html; until v0.7.1 the Windows tray had one built in), the API through the service’s socket, and /host/ (pkg/pagehost). Since v0.8.0 it serves HTTP/2 over TLS only (spec_038_electron EL-01a). It writes a one-time link to the page as a JSON line ({"url": …, "fingerprint": …}: the link, and its certificate’s SHA-256 fingerprint) on standard output, a new one for each link line it reads, and stops serving when standard input closes, so it never outlives the window that started it (tray.Serve).
  • SVC-54 The tray starts at login from its own entry: blitz-tray --install writes it and starts the tray (Linux: an XDG autostart entry, $XDG_CONFIG_HOME/autostart/blitz-tray.desktop, and the tray started now in a graphical session; macOS: a launchd agent dev.blitz.tray, LimitLoadToSessionType Aqua, which starts it); --uninstall removes it (on macOS, stopping it). On Windows it’s a value in the registry’s Run key, which the tray’s Start Blitz at login also toggles (spec_036_windows WIN-05). The desktop app’s Show in the system tray (Settings › Service, DSK-60) does the same through its host (pkg/pagehost SetTray): it writes the entry and, on Linux and Windows, starts the tray now (Host.StartTray), or removes it. Since v0.7.1 the host also repairs entries an older install wrote when it starts (Host.Repair, loginitem.RepairTray/RepairService): an entry whose program is gone (the desktop app’s moved in v0.7.0, from /usr/lib/blitz-desktop/blitz-tray to …/resources/app/bin/blitz-tray) is rewritten for the current one, the tray started and the service’s login item restarted; an entry whose program is there is left alone. On Linux the icon is the bolt in colour, as on Windows (amber running, grey stopped), so it shows on light panels and dark; macOS keeps the white template icon. Linux needs a StatusNotifierItem host: KDE and most desktops have one; GNOME has it with the AppIndicator extension (on by default on Ubuntu); without one there’s no icon.
  • SVC-55 2026-10-01. ConfigService.ListModels(workspace): each configured provider’s models from its API (runtime.ListModels, as blitz models), with why a provider couldn’t be listed and the default provider, for the desktop’s model fields to suggest and check names. Kept per scope for 10 minutes (1 minute when a provider failed), and dropped whenever a settings change goes through ConfigService (a new key, provider or file). Model names for gemini, anthropic and vertex-anthropic are lowercased wherever a model is chosen (runtime.ParseModelRef): their IDs are always lowercase, and a name a text field capitalized (“Gemini-3.8-flash”) is otherwise a 400 from the API.
  • SVC-55a 2026-11-05 (scan N26-service#27, #28: a listing begun before a settings change was cached after it, from the old settings; CheckApiKey could crash on an empty listing). A model listing made while the settings changed isn’t kept: the next ListModels asks again. CheckApiKey answers INTERNAL when the provider gives no listing at all.
  • SVC-55b 2026-11-05 (scan N26-service#17: a global change an open workspace couldn’t take up, a permission rule that can’t be read, say, went only to the log, so the rule wasn’t enforced and the call said nothing). ConfigChange.problems lists what each open workspace the change touches couldn’t take up (<folder>: settings not loaded, permission rules not reloaded, MCP servers not reloaded, with why), for global changes too; the settings file’s editor says so when it saves.
  • SVC-56 2026-10-04 (the owner’s request: sign in to each provider, as well as API keys, never instead). Sign-ins with each vendor’s own tool, run by the service so the credentials land where it reads them (pkg/signin): google (gcloud auth application-default login; signed in when the Application Default Credentials file parses, read without asking Google), anthropic (ant auth login, the profile through ANTHROPIC_PROFILE; signed in when the profile has credentials), aws (aws sso login [--profile]; signed in when the chain Bedrock uses gives credentials) and azure (az login; signed in when Entra ID gives a token for Azure OpenAI). Each also signs out (revoke, logout). The tools are found on the service’s PATH, else the login shell’s (pkg/shellpath, which the desktop app’s CLI install shares), run with a fixed argument list (a profile is letters, digits, ., _ and -), no stdin, at most 10 minutes, one sign-in per provider at a time. ConfigService.GetSignIn(workspace, provider?, profile?) returns each provider’s status (the four checked at once, each within 5 s; AWS and Azure answer at once when nothing for them is set up, without waiting on a cloud’s metadata service); SignIn streams the tool’s lines with the sign-in page’s URL and a device code pulled out, then done with the status; SignOut. After either, the service forgets the model listings and builds again the open workspaces’ models that had failed. Errors: UNKNOWN_PROVIDER, INVALID_PROFILE, NO_TOOL (with where to get it), SIGN_IN_RUNNING, SIGN_IN_FAILED (the tool’s last lines). OpenAI has no sign-in: it takes an API key.
  • SVC-57 2026-10-09 (found when pyright, installed with nvm, never answered in the desktop app). A service started by the tray, launchd or systemd has the system’s bare PATH (/usr/bin:/bin:/usr/sbin:/sbin on macOS), without the folders the user’s tools are in (nvm, Homebrew, ~/go/bin). At start it takes the PATH of the user’s login shell (AdoptUserPath in pkg/shellpath: the shell’s folders first, in its order, then the service’s own), so language servers, the agent’s commands and sign-in tools find what the terminal finds. A private service (--exit-with-stdin, started by the CLI) keeps its terminal’s. Windows has no login shell to ask: nothing changes there.
  • SVC-60 2026-11-05 (scan N26-pkg-small-2#12: a startup file that left a program running with the shell’s output open kept the service from starting). The login shell that reads the PATH runs 5 s at most, gets no input, and once stopped what it left running is waited for 1 s more (WaitDelay); then the service’s own PATH is used.
  • SVC-58 2026-10-26. WorkspaceService.RunShell runs a command the user typed after ! in a client without a terminal of its own (the desktop app’s chat, spec_024_desktop DSK-109), as the terminal’s ! does: Workspace.RunUserShell in the workspace (tools.UserCommand: bash, else sh; cmd on Windows; its own process group), as the user, outside the agent’s sandbox, command policy and approvals, recorded as user_shell (AuditShell). It streams the output (stdout and stderr together, the first MiB, MaxUserShellOutput), then done with the exit code (-1 when stopped), why it didn’t start, how long it took and whether output was cut; the call’s end (a client’s cancel) kills the process group.
  • SVC-59 2026-11-05 (scan N26-service#10, #11: response fields the service filled and no client read). Removed, their numbers and names reserved: RegistrySkill.castor_id, OrgWorkspace.clone_url, ServiceRun.answer_note, ServiceRunFile.media_type, OrgUsed.cached_input_tokens, CompletionItem.sort_text and filter_text, RunSkillScriptResponse.output_files, HumanTask.fire_at, ConnectorKind.placeholders, and ServiceRunChange’s run_id, workspace, dir and status (a change names its job; a client asks for the job’s runs again). A field comes back when a client shows it.