Repository navigation
feat(workspace): work kind contract link, tier, intent source, attempt limit, closed lease outcomes and kept attempts - #3298
Merged
Merged
Conversation
…t limit, closed lease outcomes and kept attempts The work kind gains what studio kept under x-factory on work items. The work block can name a contract kind, the builder tiers a workspace allows, an attempt limit with a per-item override, and the answer kind whose answers records joins onto each item by id. The reference schema adds contract, tier, max_attempts, result.lease and a source.intent form. Lease outcomes are a closed list. work history reports which claims count as attempts, the item's attempts against its limit, and its kept attempts. An Op that changes the checkout and ends not_done keeps its work at refs/chant/kept/[<member>/]<item>/<token> and resets the work branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The work kind gains the fields studio keeps under x-factory on work items, so a factory can read and write them through chant.
The work kind's work block takes four new optional entries. contract names the field holding the contract record an item builds and that contract's kind file; records --json gives each item contract { id, state } and warns work-contract-unknown or work-contract-undecided. tier names the item's tier field and lists the allowed tiers once; a tier outside them is warned work-tier-unknown. attempts names an item's own limit field and the kind's default max. answers names the answer kind, and records --json gives each item answers, every decision-point answer whose constrains holds the item's id, read from the tree and, in the working tree, from the answers a steward keeps on chant/lifecycle. The answer is joined by id and never copied onto the item.
The reference work schema adds contract, tier, max_attempts, result (only lease) and a fifth source form, source.intent { decision, question, answer, by, at }. The reference kind declares tiers small, medium and large, a default of 3 attempts, and the answer kind. It declares no contract link, since the reference workspace has no contract kind until #3148.
Lease outcomes are now a closed list in work-lease.schema.json: done, not_done, abandoned, gated, waiting, dropped, redraft and ask. work release --outcome refuses anything else with write-usage-invalid, and an Op whose step names a word outside the list is released not_done with a note. Only not_done and abandoned count as attempts, together with a release with no outcome or legacy free text, and a claim that expired or was lost. work history --json adds attempt and kept on each claim, attempts { failed, limit, remaining, exhausted } and kept on the document.
An Op that changes the checkout and ends not_done now keeps its attempt: committed and uncommitted work in the worktree is committed to refs/chant/kept/[/]/ and the work branch goes back to where the run started. The run result reports it in workLease.kept. Replicating those refs is #3172.
The new warning codes are in reason-codes.ts and in the records and intent schemas. Every addition is within contract 1. Docs: guide/work-items, cli/workspace-work, cli/workspace-records, cli/run, guide/ops and the read-contract page.
Verified with core tsc, targeted vitest (work, work history, the new work-kind-fields test, work lease and work-lease-run including the kept-attempt runs, reason codes, read contract, records, intent, points, status, the reference workspace test and the records goldens), the core unit suite, just docs-check and the docs prose ratchet.
Closes #3147