Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1467041
teams: a hand-off says what happened to it; pause is the team's recor…
ZeroPoint95 Nov 24, 2026
e4aa746
docs: change entry for the crew hand-off outcome (#2897)
ZeroPoint95 Nov 24, 2026
12df45b
teams: review round 1 repairs
ZeroPoint95 Nov 24, 2026
a2b9c99
teams: review round 2 repairs
ZeroPoint95 Nov 24, 2026
6f45b54
teams: a stop in a team holds when a background command ends
ZeroPoint95 Nov 24, 2026
800bc61
teams: a stop also holds a member that only waits on its command
ZeroPoint95 Nov 25, 2026
2bccf57
teams: the global manager is not woken by a top-level manager's turn …
ZeroPoint95 Nov 25, 2026
9ff0c23
docs: change entry for the quiet global manager (#2906)
ZeroPoint95 Nov 25, 2026
4ea2a12
docs: end each changed statement in the quiet global manager entry wi…
ZeroPoint95 Nov 25, 2026
aeb3e9e
tasks: a task that only reads its ground says so when it starts, to i…
ZeroPoint95 Nov 25, 2026
025de95
docs: change entry for a reference task saying so (#2909)
ZeroPoint95 Nov 25, 2026
cedee02
teams: review round 1 repairs for the quiet global manager
ZeroPoint95 Nov 25, 2026
7764a0f
teams: final review round 1 repairs
ZeroPoint95 Nov 25, 2026
648ea9d
tasks: final review round 1 repairs for a reference saying so
ZeroPoint95 Nov 25, 2026
1050b3c
Merge branch 'zeropoint95/crew-delegation' into zeropoint95/crew-quie…
ZeroPoint95 Nov 25, 2026
b95b285
Merge branch 'zeropoint95/crew-quiet-afi' into zeropoint95/crew-task-…
ZeroPoint95 Nov 25, 2026
0bee31a
teams: final review round 2 repairs for the quiet global manager
ZeroPoint95 Nov 25, 2026
82a0c3b
tasks: final review round 2 repairs for a reference saying so
ZeroPoint95 Nov 25, 2026
c2f783a
teams: final review round 2 repairs
ZeroPoint95 Nov 25, 2026
e5ba063
Merge branch 'zeropoint95/crew-quiet-afi' into zeropoint95/crew-task-…
ZeroPoint95 Nov 25, 2026
55d676e
Merge branch 'zeropoint95/crew-delegation' into zeropoint95/crew-quie…
ZeroPoint95 Nov 25, 2026
799f186
Merge branch 'zeropoint95/crew-quiet-afi' into zeropoint95/crew-task-…
ZeroPoint95 Nov 25, 2026
9b88b57
teams: final review round 3 repair
ZeroPoint95 Nov 25, 2026
57fac54
teams: final review round 3 repairs for the quiet global manager
ZeroPoint95 Nov 25, 2026
126517e
Merge branch 'zeropoint95/crew-delegation' into zeropoint95/crew-quie…
ZeroPoint95 Nov 25, 2026
3cd3c04
tasks: final review round 3 repairs for a reference saying so
ZeroPoint95 Nov 25, 2026
3cd060a
Merge branch 'zeropoint95/crew-quiet-afi' into zeropoint95/crew-task-…
ZeroPoint95 Nov 25, 2026
51b72c1
tasks: keep the recovered-run accept under the complexity ceiling
ZeroPoint95 Nov 25, 2026
475dca2
changes: one entry for the crew delegation pull request
ZeroPoint95 Nov 25, 2026
1015854
app: a listed model says where it falls short of what the app asks
ZeroPoint95 Nov 25, 2026
f08017e
teams: one decision and one writer for the traffic watch's wakes
ZeroPoint95 Nov 25, 2026
6ecb8d6
teams: a wake is decided before the directive is read
ZeroPoint95 Nov 25, 2026
f43a0fd
teams: a fresh member's first turn is decided where the watch's wakes…
ZeroPoint95 Nov 25, 2026
2f2945f
teams: the stop hold is read where a command's ending is queued
ZeroPoint95 Nov 25, 2026
e3903ba
teams: the engine holds a paused member's other wakes too
ZeroPoint95 Nov 25, 2026
17c5e1e
teams: a stop keeps a task landing quiet, and a manager's stop reache…
ZeroPoint95 Nov 25, 2026
48edaf3
app: a model's window limit is only ever one the server measured
ZeroPoint95 Nov 25, 2026
a5e7c87
teams: a task result, the pause's owed turn and the stop look follow …
ZeroPoint95 Nov 25, 2026
1b851a6
app: a model's limit says where its window comes from, and a raised s…
ZeroPoint95 Nov 25, 2026
013d162
teams: a pause ends the turn through its own door, and Resume carries…
ZeroPoint95 Nov 25, 2026
c266357
teams: handed-over lines survive a late gate, a stop drops the direct…
ZeroPoint95 Nov 25, 2026
42c53e6
Merge dev into crew-delegation
ZeroPoint95 Nov 25, 2026
2e0131b
app: a Modelfile's window is judged by its own figure, and an unchang…
ZeroPoint95 Nov 25, 2026
4853901
teams: a pause owes its cut turn, a stop ends what it held, and Pause…
ZeroPoint95 Nov 25, 2026
3c4653a
teams: Resume says the cut step did not finish, so the member does it…
ZeroPoint95 Nov 25, 2026
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
52 changes: 47 additions & 5 deletions cmd/codeaf/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import (
"github.com/Agent-Field/codeaf/internal/home"
"github.com/Agent-Field/codeaf/internal/leave"
"github.com/Agent-Field/codeaf/internal/modelsource"
"github.com/Agent-Field/codeaf/internal/ollamalimits"
"github.com/Agent-Field/codeaf/internal/orchestrate"
"github.com/Agent-Field/codeaf/internal/provider"
"github.com/Agent-Field/codeaf/internal/redact"
Expand Down Expand Up @@ -690,7 +691,7 @@ type appBackend struct {
emit appwire.Emitter
open appOpener
// listModels answers models.list for checks that must agree with it (a
// factory step's model); nil is [appBackend.ListModels]. Tests set it.
// factory step's model); nil is [appBackend.offeredModels]. Tests set it.
listModels func() ([]appwire.Model, error)
now func() time.Time
// after is the claim-expiry clock, replaceable without sleeping in tests.
Expand Down Expand Up @@ -805,6 +806,20 @@ type appBackend struct {
// stopModelNotices removes the model completion subscription and joins
// the initial catalog waiter and cancellable sender when this app closes.
stopModelNotices func()
// tellModels says models.changed through that subscription's queue;
// ollamaRelist is the models of the Ollama service a turn's end should ask
// the app to list again (not running, or a small window, at the last list),
// ollamaRelisted those a turn has asked that for since, ollamaQuiet those
// whose asked-for list still found them unloaded, ollamaToldWindow the
// small window the first list after such a notice read, and ollamaSeen
// what this app has seen of that service's models, for the lists after
// ([appBackend.addModelLimits]).
tellModels func()
ollamaRelist map[string]bool
ollamaRelisted map[string]bool
ollamaQuiet map[string]bool
ollamaToldWindow map[string]int
ollamaSeen *ollamalimits.Memory
// state is the app's own file: setup, its settings, budgets and raises.
state *appState
// dayAuth is the daily limit's one-time hand-over from this file's old cap.
Expand Down Expand Up @@ -3279,6 +3294,11 @@ func (b *appBackend) pump(a *appAgent, id string, live *appLive, turn uint64, n
b.resetCloseAfterReply(id)
}
live.box.Event(appwire.EventTurnDone, appwire.TurnDone{Agent: id, Turn: turn, OK: ok, Error: failure, ErrorKind: kind, Status: status})
// A hosted chat's turn ran on its organisation's server, whose models are
// not this computer's Ollama ones, however alike their names.
if a.hosted == nil {
b.modelLoadedBy(live.conn.Conv.Model())
}
held := false
var view appwire.Agent
b.locked(func() {
Expand Down Expand Up @@ -4584,12 +4604,33 @@ const appModelsWait = 3 * time.Second
// Connected is the rule providers.list answers signed_in by
// ([appBackend.providerConnected]), so the two never disagree.
func (b *appBackend) ListModels() ([]appwire.Model, error) {
// What a local server says about its models is asked inside the list's
// own wait, so a list that spent the wait on a catalog asks nothing.
until := time.Now().Add(appModelsWait)
models, sources, err := b.modelRows()
if err != nil {
return nil, err
}
b.addModelLimits(until, models, sources)
return models, nil
}

// offeredModels is [appBackend.ListModels] for a check on what a person
// picked: the same rows, without the limits, which no check reads and which
// cost a question to a local server.
func (b *appBackend) offeredModels() ([]appwire.Model, error) {
models, _, err := b.modelRows()
return models, err
}

// modelRows is the rows of models.list and the services they were read from.
func (b *appBackend) modelRows() ([]appwire.Model, modelsource.Set, error) {
if !b.providerConnected() {
return []appwire.Model{}, nil
return []appwire.Model{}, modelsource.Set{}, nil
}
proc, err := b.process()
if err != nil {
return nil, appEngineError(err)
return nil, modelsource.Set{}, appEngineError(err)
}
// THE DEFAULT SERVICE'S CATALOG IS WAITED FOR EVEN WHEN ANOTHER SERVICE HAS
// ANSWERED: a list read before it lands is every other service's models
Expand Down Expand Up @@ -4695,7 +4736,7 @@ func (b *appBackend) ListModels() ([]appwire.Model, error) {
models[i].Provider = id
}
}
return models, nil
return models, sources, nil
}

// appDefaultModel is the model a new conversation runs on, by the rule every
Expand Down Expand Up @@ -5095,7 +5136,8 @@ func (b *appBackend) Close() error {
// A conversation joined on a window's host is that window's, and
// is only detached from.
if live := b.liveOf(a); live != nil && live.conn.Assembled {
live.conn.Conv.Interrupt()
// The app is leaving; the person did not press stop.
appInterruptFor(live.conn.Conv, session.StopByClosing)
}
b.letGoTimed(a, os.Stderr)
})
Expand Down
4 changes: 4 additions & 0 deletions cmd/codeaf/app_lend.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ func (l lentAgent) InterruptFor(door session.StopDoor) {
// that had not ended. The job's own Stop is the door that ends a stage.
func (l lentAgent) InterruptWithin(time.Duration) { l.Agent.Interrupt() }

// InterruptWithinFor is [lentAgent.InterruptFor] without the bound, for the
// reason [lentAgent.InterruptWithin] has none.
func (l lentAgent) InterruptWithinFor(door session.StopDoor, _ time.Duration) { l.InterruptFor(door) }

// InterruptNamed is [lentAgent.InterruptFor] with the window the door named.
func (l lentAgent) InterruptNamed(door session.StopDoor, name string) {
if endsAView(door) {
Expand Down
78 changes: 73 additions & 5 deletions cmd/codeaf/appcrewlayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"

"github.com/Agent-Field/codeaf/internal/appwire"
"github.com/Agent-Field/codeaf/internal/filelock"
"github.com/Agent-Field/codeaf/internal/fsreplace"
teamstore "github.com/Agent-Field/codeaf/internal/teams"
)

// appCrewLayerName is the layer's file, beside the app's state file.
Expand Down Expand Up @@ -64,6 +66,12 @@ type appPendingStart struct {
ReportsTo string `json:"reports_to,omitempty"`
Role string `json:"role,omitempty"`
Model string `json:"model,omitempty"`
// RoleName is the role's name as the proposal gave it, kept on the team's
// own record of the member (teamstore's Member.Role).
RoleName string `json:"role_name,omitempty"`
// Standby says the member joins without starting on its start line
// (teamstore's Member.Standby).
Standby bool `json:"standby,omitempty"`
}

// appCrewLayerFile is the whole layer.
Expand Down Expand Up @@ -213,15 +221,75 @@ func (b *appBackend) crewLayer() *appCrewLayer {
return b.layer
}

// crewPaused says the person paused this agent in some open crew.
// crewPaused says the person paused this agent in some open crew
// (teamstore's Member.Paused).
func (b *appBackend) crewPaused(agent string) bool {
paused := false
f, err := teamstore.LoadTeamsOf(b.crewProfile(), agent, false)
if err != nil {
return false
}
for _, t := range f.Teams {
if t.Closed() {
continue
}
if m, ok := b.crewMemberOf(t, agent); ok && m.Paused && m.Key != t.Manager {
return true
}
}
return false
}

// movePausesToStore carries a pause an earlier build kept in this layer into
// the team's own record, so a member paused before the update stays paused
// where the engine reads it. A flag is cleared here only once it is on the
// team's record, or its crew or member is gone; one that could not be carried
// (the store could not be read or written) stays, and the next launch tries
// again.
func (b *appBackend) movePausesToStore() {
var paused []string
_ = b.crewLayer().read(func(f *appCrewLayerFile) {
for key, m := range f.Members {
if m != nil && m.Paused && filepath.Base(key) == agent {
paused = true
if m != nil && m.Paused {
paused = append(paused, key)
}
}
})
return paused
if len(paused) == 0 {
return
}
var settled []string
for _, key := range paused {
crew, agent, ok := strings.Cut(key, "/")
if !ok {
settled = append(settled, key)
continue
}
t, _, err := b.crewTeam(crew)
if err != nil {
var wire *appwire.Error
if errors.As(err, &wire) && wire.Code == appwire.CodeNotFound {
settled = append(settled, key)
}
continue
}
m, found := b.crewMemberOf(t, agent)
if !found || m.Key == t.Manager {
settled = append(settled, key)
continue
}
if err := b.crewEdit(func(f *teamstore.File) error { return f.SetPaused(crew, m.Key, true) }); err == nil {
settled = append(settled, key)
}
}
if len(settled) == 0 {
return
}
_ = b.crewLayer().write(func(f *appCrewLayerFile) error {
for _, key := range settled {
if m := f.Members[key]; m != nil {
m.Paused = false
}
}
return nil
})
}
Loading
Loading