Landing and why notes
What land does
Section titled “What land does”wayglass land takes an approved change to the trunk:
- The Worker checks that the caller is the intent’s author or the admin (
not_authorotherwise), that the intent’s latest decision isapproved, that the fork head is still the commit that was decided, that the trunk’s.wayglass/policy.yamlis still the one the decision was made under (policy_changedotherwise), that a stacked intent’s parent has landed, and that no other land is in progress for the project. Then it mints a trunk write token valid for 300 seconds and records the trunk head at that moment. - The CLI fetches the trunk. If the trunk head is no longer what the Worker recorded, it stops with
trunk_movedand pushes nothing; runlandagain.landworks from any checkout of the project, not only the author’s: when the approved commit is not present locally, it fetches the intent’s fork with a 300-second read token and refuses unless the fork head is exactly the decided commit. - If the approved commit already contains the trunk head, it lands as a fast-forward. Otherwise the CLI merges it onto the trunk in a temporary worktree (see below).
- It pushes the result to the trunk, writes the why note on the landed commit (and on the approved commit, if a merge was needed), and pushes
refs/notes/wayglass. - The Worker revokes the trunk token and verifies that the trunk now holds exactly the approved change: the approved commit itself, or a merge of it that touches only the decided paths. A mismatch is recorded in the audit log as
land.mismatch. - If
.wayglass/config.yamlsetsmirror(a git remote name such asorigin), the CLI pushes the trunk branch and notes there, with your own git credentials, never an Artifacts token.--no-mirrorskips this. - The local branch is fast-forwarded to the landed commit when that loses nothing (clean checkout, no divergence).
Until the Worker has verified the trunk, any failure hands the land back at once (land/abort): the trunk token is revoked and the next agent can land without waiting for it to expire.
Merge, never rebase
Section titled “Merge, never rebase”When other changes landed after the intent forked, land merges the approved commit onto the newer trunk with git merge --no-ff. It never rebases, so the commit that lands is the one policy classified and someone approved.
- Edits that git merges cleanly in the decided files land. JSON output lists them under
merged_pathsand setstrunk_moved: true. - A conflict stops with
land_conflict. Nothing is pushed. - A merge or fast-forward that would change files the decision did not cover stops with
repropose_required. Nothing is pushed. - A decision holds only under the trunk policy it was made under. If the trunk’s
.wayglass/policy.yamlchanged since (or the Worker cannot tell which policy decided it), land stops withpolicy_changedbefore any trunk token is issued.
The user’s checkout and branches are not touched by the merge; it happens in a throwaway worktree.
Recovering with sync
Section titled “Recovering with sync”All three refusals have the same recovery, run in the intent’s own clone:
wayglass sync # merges the trunk (and its policy) into the intent; never rebaseswayglass pushwayglass propose # decided again, under the current trunk and policywayglass sync fetches the trunk with a 60-second read-only token into refs/wayglass/trunk (and its why notes into refs/notes/wayglass-trunk) and merges it into the current branch. A conflict stops with sync_conflict and lists the files in error.details.conflicts, leaving the merge in progress: resolve them, git add, git commit --no-edit, then push and propose. The new decision covers only the intent’s own change (merged trunk files do not count; edits made while resolving do), so a one-file change stays a one-file change. sync refuses a checkout that is not the intent’s clone (not_fork_clone) and a stacked intent whose parent has not landed.
Why notes
Section titled “Why notes”The why lives in git, under refs/notes/wayglass, attached to the landed commit. The note body is JSON:
| Field | Meaning |
|---|---|
v |
Note format version |
intent_id, goal, reason |
The intent, as declared |
tags |
Area, data class, risk and jurisdiction, with evidence |
rule, action |
The rule that matched and the action it chose |
decision_id, status |
The Worker’s decision record |
decided_by, decided_at |
policy for automatic decisions, otherwise the approver |
identity_source |
access when the decider signed in through Cloudflare Access; why shows the name as you@example.com (Access) |
approvals |
Each verdict with its author, reason, time and, for Access sign-ins, identity_source |
wayglass why <file>:<line> blames the line to its commit and reads that note. If the checkout has no note for the commit, it asks the Worker, which keeps the same record. Because anyone who can push notes could forge one, why checks the note against the Worker’s decision and reports verified: worker, mismatch or unchecked (no Worker reachable). Notes are pushed to the mirror as well, so anyone with a clone can run git fetch origin refs/notes/wayglass:refs/notes/wayglass and read them; a checkout made by wayglass clone fetches them from the trunk directly.
Notes survive an Artifacts fork, so a forked session also carries the why of everything that landed before it.
The audit log
Section titled “The audit log”Separately from the notes, the Worker keeps an append-only audit log per project: intents declared and pushed, overlaps, decisions with their rule and reason, approvals with theirs, land tokens issued, lands, aborts and mismatches, and trunk pushes reported by Artifacts events. Read it with wayglass log:
wayglass log --limit 20wayglass log --intent i5e39df9bcd --jsonwayglass log --kind decision