Skip to content

hints: a host named by its tail matches; each hint line says why; route a decision as a heads-up (0186) - #1035

Merged
ZacxDev merged 3 commits into
mainfrom
hints-why-and-heads-up
Nov 24, 2026
Merged

ZacxDev merged 3 commits into
mainfrom
hints-why-and-heads-up

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Why

Plugin messages from a chat plugin had stopped reaching the sessions they were about without being told to. Two separate causes:

1. Empty hints on fleet-alert posts. A fleet alert names its host in full (gpuhost-4090-7-12). The focus summarizer is told never to quote hostnames (SummaryInstructions), so the session working on that host's fault writes node -7-12. That bare number pair was no term, so the alert shared no identifier with the session. It was matched only while something else the alert carried (a rack name, a tool name) also happened to be in the session's focus, and that stopped once the focus moved on to the next fault.

The step that should have matched is distinctiveTerms on both sides of focus.MatchHistory. I replayed MatchHistory (real SQL) over the stored messages and focus rows, each message against the rows written before it. The base code reproduces the observed per-day hint counts exactly. With this change, the session on the alerts gets named on most of the alert posts whose hint was empty.

2. A correct hint and no route. A hint line showed only the session's title, which names its larger job. A chief handed a DM that named exactly that session's service and version raised an ask and never routed it. Routing it would also have been unsafe: a two-way route's answer becomes the reply, and for an allowlisted sender it is sent at once, so the decision would have been answered before the owner made it.

What

  • Tail keys (internal/focus/terms.go). A host whose last two hyphen-separated parts are numbers also carries its tail (~7-12). A history row's bare pair (-7-12, 52-110) carries it too. A message's bare pair does not, so a sender cannot name a session by writing numbers. A tail is at least four characters long, and a host and its own tail count once.
  • Every hint line says why. focus.Match.Keys is wired to SessionHint.Matched and rendered as its focus mentions 7-12 (of gpuhost-4090-7-12), v0.0.42. It is fenced, holds at most 3 identifiers, and is cut to 240 bytes. The repo line now reads listed by its repo <repo>. A block that keeps only its first session over the byte cap now still says how many it left out.
  • Heads-up routes (migration 0186, session_routes.heads_up, with CHECK (NOT heads_up OR one_way)). route_to_session(message_id, subject, heads_up: true) sends a replyable message one-way:
    • The answer goes to the chief and is never a draft. 0087's no-draft check still applies, so the sender cannot be answered twice.
    • The paste, the route_reply next, the answer note and preface, the hand-back and the push all say the reply is still the chief's to draft once the owner has decided. A timed-out heads-up comes back with reply_draft offered.
    • heads_up with task_id or text is refused as bad arguments. On a no_reply message it changes nothing.
  • Guidance. The hint preface, the replyable RoutingSentence and both chief-instruction variants carry the same rule. A session whose focus mentions a specific identifier of the message (a host, a version, a pull request, a file), or one listed by its pull request, is on it: route the message to it. If the message also asks the owner to decide, route it with heads_up: true and raise the ask too. The supervisor-prompt digests are re-recorded; I read the diff and it adds no private detail.

Prose, not a deterministic auto-route. muster does not route a heads-up copy by itself on a match, for three reasons:

  • The match is a summarizer's text against the message's words. In the replay, short identifiers (v1, a domain name) matched several unrelated sessions.
  • A route pastes into a session the owner may be typing in.
  • A message has one open route at a time, so an automatic heads-up would block the chief's own two-way route.

What muster now does structurally is say why each session is listed and offer a heads-up that cannot answer the sender. docs/plugins.md explains this.

Tests

