Skip to content

Landing and why notes

wayglass land takes an approved change to the trunk:

  1. The Worker checks that the caller is the intent’s author or the admin (not_author otherwise), that the intent’s latest decision is approved, that the fork head is still the commit that was decided, that the trunk’s .wayglass/policy.yaml is still the one the decision was made under (policy_changed otherwise), 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.
  2. The CLI fetches the trunk. If the trunk head is no longer what the Worker recorded, it stops with trunk_moved and pushes nothing; run land again. land works 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.
  3. 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).
  4. 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.
  5. 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.
  6. If .wayglass/config.yaml sets mirror (a git remote name such as origin), the CLI pushes the trunk branch and notes there, with your own git credentials, never an Artifacts token. --no-mirror skips this.
  7. 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.

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_paths and sets trunk_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.yaml changed since (or the Worker cannot tell which policy decided it), land stops with policy_changed before any trunk token is issued.

The user’s checkout and branches are not touched by the merge; it happens in a throwaway worktree.

All three refusals have the same recovery, run in the intent’s own clone:

Terminal window
wayglass sync # merges the trunk (and its policy) into the intent; never rebases
wayglass push
wayglass propose # decided again, under the current trunk and policy

wayglass 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.

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.

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:

Terminal window
wayglass log --limit 20
wayglass log --intent i5e39df9bcd --json
wayglass log --kind decision