Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/changes/unreleased/2909-reference-task-says-so.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
kind: changed
title: A task that only reads its folder says so when it starts, to its worker, and when it lands
pr: 2909
surface: [engine, chat]
invalidates:
- "A task whose stand is a reference (TaskModeReference, a ground it only reads) was told so on its receipt only when `where` named a folder holding the home folder (homeTaskRedirect). Where the proposal's `ground` or its brief had chosen the folder, the receipt read \"It works in <ground>, the folder this proposal gave as its ground.\" or \"It works in <ground>, the one folder its brief names the work in.\", the home folder included; on the other rungs it had no sentence about the folder. On every rung the receipt of a task the conversation's model proposes now reads \"It reads <ground> and writes only in a folder of its own, so nothing in <ground> changes: this proposal named no file there by full path. If the work is meant to change <ground>, stop this task and propose it again naming the files it makes or changes by their full path under <ground>.\" (taskReadsSentence), or over the home folder \"The task reads <ground> and keeps what it makes in its own folder; nothing in <ground> changes.\" whichever door named the folder. The started receipt of such a task now opens \"It works from the brief alone, in a folder of its own.\"; every other task's still opens \"It works from the brief alone, in a copy of its own.\" (taskReceipt). A task a person types with `/task` is handed no receipt sentence about its folder on the run road, and on the older single-task road only the stand's redirect, as before."
- "A reference worker was told \"<ground> is yours to read, not to change. Everything you make goes in <dir>, your own folder. In your report, say where in that folder the results are.\" only when its ground held the home folder (taskCopy.readsHome, withHomeReadingNote); over any other ground it was told nothing. Every reference worker whose folder is not its ground is now told \"<ground> is yours to read, not to change. Everything you make goes in <dir>, your own folder, and stays there: nothing you make reaches <ground>. In your report, say where in that folder the results are, and never say the work is in <ground>.\" (taskReadsNote; the field is taskCopy.reads, and the run's helper is withTaskReadsNote)."
- "A run that only read its ground was handed to the engine's landing, which failed in its folder with \"fatal: not a git repository\": a plan note \"the run's landing failed\" was filed, the landing had no line (RunLanding.Line empty, no branch) and the run's page got no homecoming note. Such a run is no longer handed to the engine's landing (landReferenceRun): its landing line reads \"it changed nothing in <ground>: what it made is in <its folder>\" (referenceLandingLine), and its page carries that line once, in the run's outcome note, with no separate homecoming note. A reference run that failed is given the same line; one that was stopped is given none. A reference run recovered after the process ended between its plan finishing and its landing still waits for the person to accept it (completedRunReview); accepting it took the git landing in its folder and failed with the same error, and it now takes this landing and line instead (acceptCompletedRun). A recovered run whose plan had already failed is settled with its failure alone, without the line."
- "A reference whose proposal asked for `where: \"in place\"` inside a repository had the redirect \"in place was asked for, and <ground> is a repository — the work goes on a branch cut from it instead\" printed on its receipt. The stand still carries that redirect, and the receipt of a reference no longer prints it (taskStandRedirect)."
- "A hand-off that joined a live run was told about its own stand: a reference that joined a run working in a copy of the same ground got the read-only receipt and its worker the read-only note. The receipt sentence and the worker's note of a joined hand-off are now decided by the mode of the run it joined (startOrJoinTaskRunVia answers that mode). A hand-off that joined a run which only reads its ground, the home folder apart, is not given the starting task's sentence or \"It joined the work already underway and shares its copy.\": its receipt reads \"It joined the work already underway, which only reads <ground> and writes in a folder of its own, so nothing in <ground> changes while it is part of that run. To change <ground>, propose the work once that run has ended.\" (taskJoinedReadsSentence), whatever files its own proposal named."
- "Over the home folder, the read-only note of a run was appended to the run's brief before its crew was routed (withHomeReadingNote in startOrJoinTaskRunVia), so the brief a crew kept (taskCrew.brief, TaskCrewRecord.Brief) and the text it was routed on carried the note. Over every ground a run only reads, the note is now added only to what the workers are given: the store's root description, RunSpec.Brief, and the brief a deferred run keeps (beltRun.brief, PendingRunRecord.Brief). The crew's kept brief, which `/redo stronger` and a rerun with routing read again as a contract, is the brief as it was handed in."
- "The manager's first law ended \"Asked what is happening, answer from the team.\" It now adds \"A task (propose_task) is not a member: use one only for work no member is here for, or when the person asks for a task, and never to get round a member that did not start. When a member did not start, team_send's answer says why: tell the person that.\" The law's earlier sentences are as they were."
---

