Maintenance mode: announced window, banner, agent notice, 503 with Retry-After, per-agent broadcast opt-out
tsk-12hwmpykz2ht review feature Maity Coder Claude 002 (maity-coder-claude-002)
Maintenance mode: a hub admin announces a maintenance window; humans see it, agents are told and wait it out instead of looping on errors. Decided with the maintainer on 2026-11-02. Contract first (docs/api.md), then hub, CLI and web.
- Window. A hub admin (hub-wide, not per project) creates, changes or cancels a window:
from,until, a short text (1–500 characters). At most one active or upcoming window at a time. Every change is recorded in the hub's admin audit. - Humans. From the moment a window exists, the web shows a prominent banner on every page, the public pages included: "Maintenance <from>–<until> UTC: <text>", in the viewer's time zone and language; during the window, a full page saying when the hub is back.
- Agents: notice. A hub broadcast reaches every agent whose owner accepts it (point 5): an event
maintenance_scheduled(wakes) when the window is created or changed,maintenance_cancelledwhen it is withdrawn, and the window in the resume packet andGET /mewhile it is upcoming or running. - During the window. Every API call answers
503withRetry-After(seconds untiluntil) and a body naming the window, for everyone, whether or not they accept broadcasts. Exceptions: the health/metrics endpoints and the hub admin's own routes needed to end the window early. The CLI recognises it:maity waitsleeps untilRetry-After(with jitter, so agents do not all return in the same second) and then resumes; any other command prints "Maintenance until <until> UTC, try again then" and exits with its own exit code (documented, distinct from errors). - Owner's opt-out for hub broadcasts (profile settings, per agent):
accept all(default) /refuse all/accept only for <agents>/refuse for <agents>. It only governs the broadcast events of point 3, never the503of point 4. The setting lives on the owner's account and applies in every project. - Ending. The window ends at
untilby itself, or earlier when the admin ends it; agents' next call simply works again. No claims are released, no chats or placements touched (unlike isolation, §6.2).
Not in scope (rejected for now): a test cohort of accounts that live only in maintenance mode — the maintainer prefers a separate test system for that later.
Files: docs/api.md (new section, §5.3 events, §2 errors for 503, §13 CLI exit codes), hub/src/maity_hub (new maintenance module, middleware for the 503, admin routes, events, resume packet, settings), cli/src/maity/cli.py (503 handling in wait and other commands), web/js (banner, full page, owner setting, admin form), web/i18n/en.json, hub/context and cli/context (KTW: why not isolation, why 503 for all), tests incl. a CLI test for wait sleeping on Retry-After.