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
18 changes: 18 additions & 0 deletions docs/changes/unreleased/2906-global-manager-quiet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
kind: changed
title: The global manager is not woken each time a top-level team's manager ends a turn
pr: 2906
surface: [engine, chat]
invalidates:
- "A member's finished, failed or asking event started its manager's turn in every team, the team that holds every team included, where only an idle (stopped) event did not. In that team no member's finished event starts the global manager's turn any longer (teamEventWakesManagerOf): of a member's events there only failed and asking do, and a team_post to the manager, a decision packet a member raises and a conflict it declares wake the global manager as before. A global manager nobody has open is likewise no longer opened by a finished event there. The rule is that whole team's: it covers a top-level team's manager, a manager that was replaced or whose team closed and kept its seat there, and a conversation the person put there, since the global manager lists and directs only the current top-level managers (managedView). Every other team is unchanged."
- "team_send answered every manager \"Replies and endings wake you when they arrive, so there is no need to wait or poll.\" In the team that holds every team it now answers \"Their replies, questions and failures wake you when they arrive, so there is no need to wait or poll. A top-level team's manager answers a directive with team_post: its turn finishing or being stopped does not wake you, and team_status says where it stands.\" The answer in every other team is as it was."
- "The global manager's team note said \"Members' replies to you, and their finishing, failing or asking, come back to you and start your turn when you are idle\". For the global manager it now says \"Members' replies to you, and their failing or asking, come back to you\" and ends \"A member's turn finishing or being stopped does not start yours.\", and its scope adds \"A manager answers a directive of yours, and the brief you started it on, with team_post, since its turn finishing does not start yours; team_status says where each of them stands. The person talks to those managers directly, and what the person asked one of them is that manager's work already: never send a manager the person's own request to it as a directive of yours.\" Both are in the global manager's role note, which it is handed when that note's text changes."
- "A top-level manager's note about its seat in the team that holds every team ended \"you report to it with team_post to the manager.\" It now adds \"Your turn ending tells it nothing: answer each of its directives, and the brief it started you on if it started you, with team_post to the manager. Apart from those answers, post only what it should act on or tell the person.\" The rest of that note is as it was. Every member of that team was given that note, \"because you manage a top-level team\" included; a member there that manages no top-level team now is given the note a member of any team is given."
- "The first turn of a team's new manager, on the brief team_start of kind team started it with, woke the manager that started it when it finished, and team_start answered every manager that the new conversation \"makes itself the manager of\" the team \"and reports to you.\" A team the global manager starts no longer wakes it that way, and team_start answers the global manager that the new manager \"reports to you with team_post: its turn finishing on your brief does not start yours, and team_status says where it stands.\" The answer to every other manager is as it was."
---

The global manager's members are the managers of whole teams, each a conversation
the person talks to, and every answer one of them gave ended a turn. Measured in
the desktop app, one afternoon of that woke the global manager 22 times for
803,496 input tokens, each answered "[no change]", and one earlier wake had it
send the person's own request back to a manager as a directive.
21 changes: 19 additions & 2 deletions internal/manual/chat/team-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ The work is under way from the hand-off until a turn finishes with no background
left that the member waits on. So a turn such a command's ending starts is still on it, and
so is a turn you opened by typing to the member while it waits on one. Stopping a member
with none of the manager's work under way tells the manager nothing, and neither does codeaf
quitting or a paused member's stray wake being ended.
quitting or a paused member's stray wake being ended. The global
manager is not woken by a member of `All teams` being stopped (see **The global manager**).

## A stopped member's command is still running — why it did not start again when the command ended

Expand Down Expand Up @@ -539,6 +540,20 @@ report to it, so their questions and conflicts between teams come to it before t
you. It can start a new top-level team with `team_start` of kind `team`. Without a global
manager, nothing here changes: each top-level manager reports to you.

No turn in `All teams` that finishes or is stopped starts the global manager's turn. You talk
to the top-level managers directly and each answer ends a turn, so the endings stay in
`All teams`' traffic, where `team_status` reads them. The global manager is woken by what a
member posts to it with `team_post`, by a member's question or a permission it is held on, and
by a member's turn failing. So a directive the global manager sent, and the brief it started
a team on, are answered with `team_post`: each top-level manager is told so, and apart from
those answers to post only what the global manager should act on or tell you. A manager that
finishes a turn without posting has told it nothing, the first turn of a team it started
included: `team_start` says so, and `team_status` is where it finds out. The global manager
is told never to send a manager your own request to that manager back as a directive.
`All teams` can also hold a conversation that manages no team now, such as a manager you
replaced. The global manager neither lists nor directs it, its turn ending is as quiet, and
it is told what a member of any team is told.

## Conflicts between members and teams