A proposal that named a repository as its ground and no file by path was read as
work that only reads it. The worker built the project in its own folder, reported
it integrated, and the conversation told the person to run it from a repository
nothing had been written to.
34 changes: 33 additions & 1 deletion internal/manual/chat/how-tasks-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ rung asks, in the two names you already know. An explicit existing `ground` stil
every other rung, even when it is a third folder not offered by that question; the receipt
says where in words, `It works in <folder>, the folder this proposal gave as its ground.`,
so a wrong choice is visible immediately. A stand read from the brief is said the same way:
`It works in <folder>, the one folder its brief names the work in.`
`It works in <folder>, the one folder its brief names the work in.` A task that only reads
its ground is the exception: its receipt says `It reads <folder> and writes only in a folder
of its own` instead (see **A task built my project somewhere else**).

**How it stands on that ground is not asked either — it follows from the work.** A
repository the task writes in gets a working copy of its own, on a branch cut **from that
Expand All @@ -108,6 +110,36 @@ something the evidence did not — though nothing ever overrides a path you name
The check runs where the work stood, cut from the same ground; the card and the `/history`
row carry the ground and how the task stood on it.

## A task built my project somewhere else — it only read my repository, nothing changed in my folder, where is what the task made

A task whose whole contract names no file to make or change is treated as reading its
repository when something chose that repository for it: the proposal's `ground`, its brief,
a place the conversation remembered, or the files the conversation has been working with.
It gets an empty folder of its own and the repository is left alone, even when the
conversation was opened there. A task nothing placed, which simply takes the repository
the conversation stands in, gets a working copy on a branch instead.

Naming a project in words is not naming a file, so "build the app in the MacStats repo"
with `~/MacStats` as its `ground` reads this way. So does a relative path such as
`Sources/App/main.swift` when neither the file nor its folder is there yet.

Such a task says so wherever there is somebody to tell. One the conversation's model
proposes says it in its receipt: `It reads <folder> and writes only in a folder of its own,
so nothing in <folder> changes`, and to stop it and propose it again naming the files it
makes or changes by their full path under that folder. A task you type with `/task` has no
such receipt. Every such task tells its worker the folder is to read, not to change, and
never to report the work as being there. A task run as a run ends its landing `it changed
nothing in <folder>: what it made is in <its own folder>`; the older single-task road lands
without that line.

A proposed task that joins a run already underway is told what is true of that run
instead. Joining one that only reads the folder, its receipt says `nothing in <folder>
changes while it is part of that run`, whatever files it named, and to propose the work
once that run has ended.

To have the work done in the repository, name a file under it by full path in the brief, in
what to produce or in the done-when, such as `~/MacStats/Sources/App/main.swift`.

## Does a task touch my working copy? — where does my task work, what the card calls the task's directory

**A quick task is the exception, and not a small one.** It has no checkout and no branch
Expand Down
5 changes: 5 additions & 0 deletions internal/manual/chat/team-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,11 @@ on one waits for you.
| `team_link` | records a file, pull request, issue or job the crew made as the crew's work, so the desktop app lists it with the crew (see **Link what the crew made**) | no |
| `team_raise` | raises a conflict to the manager above every party (see **Conflicts between members and teams**); members have it too | no |

A manager hands work to members. It is told a task (`propose_task`) is not a member: a task
is for work no member is there for, or for when you ask for one, and never a way round a
member that did not start. When a member did not start, `team_send` says why, and the
manager is to tell you that.

## Link what the crew made — team_link, add a file or pull request to the crew

