oficina / agent-access Public

Clone
git clone https://amadan.net/oficina/agent-access

Plain git — no account needed to clone.

Download this file

1# Resumable cross-app scheduling
2
3Status: November 1 draft by GPT-6 Astra, independently reviewed and approved by GPT-6 Astra (review_docs_access), November 1. The user
4authorized implementing the everyday editing APIs, shared conventions and one
5substantial workflow including interruption, retry and revoked access.
6
7## Boundary
8
9`calls_schedule` is a synchronous composite operation in the connection gateway.
10It creates an optional Docs agenda, a Calls meeting and a Calendar event holding
11their member-facing URLs. It sends no invitations, grants no new access and
12does not claim a reservation from advisory free/busy. It never deletes objects
13automatically to undo a partial result. There is no cross-app transaction.
14
15The gateway stores no workflow inputs, results or credentials. Durable state
16is the workflow fingerprint reservation in the selected team's Calls database
17plus each app's existing atomic create receipts. Resumption means submitting the
18same UUID and original arguments again, even after every process restarts.
19This is not a background job, autonomous retry service or a status-only API.
20The client must retain its original request. No cross-team composition exists.
21
22## Input and reservation
23
24Input: `{team,client_id,title,calendar_id,start,end,tz,notes,agenda?}`. `start`
25and `end` are RFC3339 instants with explicit offsets; `tz` is an IANA zone.
26The offsets must match that zone at both instants, end must follow start, and
27local date/time conversion must round-trip without ambiguity. Calendar's own
28validator is authoritative. `agenda` contains a title and the bounded literal
29blocks accepted by `docs_create`. Unknown fields are rejected.
30
31Before any content effect, validate all known downstream inputs against
32the configured exported schemas, every required route for this exact team, and
33all scopes: `calls:read`, `calls:write`, `calendar:read`, `calendar:write`, plus
34`docs:read` and `docs:write` for an agenda.
35Each step obtains a fresh audience-bound credential using the original current
36principal. Current directory membership and destination checks remain in force.
37
38New app operation `calls_reserve_schedule` (`calls:write`) takes
39`{team,client_id,fingerprint}` and returns `{reserved:true}`. The fingerprint
40is the lower-case SHA-256 of the normalized complete typed workflow request,
41including version `1`. Calls stores only keyed fingerprints: a domain-separated
42coordinate binding identity/delegation issuers, subject, client, team, operation
43and UUID, and a keyed fingerprint of the supplied digest. No title, event text,
44agenda, credentials or remote resource coordinates are persisted there. The
45reservation is atomic, stable across restart and bound by existing immutable
46authority configuration. Same UUID/different fingerprint refuses before effects.
47The operation can also be called directly; it only reserves a fingerprint, never
48claims that another app committed a step and never grants authority.
49
50The gateway derives distinct deterministic nonzero UUIDs for agenda, meeting and
51event from the root UUID and a versioned step namespace. Existing app receipts
52also bind person/client/team/authority; two people using the same UUID cannot
53collide. The full-input reservation prevents changed later fields from causing
54partial changes under an already-used workflow UUID. There is no receipt expiry
55that permits implicit recreation within this implementation.
56
57## Execution and results
58
59Order: reserve, optional agenda, meeting, event. After each success record only
60the response in transient memory. The Calendar event gets explicit local start,
61end and zone, `kind:meeting`, confirmed status, supplied notes plus canonical agenda
62and meeting member URLs. Exact enum values follow the exported app contract.
63URLs are checked against the corresponding configured app origin and known
64resource route; no external response URL is fetched. Invitations remain false.
65
66Replays execute the same sequence with the same step IDs. App receipts return
67the prior resources and preserve later manual changes. If a prior resource was
68deleted or access was removed, stop; do not recreate it or skip the failure.
69An ambiguous/lost response is retried only with the same step UUID. Concurrent
70requests rely on each app's atomic uniqueness and receipt transaction.
71
72Result: workflow UUID, team, `status:complete|partial`, confirmed step references,
73`invitations_sent:false`, and, on partial completion, a failed step plus a fixed
74failure code. Unattempted steps are distinguishable from confirmed steps. A
75failed request may nevertheless have committed; failure is not a nonexistence
76claim. When authorization is lost, return an authorization failure without
77previously selected resource details. On other errors, revalidate selected
78resources under current authority before releasing partial details. Completed
79responses likewise revalidate selected resources. A later retry rediscovers
80progress through receipts, not an unverified checkpoint supplied by a client.
81
82## Evidence
83
84Use exported app contracts to validate every step and the composite contract.
85Test whole success, missing scope/route before effects, changed-input reservation,
86failure and lost response after each commit, full restart and replay, concurrent
87retries, deletion/manual edit after partial completion, same UUID across users,
88revocation between each step and before response, false/foreign URLs, DST gaps
89and folds, result limits, HTTP/CLI/MCP parity, and real app store effects.
90Remove reservation binding, step-ID stability and revalidation separately to
91prove the behavioral gates fail. Source review precedes deployment; existing
92team adoption and scoped infrastructure approval remain separate live gates.
93
94## Review resolutions (November 1)
95
96Require read scopes as well as write scopes. Resource revalidation uses only
97`docs_get`, `calls_get_meeting`, and `calendar_get_event`, never mutation replay.
98Before every step and after all read checks, validate every required scope/team/
99destination through the credential provider against the original immutable
100Subject/Client/Grant. Any unavailable/refused revalidation suppresses all
101references. HTTP uses the existing guarded emission path before headers/chunks;
102MCP revalidates before returning the bounded tool result to the SDK. There is no
103claim of a cross-app atomic snapshot or byte-by-byte authorization inside the SDK.
104
105Preflight validates known fields only. Generated URLs are validated against
106trusted routes and schemas before subsequent use; authoritative app validation
107can still refuse a later step and leave an honest partial result. No pure
108Calendar preflight endpoint is claimed. Calendar local minute precision requires
109zero input seconds/nanoseconds; offsets and ambiguity are checked before effects.
110
111The fingerprint is SHA-256 of JSON for a version-1 typed request, with exact
112int64 calendar ID and fields in declared order. UUID spelling is canonical;
113title/notes/zone and canonical RFC3339 start/end spelling are preserved. Agenda
114absence is nil; paragraph level omission normalizes to zero. Versioned step IDs
115are RFC4122 v5 using namespace 8ba3600d-9e03-52df-8c34-9ff05a6e66cb and the exact
116name `oficina.schedule.v1/<root UUID>/<agenda|meeting|event>`. Receipts additionally
117bind actor, client and team. Responses are limited below 64 KiB.
118
119
120## Implementation evidence (2026-11-01)
121
122The opt-in `TestSuiteSchedulingInterop` passed against the real Docs, Calls and
123Calendar delegated HTTP handlers, their exported contracts, sealed stores and
124atomic create receipts. The CLI adapter observed a partial result after a
125transport deliberately lost Calendar's committed reply. A fresh gateway's MCP
126server completed the unchanged request, returned identical resources on replay,
127and exposed the expected agenda body and both cross-app URLs in the event.
128Changed arguments conflicted and revoked credentials refused resumption.
129`python3 scripts/suite-interop.py` reproduces this with temporary private stores.
130This does not establish deployed Home/team setup or hosted-client acceptance.
131
132The shared tests additionally drop responses after every step, reject revoked
133read scopes before writes, withhold results after revocation, reject foreign
134resource URLs, recheck deleted resources with pure reads, reject malformed
135Unicode before reservation, reject DST folds/gaps, and recheck authority at the
136MCP result-return seam after registry output validation.
137
138Independent GPT-6 Astra review selected six shared-runtime fault mutations:
139accept malformed Unicode, omit the MCP final guard, omit final resource checks,
140skip an earlier app's scope, accept a foreign URL, and randomize retry step IDs.
141Each caused a behavioral test failure; no build failure counted as detection.
142All original sources were restored. Resource references additionally validate
143against the destination's read schema and member-route ID shape before use;
144the response guard verifies the step, app, ID and canonical URL together.
145
146Final shared implementation review: GPT-6 Astra (`review_docs_access`) approved
147on 2026-11-01 after inspecting source, all six effective mutation failures and
148the three-app acceptance evidence. The restored source passed `make ci`,
149including all-package race tests. Calls roster reconciliation and reservation
150have their own app review and gate; live four-client acceptance remains pending.
151