test base (origin/main) branch
TestAHostTheFocusNamesByItsTailGetsAHint (pg; a realistic fleet-alert body) red: "the alert named []" green
TestABareNumberPairInAMessageNamesNothing (its control: the full host names the session) red green
TestAHostNamedInFullOnBothSidesIsOneTerm green (invariant guard) green
TestAHostCarriesItsNumberedTail (unit) red (no tail key; rowTerms does not exist) green
TestAHeadsUpOfAReplyableMessageNeverAnswersTheSender (pg) red: heads_up is ignored and the route is two-way green
TestAHeadsUpIsOnlyForAMessage (pg) red green
TestATimedOutHeadsUpComesBackAsAMessageToAnswer (pg) green (invariant at base: the route there is two-way) green; kills the hand-back mutant
Hint pins (hints_test, hints_meta_test, hints_pr_test, render_test), plus a Matched seam assertion in TestTheHintListsOnlyTheLiveSessionOnTheJob wording changed green

The pg tests at base were run with their Keys assertions removed, since that field does not exist there.

Mutation sweep: 14 of 14 killed. Mutants:

  • tails off, row bare pairs off, message reads bare pairs, no host and tail dedupe, minimum tail of 3, rows use the message extractor
  • heads-up not stored, heads-up stored on a no_reply message, hand-back as plain one-way, no argument check
  • no why line, no Matched wiring, paste not heads-up
  • a control that changes the tail prefix