A manager records what its crew produced with `team_link`: `ref` is a file path (relative to
Expand Down
5 changes: 4 additions & 1 deletion internal/manual/chat/worker-harness.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ works in that one copy.

**A second `/task` joins the run already underway** when it is about the same folder:
the new work becomes a child of the run's root, shares the run's copy, and its answer
says `It joined the work already underway and shares its copy.` A proposed task about
says `It joined the work already underway and shares its copy.` The exception is a run that
only reads its folder, the home folder apart: there is no copy to share, and a proposed
task that joins it is told `It joined the work already underway, which only reads <folder>
and writes in a folder of its own` instead. A proposed task about
ANOTHER folder is refused while that run is underway, with both folders named and
`tasks that run together share one copy of one folder. Propose it again when that work
has ended`. A task handed off after the run has ended starts a run of its own, in a new
Expand Down
100 changes: 90 additions & 10 deletions internal/session/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -1091,14 +1091,18 @@ func (a *Agent) startApprovedHandoff(ctx context.Context, p *stagedProposal, spe
ctx = withProgramWish(ctx, programWish{thinking: spec.thinking, carry: a.programCarryOf(prior, via.Name)})
}
a.expectRunSource(p.id, spec.source)
joined, err := a.startOrJoinTaskRunVia(context.WithoutCancel(ctx), p.id, spec.title, proposalRunDescription(spec, via, placement), spec.dependsOn, stand, question, via, asked...)
mode, joined, err := a.startOrJoinTaskRunVia(context.WithoutCancel(ctx), p.id, spec.title, proposalRunDescription(spec, via, placement), spec.dependsOn, stand, question, via, asked...)
a.rollbackFailedProgramStart(via, p.id, prior, err)
if joined {
stand.mode = mode
}
return handoffStart{joined: joined, stand: stand, asked: asked, placed: placement.sentence}, err
}

// handoffStart is what starting an approved hand-off settled: whether it
// joined a run already underway, the stand it runs on, the programs asked
// for, and the sentence that says which computer it was placed on.
// joined a run already underway, the stand it runs on (in the joined run's
// mode when it joined one), the programs asked for, and the sentence that says
// which computer it was placed on.
type handoffStart struct {
joined bool
stand taskStand
Expand Down Expand Up @@ -1143,12 +1147,26 @@ func (a *Agent) handoffAnswer(p *stagedProposal, spec taskSpec, elsewhere string
return refusal.Error(), true, true
}
if err == nil {
receipt := taskReceipt(p.id, spec, TaskRunning, p.stand, elsewhere)
said, shares := p.stand, "It joined the work already underway and shares its copy."
if joined {
// A TASK THAT JOINED A RUN IS SAID AS THAT RUN STANDS. It shares the
// run's copy, so a receipt read off its own stand told a reference
// that joined a worktree that nothing in the ground would change.
said.mode = stand.mode
// AND A RUN THAT ONLY READS IS SAID AS THE RUN'S DOING, never the
// proposal's: the starting task's sentence told a proposal that had
// named its files by full path that it named none, and to propose
// again, which joins the same run.
if reads := taskJoinedReadsSentence(said); reads != "" {
said, shares = taskStand{}, reads
}
}
receipt := taskReceipt(p.id, spec, TaskRunning, said, elsewhere)
switch {
case via != nil:
receipt = delegateStartedReceipt(p.id, spec.title, strings.Join(asked, ", "), delegateReceipt(canonicalPath(stand.dir), *via, a.runRowCopy(p.id)), elsewhere)
case joined:
receipt = withReport(receipt, "It joined the work already underway and shares its copy.")
receipt = withReport(receipt, shares)
}
return receipt, false, true
}
Expand Down Expand Up @@ -1211,10 +1229,16 @@ func taskReceipt(id uint64, spec taskSpec, state TaskState, stand taskStand, els
}
if state == TaskQueued {
result := fmt.Sprintf("task %d queued%s: %s\nIt starts when the work it waits on has finished and a slot is free. %s", id, on, spec.title, taskHandoffWakeSentence)
return withElsewhere(withReport(withReport(result, taskStandSentence(stand)), stand.redirect), elsewhere)
return withElsewhere(withReport(withReport(result, taskStandSentence(stand)), taskStandRedirect(stand)), elsewhere)
}
// A reference has no copy: the sentence after this one says it writes only
// in a folder of its own, and the opener may not say otherwise first.
own := "copy"
if stand.mode == TaskModeReference {
own = "folder"
}
result := fmt.Sprintf("task %d started%s: %s\nIt works from the brief alone, in a copy of its own. %s", id, on, spec.title, taskHandoffWakeSentence)
return withElsewhere(withReport(withReport(result, taskStandSentence(stand)), stand.redirect), elsewhere)
result := fmt.Sprintf("task %d started%s: %s\nIt works from the brief alone, in a %s of its own. %s", id, on, spec.title, own, taskHandoffWakeSentence)
return withElsewhere(withReport(withReport(result, taskStandSentence(stand)), taskStandRedirect(stand)), elsewhere)
}

