You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e606eff
Browse filesBrowse the repository at this point in the historyBrowse files
docs(skills): teach the approval escalation clock (escalation.clock, escalation.calendar) (#35963)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D4n2wzAmmp4Z6W5jsqtM2qx)_Fixes#35931
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:用 AI 写审批流程的作者,现在会被教到「审批超时可以按工作日历只算工作时间」,而不是旧的「平台没有工作日历」。
- 为什么做:属于「工作日历」这条线;超时按工作时间计算的功能已经上线,随包发布的技能文档还在教相反的说法。
- 出错会怎样:只改文档和一条评测用例,不改运行行为;写错了的后果是 AI 给出错误的配置建议,可直接撤回本次合并。
- 要你做什么:无(另有一处「平台目录仍写工作日历未提供」的遗留,见验收说明,需另行安排)。
## What changes
-
`skills/objectstack-automation/references/state-machines-and-approvals.md`,
the `escalation` row of the node-config table, rewritten in place from
the merged contract (`ApprovalEscalationSchema` in
`packages/spec/src/automation/approval.zod.ts`, `slaDeadline` in
`packages/plugins/plugin-approvals/src/approval-service.ts`, the lint in
`packages/lint/src/validate-approval-approvers.ts`, the inbox label in
`ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx`). It now
states:
- both clocks and the default: `clock: 'wall_clock'` (default) counts
nights, weekends and holidays; `'working_time'` counts `timeoutHours` as
working hours on a working calendar (`sys_work_calendar`, maintained per
organization in Setup);
- the resolution order: the `calendar` code, else the organization's
default, else refused, never wall-clock;
- the cannot-answer hold: the request does not escalate, its row carries
`sla_due_refusal` instead of `sla_due_at`, the inbox shows why, and each
sweep retries;
- the lint rule: `calendar` without `clock: 'working_time'` is the error
`approval-escalation-calendar-without-working-time`.
- The sentence "the platform ships no business-hours calendar" is gone.
- Paid for inside the same file's ceiling by deletions (the ceiling row
is untouched): the "Analog" column of the expression-roots table (other
vendors' names for the three roots), the rationale sentence after
"`record` and bare field names are NOT available" (the fix, `current.x`
or `trigger.x`, stays), the pointer to a showcase flow in the framework
repo (an installed app has no such repo), "the author declares keys,
approvers only fill values" (the next sentences state the refusal of an
undeclared key), "(do not mix them up)", and the `sys_user_position`
parenthetical on `escalateTo`, which the Approver Types table's
`position` row already carries.
- `skills/objectstack-data/references/data-hooks.md`: the note on a
hook-stamped deadline says "wall-clock hours" instead of "calendar
hours", names the constant `*_WALL_CLOCK_HOURS`, and points at
`escalation.clock: 'working_time'` for an approval deadline. Same line
count.
- `.changeset/35931-escalation-clock-skill.md`: `'@objectstack/skills':
patch`.
## Evals
One case added, id 25 in
`skills/objectstack-automation/evals/flows-triggers-approvals.json`: an
approval step that must hand over after 8 business hours on the calendar
`cn_plant`. It requires `clock: 'working_time'` and `calendar:
'cn_plant'` and refuses a hand-rolled `3_600_000` deadline. The old row
would have answered that the platform has no working calendar, so the
case separates the two texts.
`skills/objectstack-project/evals/project-process.json` case 8 is
unchanged; see Acceptance notes.
## Verification
Head `d34c403632`. Read first: the `escalation` row (the one hunk that
teaches new behaviour), then the five deletions in the same file.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints
`state-machines-and-approvals.md is 5932 tokens (ceiling 5936; headroom
4)` and `data-hooks.md is 10120 tokens (ceiling 10122; headroom 2)` and
exits 0.
Readings, before to after:
| File | Lines | Bytes | Tokens / ceiling |
|:--|:--|:--|:--|
| `state-machines-and-approvals.md` | 389 to 385 | 23710 to 23726 | 5928
to 5932 / 5936 |
| `data-hooks.md` | 884 to 884 | 40467 to 40478 | 10117 to 10120 / 10122
|
| `flows-triggers-approvals.json` (eval, not ratcheted) | 440 to 450 |
26920 to 28309 | 6730 to 7078 |
Whole catalog: authored 197404 to 197411 tokens (ceiling sum 202541
unchanged), shipped tree 288105 to 288460 tokens, of which 348 are the
eval fixture; the sum of all `SKILL.md` files is 4944 lines before and
after. Net added lines for the PR, changeset included: 33 added, 19
deleted, net 14 (budget 25).
Gates on this head, local: the `dispatch-gates --commands` list derived
49 commands; 45 exited 0, among them `check-skills-token-ratchet` and
its self-test, `check:skill-refs`, `check:skill-served-sections`,
`check:skill-identifier-liveness`, `check:skill-links`,
`check:skill-compatibility`, `check:doc-authoring`, `check:nul-bytes`,
`check-empty-changeset`, `check-adr-0087-registration` and
`check:doc-formula-expressions` (after building its closure under the
verify lock, `VERDICT command-exit 0`). NOT MEASURED:
`check:dts-closure`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`, `check:sourcemap-no-sources-content`; each
exited 3 asking for a full build, each reads built package output, and
this diff changes no package, so they are left to CI. `overlap-check`:
`VERDICT clean exit 0`.
## Acceptance notes
- **The project eval and the platform catalog are left as they are, and
the catalog is now stale.**
`skills/objectstack-project/references/platform-catalog.md` still lists
working calendars under "Planned: carded, not shipped" as "not
available", and project eval case 8 expects exactly that answer. The
page is generated from `PLANNED_ROWS` in
`packages/spec/scripts/lib/platform-catalog.ts`; `sys_work_calendar` and
`sys_work_calendar_exception` are in the platform object registry and in
Setup, and the approval clock reads them, but no catalog row names them.
Changing the eval alone would make it contradict the page it is graded
against, and moving the row is a generator edit with its own test and
byte ceiling, which this card's diff does not carry. The three formula
functions ADR-0157 D4 names are not in the formula stdlib on this head,
so what the eval's "make the SLA formula read them" should now expect is
not settled by what merged. Reported to the seat as a finding.
- **`data-hooks.md` renames the advised constant** from
`*_CALENDAR_HOURS` to `*_WALL_CLOCK_HOURS`. The arithmetic the note
teaches is unchanged and still true. The old name is the one the merged
spec declined as a clock value because, with a working calendar in the
platform, "calendar hours" reads as hours on that calendar. An app that
followed the earlier advice has a constant whose name is now ambiguous;
nothing refuses it.
- The row names `sla_due_refusal` and `sla_due_at` as fields of the
request row; the three refusal codes are not listed, to stay inside the
ceiling.
- No ablation or reverse verification: the diff changes prose, one eval
fixture and a changeset, no tested behaviour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
The automation skill teaches the approval escalation clock: `escalation.clock: 'working_time'` counts `timeoutHours` as working hours on a working calendar (the `escalation.calendar` code, else the organization's default, else refused), a calendar that cannot count the deadline holds the escalation and shows why, and `calendar` without `clock: 'working_time'` is the lint error `approval-escalation-calendar-without-working-time`. The row no longer says the platform ships no business-hours calendar. The data skill's hook note calls an hours-table deadline wall-clock hours and points at the approval clock.
Copy file name to clipboardExpand all lines: skills/objectstack-automation/evals/flows-triggers-approvals.json
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -435,6 +435,16 @@
435
435
"isActive"
436
436
]
437
437
}
438
+
},
439
+
{
440
+
"id": 25,
441
+
"prompt": "A purchase-order approval step must hand the request to `procurement_supervisor` once it has waited 8 business hours: nights, weekends and public holidays must not count. Our plants keep a working calendar with the code `cn_plant`. How do I declare that on the approval node?",
442
+
"expected_output": "Sets `escalation: { timeoutHours: 8, clock: 'working_time', calendar: 'cn_plant', action: 'reassign', escalateTo: 'procurement_supervisor' }` in the node config. `clock` must be written: its default, `'wall_clock'`, counts nights, weekends and holidays. Under `working_time` the hours count on a working calendar: the `calendar` code, else the organization's default calendar, else refused, never wall-clock time. The calendar is `sys_work_calendar` data each organization maintains in Setup, so the app declares no calendar or holiday object and no hook that stamps the deadline. While the calendar cannot count the deadline (no such calendar, or not maintained that far) the request does not escalate and the inbox shows why, until the calendar is fixed. `calendar` without `clock: 'working_time'` is a lint error (`approval-escalation-calendar-without-working-time`).",
@@ -347,7 +343,7 @@ Object-hook `ctx` is a different vocabulary — see **objectstack-data**
347
343
|`onEmptyApprovers`| What an EMPTY resolved slate does: `admin_rescue` (default — request opens on the organization's administrators; never waves through, never kills the run), `fail` (node fails — treat an empty slate as a config bug), `auto_approve` (skip the request, continue down `approve` with `output.autoApproved = true` — opt-in because it silently waves the record through), `fallback` (request opens on the sibling `fallbackApprovers` instead — same shape as `approvers`, required by this policy and refused under any other; a fallback that itself resolves to nobody degrades to `admin_rescue`). Declare it explicitly on any node with an `expression` approver (linted) |
348
344
|`excludeSubmitter`|`true` drops the run's submitter (`submitter_id`) from the resolved slate, whatever approver type produced them — segregation of duties; a slate it empties takes the `onEmptyApprovers` route, never a silent pass. `onEmptyApprovers: 'auto_approve'` is **refused** beside it (it would approve exactly the request this exists to stop): use `admin_rescue`, `fail` or `fallback`. Default `false`|
349
345
|`decisionOutputs`| Decision outputs a decision may carry: bare keys (free text) **or typed declarations**`{ key, label?, type: 'text'\|'user'\|'department'\|'position'\|'team', multiple?, required? }`, enforced at the decision — see *Recording a decision*|
350
-
|`escalation`| Optional per-node SLA — `{ enabled, timeoutHours, action: reassign\|auto_approve\|auto_reject\|notify, escalateTo?, notifySubmitter }`. `timeoutHours`is **calendar (wall-clock) hours** — nights, weekends and holidays count; the platform ships no business-hours calendar. `escalateTo` is a **position machine name** (expanded to its holders via `sys_user_position`, ADR-0090 D3) or a specific user id — never a membership tier. `reassign` without `escalateTo` degrades to notify (linted) |
346
+
|`escalation`| Optional per-node SLA — `{ enabled, timeoutHours, clock, calendar?, action: reassign\|auto_approve\|auto_reject\|notify, escalateTo?, notifySubmitter }`. `clock` sets how `timeoutHours`counts: `'wall_clock'` (default) counts nights, weekends and holidays; `'working_time'` counts working hours on a working calendar (`sys_work_calendar`, maintained per organization in Setup): the `calendar` code, else the organization's default, else refused — never wall-clock. While the calendar cannot count the deadline (none resolves, or not maintained that far) the request does not escalate: its row carries `sla_due_refusal` instead of `sla_due_at`, the inbox shows why, and each sweep retries. `calendar` without `clock: 'working_time'` is lint error `approval-escalation-calendar-without-working-time`. `escalateTo` is a **position machine name** (resolved like a `position` approver) or a specific user id — never a membership tier. `reassign` without `escalateTo` degrades to notify (linted) |
351
347
|`maxRevisions`| Send-backs per run before auto-reject (ADR-0044) |
0 commit comments