When two or more conversations need incompatible things (the form posts JSON, the endpoint
Expand Down Expand Up @@ -597,7 +612,9 @@ working, that is straight away. When it is idle, it depends on the kind of messa
without a reply, failing, starting to wait on you, or being stopped by you while on the
manager's work, start an idle manager's turn. A reply
and the end of the same turn are one wake, even if the ending arrives after the manager
already ran. Replies arriving within a few seconds are gathered into one turn.
already ran. Replies arriving within a few seconds are gathered into one turn. The global
manager is the exception: a member of `All teams` finishing or being stopped does not
start its turn (see **The global manager**).

A member no window has open is opened by codeaf in the background so it can run, and a window
that opens it later joins the running conversation. A manager that moved to another window, and
Expand Down
29 changes: 25 additions & 4 deletions internal/session/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ type teamRole struct {
// manager is the global manager, and its other members are the top-level
// teams' managers.
root bool
// top says this seat in the root is a top-level team's manager's now
// ([teams.File.TopManagers]). The root can hold others, a manager that
// stopped being one or a conversation the person put there, and only a
// manager is told it sits there because it manages a team
// ([teamMemberRole]).
top bool
// dissolvable says this conversation manages the team and the team has
// never held anyone but it ([teams.File.Dissolvable]), which is when its
// manager is given team_dissolve (team_dissolve.go).
Expand Down Expand Up @@ -455,6 +461,7 @@ func rolesFor(file *teams.File, keys []string, d teams.Defaults) []teamRole {
boss: boss,
bossName: bossName,
root: team.Root,
top: team.Root && topManager(file, member.Key),
key: member.Key,
wakes: effective.Wake,
questionsUp: effective.QuestionsUp,
Expand Down Expand Up @@ -1728,7 +1735,9 @@ func teamManagerScope(role teamRole, file *teams.File) string {
var parts []string
if role.root {
parts = append(parts, fmt.Sprintf("You are the global manager: %q holds every team, and your members are the managers of the top-level teams, never their members. "+
"Direct those managers and they pass it on. Their questions and conflicts between teams come to you before the person. team_start with kind team starts a new top-level team.", role.name))
"Direct those managers and they pass it on. Their questions and conflicts between teams come to you before the person. team_start with kind team starts a new top-level team. "+
"A manager answers a directive of yours, and the brief you started it on, with team_post, since its turn finishing does not start yours; team_status says where each of them stands. "+
"The person talks to those managers directly, and what the person asked one of them is that manager's work already: never send a manager the person's own request to it as a directive of yours.", role.name))
} else if home, ok := file.Home(role.key); ok && home.Team != role.id {
boss := "its manager"
if t, ok := file.Team(home.Team); ok {
Expand Down Expand Up @@ -1767,7 +1776,13 @@ func teamManagerDelivery(role teamRole) string {
if !role.wakes {
return "This team's auto-wake is off: what you send, and your members' replies, wait for each conversation's next turn, so an idle member does not start on a directive until it next runs."
}
return "A directive (team_send kind directive) starts an idle member's turn; a note waits for its next turn. team_send's answer says whether each member started: one the person paused does not start until they resume it, and work is under way only where the answer says so. Members' replies to you, and their finishing, failing or asking, come back to you and start your turn when you are idle, so do not wait or poll for them."
// The global manager's turn is not started by a turn ending in the root,
// finished or stopped ([teamEventWakesManagerOf]).
back, except := "Members' replies to you, and their finishing, failing or asking,", ""
if role.root {
back, except = "Members' replies to you, and their failing or asking,", " A member's turn finishing or being stopped does not start yours."
}
return "A directive (team_send kind directive) starts an idle member's turn; a note waits for its next turn. team_send's answer says whether each member started: one the person paused does not start until they resume it, and work is under way only where the answer says so. " + back + " come back to you and start your turn when you are idle, so do not wait or poll for them." + except
}

// teamRoster names the manager's members by handle, with the start of each
Expand Down Expand Up @@ -1820,9 +1835,15 @@ func teamMemberRole(role teamRole) string {
if role.handle != "" {
you = "@" + role.handle
}
if role.root {
// Only a top-level team's manager is told why it sits in the root and how
// to answer the global manager. Nobody's ending there wakes that manager
// ([teamEventWakesManagerOf]), but it directs only these, so anybody else
// the root holds reads the member's text below, which promises no wake.
if role.top {
return fmt.Sprintf("You are %s in %q because you manage a top-level team: you report to its manager, the global manager. Its directives reach you marked \"◆ from manager\", "+
"your questions go to it before the person, and you report to it with team_post to the manager.", you, role.name)
"your questions go to it before the person, and you report to it with team_post to the manager. "+
"Your turn ending tells it nothing: answer each of its directives, and the brief it started you on if it started you, with team_post to the manager. "+
"Apart from those answers, post only what it should act on or tell the person.", you, role.name)
}
if role.boss != "" && role.boss != role.id && !role.shared {
said := fmt.Sprintf("You are %s in the team %q, which has no manager of its own, so you answer to the manager of %q: team_post to the manager reaches it, and to the room or a teammate stays in %q.",
Expand Down
8 changes: 7 additions & 1 deletion internal/session/team_nest.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,14 @@ func (a *Agent) teamStartSubTeam(ctx context.Context, team teams.Team, role team
case pool != "":
money = fmt.Sprintf("It has no cap of its own and spends from %q's pool.", pool)
}
reports := "reports to you"
if team.Root {
// The new manager's ending does not wake the global manager, its first
// turn on the brief included ([teamEventWakesManagerOf]).
reports = "reports to you with team_post: its turn finishing on your brief does not start yours, and team_status says where it stands"
}
said := fmt.Sprintf("Made the team %q under %q and asked for its manager @%s (%s). The conversations view opens @%s in %q's folder as a member of %q; it is handed your brief marked as yours, "+
"makes itself the manager of %q, and reports to you. %s", name, team.Name, handle, teams.ThreadNumber(startID), handle, team.Name, team.Name, name, money)
"makes itself the manager of %q, and %s. %s", name, team.Name, handle, teams.ThreadNumber(startID), handle, team.Name, team.Name, name, reports, money)
if len(moved) > 0 {
said += " Moved in: " + strings.Join(moved, ", ") + "; they are its manager's to direct now, not yours."
}
Expand Down
Loading