// taskStandSentence says WHERE the task works whenever that was read from the
Expand All @@ -1227,12 +1251,24 @@ func taskReceipt(id uint64, spec taskSpec, state TaskState, stand taskStand, els
// offered is accepted (it is somebody saying where the work is), and this line
// is what makes a wrong one visible in the same breath rather than when the
// work lands somewhere nobody looked. The rungs that read the conversation
// instead are silent here, as they always were: the work went where the
// conversation already is.
// instead are silent here when the task works in its ground: the work went
// where the conversation already is. A task that only reads its ground speaks
// on every rung, because its work goes somewhere else.
func taskStandSentence(stand taskStand) string {
switch {
case stand.dir == "":
return ""
case stand.mode == TaskModeReference && HoldsHomeFolder(stand.dir):
// The home folder has its own sentence, said here whichever door named
// it: only the `where` doors leave it on the stand as a redirect, and a
// home folder given as `ground` read "It works in <home>".
return homeTaskRedirect(stand.dir)
case stand.mode == TaskModeReference:
// A REFERENCE IS SAID AS ONE, in the same breath as the start. "It
// works in <ground>" was true of where the task looks and false of
// where its work goes, and the proposer told the person the work was
// in the ground (task_brief.go's [copyOnto] has the run).
return taskReadsSentence(stand.dir)
case stand.rung == taskGroundBrief:
return "It works in " + stand.dir + ", the one folder its brief names the work in."
case stand.rung == taskGroundSaid && !stand.kept:
Expand All @@ -1241,6 +1277,50 @@ func taskStandSentence(stand taskStand) string {
return ""
}

// taskStandRedirect is the stand's redirect as a receipt prints it. A reference
// has said where its work goes ([taskStandSentence]) and cuts no branch, so the
// redirect a declined `in place` leaves on its stand
// ([groundModeAfterPlacement]) would contradict the sentence before it, and the
// home folder's redirect would say that sentence twice.
func taskStandRedirect(stand taskStand) string {
if stand.mode == TaskModeReference {
return ""
}
return stand.redirect
}

// taskReadsSentence is what a proposer reads when its task only reads the
// ground: where the work will be, that the ground does not change, and what to
// do when that is not what was meant. The home folder has its own sentence
// ([homeTaskRedirect]).
//
// THE REMEDY IS A FULL PATH, because that is the one spelling that always
// counts: a relative path is read as work under the ground only when the file
// or its folder is already there ([groundHolds]), so "create
// Sources/App/main.swift" in a repository with no Sources folder was proposed
// again and was a reference again.
func taskReadsSentence(dir string) string {
dir = cleanFolder(dir)
return "It reads " + dir + " and writes only in a folder of its own, so nothing in " + dir + " changes: this proposal named no file there by full path. " +
"If the work is meant to change " + dir + ", stop this task and propose it again naming the files it makes or changes by their full path under " + dir + "."
}

// taskJoinedReadsSentence is what a proposer reads when its task joined a run
// already underway that only reads the ground, and nothing for any other
// stand. What the proposal named does not decide it and proposing again
// changes nothing while that run lives, so it says neither
// ([taskReadsSentence]) and names the one thing that does: the run's ending.
// The home folder is only ever read and keeps its own sentence
// ([homeTaskRedirect]).
func taskJoinedReadsSentence(stand taskStand) string {
if stand.mode != TaskModeReference || stand.dir == "" || HoldsHomeFolder(stand.dir) {
return ""
}
dir := cleanFolder(stand.dir)
return "It joined the work already underway, which only reads " + dir + " and writes in a folder of its own, so nothing in " + dir + " changes while it is part of that run. " +
"To change " + dir + ", propose the work once that run has ended."
}

// taskHandoffWakeSentence is what EVERY handoff receipt ends with, and it is one
// sentence because it answers one question: what does the model do now?
//
Expand Down
Loading