Local runs:

  • internal/focus and internal/agentspec: green.
  • internal/plugins: green except TestSearchDraftCardsTextIsOwnIdIsWhatTheCallerCanOpen, which also fails on origin/main against the same local database.
  • internal/api: the route, hint and one-way subsets are green. The full package timed out at 30 minutes locally, with failures in chief, opencode and budget fixtures (the agent labelled chief is not user 1's chief) that look like state in my reused database. CI on a fresh database is the authority.

Audit round 1 (no 🔴; the 🟡 and 🟢 findings fixed)

  1. A relayed heads-up still gets the "not acted on" ask. liveRoute in retry.go now counts a relayed route only when it is not a heads-up. I chose this deterministic predicate change over muster raising an ask itself on every heads-up. It is the one predicate the sweep, the closer and Retry all share.

  2. A heads-up is sticky. The chief's later route of a message that had a heads-up route is coerced to a heads-up, and both route_to_session's next and the hand-back say so. A heads-up's hand-back now offers reply_draft once the owner decides, plus a re-route that is noted to stay a heads-up. The owner's own plugin_message_route is not coerced.

  3. Tighter tail keys:

    • A row's full host name never carries a tail.
    • A row pair that reads as a date carries none: one after a year (2000-11-23), or a bare calendar month and day (11-23, 7-12; February up to 29).
    • A message token mints a tail only when it is host-shaped: a first part with two letters, a numeric part, then the pair. a-7-12, gpu-x-7-12, ab-52-23 and a-4090-52-23 mint none.

    The date conflict, resolved: the fleet's real short form -2-31 is not a calendar date (there is no 31 February), so it still counts. 52-23, 52-110 and 52-4 are not month-day pairs either. The cost: a host whose tail is a valid month and day (…-7-12) matches only when the focus writes more of its name (4090-7-12, or in full). The docs now call this a structural floor, not a defence.

  4. Exact pins for MaxHintKeys (4 keys, 3 shown) and for (1 more not shown) when the first session is alone over the cap.

  5. Doc and comment fixes: the why line's keys are normalised and lower-cased; 0186's header quotes the paste's real wording and names the two new readers; routed_card.go's OneWay comment covers a heads-up. 0186's CHECK is now NOT VALID followed by VALIDATE.

Production replay, re-run. Every chat-plugin message since the 17th, through the real MatchHistory SQL: non-empty hints / the alerts session named, per day.

day base first head (033b276) now
17th 14/28 · 10 25/28 · 15 25/28 · 15
18th 8/15 · 6 10/15 · 8 10/15 · 8
19th 10/16 · 5 12/16 · 7 12/16 · 7
20th 3/3 · 1 3/3 · 1 3/3 · 1
21st 3/10 · 0 3/10 · 1 3/10 · 1
22nd 4/14 · 0 11/14 · 7 11/14 · 7
23rd 9/26 · 2 13/26 · 6 13/26 · 6
24th 2/3 · 0 2/3 · 0 2/3 · 0

The tightening removed no false positives on this data. Every tail the first head matched was 2-31, 20-2, 52-4, 52-5, 52-23, 52-50, 52-53 or 52-110, of the message's own host; none is a date and none came from a row's full host. The focus rows do hold ISO dates (23 rows) and other full hostnames, but none lined up with a message's host tail inside the window. The same instrument does register change: from base to the first head, 26 more messages get a non-empty hint (the per-day increases summed).

Matrix for this round. Each mutant below undoes one fix on the current tree; all were killed:

  • F1, a relayed heads-up counted as acted: TestARelayedHeadsUpStillRaisesTheNotActedOnAsk
  • F2, no sticky coercion: TestAHeadsUpIsSticky
  • F2b, plain hand-back: TestATimedOutHeadsUpComesBackAsAMessageToAnswer
  • F3a, a row's full host carries a tail: TestAHostTheFocusNamesByItsTailGetsAHint, TestAHostCarriesItsNumberedTail
  • F3b, no month-day refusal; F3c, no year refusal; F3e, one-letter host prefix; F3f, no numeric part: TestAHostCarriesItsNumberedTail
  • F4a, four keys shown: TestTheWhyLineNamesAtMostThreeKeys
  • F4b, no "more" line: TestAFirstSessionAloneOverTheCapStillSaysWhatWasLeftOut
  • The first sweep's M1–M4 and M7, re-run against the tightened code: killed.

One guard is unreachable and reported as such, not as coverage: the host branch's len(parts) < 3 bound. Only tokens with a letter reach that branch, so the bound only prevents an index panic.

Check live after it ships

  • After audit round 1: when a heads-up of an agent-mail message is relayed, the "not acted on" ask appears about 15 minutes after delivery unless the chief has drafted the reply or settled the message.
  • On the next fleet-alert post in the alerts channel, the chief's turn has a session-hints block naming the session on that host, with its focus mentions <tail> (of <host>).
  • On a DM that asks for a decision and matches a session's focus on a version or host, the chief calls route_to_session with heads_up: true and also raises an attention ask. The session_routes row has one_way and heads_up set, no draft appears, and the owner's push reads "(a heads-up: the reply is still yours)".
  • SELECT count(*) FROM session_routes WHERE heads_up grows, and routed_to traffic for the chat plugin resumes.

🤖 Generated with Claude Code

…te a decision as a heads-up (0186)

The session hint stopped naming the session on a fleet's GPU alerts. Each
alert names its host in full ("gpuhost-4090-7-12"). The focus summarizer is
told never to quote hostnames, so the session on that host's fault wrote "node
-7-12": a bare number pair, which is no term. An alert named the session only
while something else it carried (a rack name, a tool name) was also in the
session's focus, and once the focus moved on to the next fault, no alert named
it. Replayed through MatchHistory over the stored messages and focus rows, the
base code reproduces the observed hint counts exactly, and this change names
that session on most of the alerts that had an empty hint.

1. Tail keys (internal/focus/terms.go). A host whose last two hyphen parts
   are numbers also carries its tail ("~7-12"). A history row's bare pair
   ("-7-12", "52-110") carries it too. A message's bare pair stays no term, so
   a sender cannot name a session by writing numbers. A tail is at least four
   characters long. A host and its own tail count once.

2. Every hint line says why. focus.Match.Keys gives the message's identifiers
   the focus carries, in the message's spelling ("7-12 (of
   gpuhost-4090-7-12)"). The hint renders them as "its focus mentions …",
   fenced, at most three, cut to 240 bytes. The repo line reads "listed by its
   repo <repo>". A block that keeps only its first session over the byte cap
   now still says how many it left out.

