feat(gateway): store and show a person's quiet hours #1584
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1584"
general
weight: 0.35
mvschwarz
What a user gets
A person, or the operator agent acting for them, can now set quiet hours and read them back:
boundary, correct across midnight and daylight-saving changes. For example:
alice quiet: on (every day 22:00-07:00 Europe/Berlin; set by operator, manual, revision 1; ends 2026-10-21T05:00:00.000Z).rig gateway human listnow shows the person's actual availability (available,focus,awayoroff;before, it showed only away or available), plus a quiet line. If the daemon can't be reached, the quiet line says
so rather than implying there's no window.
This PR only stores and shows quiet hours. Delivery doesn't act on them yet: asks still go to the person exactly as
before. Holding routine asks during quiet and releasing them afterwards come in later PRs.
How
- a daily local rule (
HH:MM-HH:MM, which may cross midnight) or an until-time;- an IANA timezone, a revision, a source (
manual), who set it and when;- the occurrence that was ended early, if any.
schedule from the current one. "End" closes only the occurrence that's on now.
- whether quiet is on;
- the window, occurrence and revision;
- the next start or end.
- a local time skipped at the spring change means the next valid minute;
- a time repeated in the autumn means its first occurrence.
--untiltakesHH:MM(its next occurrence in the timezone) or an ISO time with an offset. Without--tz, theCLI sends the machine's own timezone, and the read-back shows it.
-
GET/PUT /api/gateway/human/:entityId/quiet;-
POST …/quiet/endandPOST …/quiet/clear.- They work only for a registered person (404 otherwise).
- They record the acting seat, or the named actor outside a seat.
- They refuse an unknown timezone, a malformed time, an empty window or a time already passed, with a message saying
what to give instead.
Tests
human-quiet-windows.test.ts, 19), on real SQLite with an injected clock:- a daily window across midnight and within one day;
- an until-time;
- end-then-tomorrow, and "end" when quiet isn't on;
- extend and replace bumping the revision, and a new revision undoing an earlier end;
- clear, then set again, with revisions still counting;
- a restart (a new store over the same database);
- another person's window untouched;
- invalid input;
- in Europe/Berlin: the skipped spring hour and the repeated autumn hour, a ten-hour and an eight-hour night, and a
window starting inside the skipped hour.
human-quiet-windows-route.test.ts, 5): set, show, end, clear and their refusals; a localHH:MMuntil-time; the actor; an unregistered person.
gateway-human-quiet-verb.test.ts, 9, over real HTTP to a recording stub): each verb's request andread-back, an occurrence ended early named by its date (and an until-time one), a refusal's message and exit code, and
list's availability and quiet lines (including when quiet can't beread).
listreads.and migration don't exist there.
stuck sweep are byte-identical to main. Their existing tests pass unchanged.
Changes after review
early by alice"), or just "ended early" for an until-time window. It no longer says "tonight's", which was wrong the
next day, and for a window that isn't overnight.
change. It's no longer shown as the next start: the read-back names the next night that has quiet.
quiet setwithout--tzsays which zone it stored, and that--tzgives the person's own.Not in this PR
Native: NOT RUN
Everything here runs hermetically (temp homes, SQLite, a stub daemon). No real Slack and no installed daemon.
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Added quiet-hours management for gateway humans, including daily schedules and one-time end times.
Added CLI commands to set, view, end, and clear quiet hours with timezone and JSON support.
Gateway listings now show quiet status, rules, boundaries, and effective availability.
Added support for active periods, upcoming boundaries, midnight crossings, and daylight-saving transitions.
Added validation and clear error reporting for invalid schedules, timezones, timestamps, and unavailable quiet-hours data.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->