3. A heads-up route of a message that can be answered. A two-way route's
   answer becomes the reply, and for an allowlisted sender it is sent at once.
   So a chief handed a DM that asks the owner to decide raised an ask and
   never routed. route_to_session now takes heads_up: true, with message_id
   only. It makes a one-way route marked heads_up (migration 0186, CHECK NOT
   heads_up OR one_way). Every one-way rule holds: the answer goes to the
   chief, never as a draft. The paste says "A HEADS-UP, NOT A REQUEST TO
   REPLY". The answer, the hand-back and the owner's push say the reply is
   still the chief's to draft once the owner decides. A timed-out heads-up
   comes back with reply_draft offered.

   The hint preface, the replyable routing sentence and the chief's
   instructions give the rule: a session whose focus mentions a specific
   identifier of the message, or one listed by its pull request, is on it, so
   route the message to it. If the message also asks the owner to decide,
   route it with heads_up and raise the ask too. This is guidance, not a
   route muster makes itself; docs/plugins.md says why the automatic route
   was not taken.

Tests: TestAHostTheFocusNamesByItsTailGetsAHint and
TestABareNumberPairInAMessageNamesNothing (its control) are red at the base
and green here; TestAHostNamedInFullOnBothSidesIsOneTerm is an invariant guard
at the base. TestAHostCarriesItsNumberedTail, the hint pins, and the heads-up
pg tests (TestAHeadsUpOfAReplyableMessageNeverAnswersTheSender,
TestAHeadsUpIsOnlyForAMessage, red at the base;
TestATimedOutHeadsUpComesBackAsAMessageToAnswer). A 14-mutant sweep found
every mutant killed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ZacxDev
ZacxDev force-pushed the hints-why-and-heads-up branch from 3f7c28b to 9481093 Compare November 24, 2026 02:16
…-up is sticky, tails tightened, bound pins

1. A relayed heads-up is not the chief acting on the message (retry.go
   liveRoute: a relayed route counts only when it is not heads_up). Its relay
   only told the chief, so the "not acted on" ask is raised and one already
   raised stays open until the chief drafts, settles or routes again. I took
   this option, a predicate change, over muster raising the ask itself on
   every heads-up: the predicate is the one every reader shares (the sweep,
   the closer, Retry).

2. A heads-up is sticky. The chief's later route of a message that had a
   heads-up route is a heads-up too. It is coerced, not refused, so the
   hand-back's re-route still works, and route_to_session's next says so. A
   heads-up's hand-back offers reply_draft (once the owner has decided) and a
   re-route that says it stays a heads-up. The owner's own door is not
   coerced.

3. Tail keys, tightened:
   - A history row's FULL host name carries no tail (a full name matches in
     full), so another host with the same tail names nothing.
   - A row's pair that reads as a date carries none: a year before it
     (2000-11-23), or a bare calendar month and day (11-23, 7-12; February up
     to 29). The fleet's -2-31 still counts, since there is no 31 February.
   - A message token mints a tail only when it is host-shaped: a first part
     with two letters, a numeric part, then the pair. a-7-12, gpu-x-7-12,
     ab-52-23 and a-4090-52-23 mint none.
   The docs and comments now say it is a structural floor, not a defence.

4. Exact pins for MaxHintKeys (four short keys, three shown) and for the
   "(1 more not shown)" line when the first session is alone over the cap.

Docs and comments: the why line shows normalised, lower-cased keys; 0186's
header quotes the paste's real words and names the two new readers;
routed_card's OneWay comment covers a heads-up. 0186's CHECK is added NOT
VALID, then VALIDATEd.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ZacxDev
ZacxDev force-pushed the hints-why-and-heads-up branch from 9481093 to 0018187 Compare November 24, 2026 02:16
@ZacxDev
ZacxDev merged commit f51ce49 into main Nov 24, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant