Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(device): pick the Focus resting line at random each time it shows

0xdiego25e1628ef2a15a
diff --git a/devices/harness-device/firmware/main/ui/habitat/focus.c b/devices/harness-device/firmware/main/ui/habitat/focus.c
index 99de7e6a8..33fbb19df 100644
--- a/devices/harness-device/firmware/main/ui/habitat/focus.c
+++ b/devices/harness-device/firmware/main/ui/habitat/focus.c
@@ -41,19 +41,35 @@ enum { MARK_SIZE = 56, TITLE_BOTTOM = HT_ARC_Y + HT_ARC_CELL_HEIGHT, CARD_X = 41
/*
* WHAT AN AGENT WITH NOTHING YET SAYS, in place of "No activity yet" (owner, 2026-10-01): an
- * invitation rather than a report. One per agent, picked by its name, so the line does not change
- * every time the face is drawn but two agents side by side read differently. Each fits two lines of
+ * invitation rather than a report, picked at random each time the resting face appears — on arrival,
+ * after a turn, on another agent, back from voice — and never the same line twice running (owner,
+ * 2026-10-02). It holds while that face stays up, so a redraw never swaps it. Each fits two lines of
* geist_reg_38 at EMPTY_W.
*/
static const char *const RESTING[] = {
"Let's build it", "Do anything", "What's next?", "Ready when you are",
"Tap to talk", "Say the word", "Make it happen", "Start something",
};
-static const char *resting_line(const char *name)
+static struct {
+ bool showing; // the last home face drawn was a resting one
+ char who[64]; // ... for this recipient
+ const char *line;
+ uint32_t seed;
+} resting;
+static const char *resting_line(const ht_character_face_t *f)
{
- uint32_t h = 2166136261u; // FNV-1a
- for (const char *p = name ? name : ""; *p; p++) h = (h ^ (uint8_t)*p) * 16777619u;
- return RESTING[h % (sizeof RESTING / sizeof RESTING[0])];
+ const char *who = f->recipient ? f->recipient : "";
+ if (!resting.showing || !resting.line || strncmp(resting.who, who, sizeof resting.who - 1)) {
+ const unsigned n = sizeof RESTING / sizeof RESTING[0];
+ // An LCG stirred with the clock: no entropy source is needed to look random on a dial.
+ resting.seed = resting.seed * 1664525u + 1013904223u + f->clock_ms;
+ unsigned pick = (resting.seed >> 16) % n;
+ if (RESTING[pick] == resting.line) pick = (pick + 1) % n;
+ resting.line = RESTING[pick];
+ snprintf(resting.who, sizeof resting.who, "%s", who);
+ }
+ resting.showing = true;
+ return resting.line;
}
/*
@@ -355,7 +371,7 @@ void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, u
const char *recap)
{
(void)ink;
- if (f->voice) { voice_face(s, f, frame); return; }
+ if (f->voice) { resting.showing = false; voice_face(s, f, frame); return; }
bool has_recap = recap && *recap;
bool working = !has_recap && f->activity && *f->activity;
bool retry = !has_recap && !working && f->status && *f->status;
@@ -368,6 +384,7 @@ void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, u
else if (working) status_text(status, sizeof status, f);
else if (retry) snprintf(status, sizeof status, "%s", f->status);
bool empty = !has_recap && !status[0];
+ if (!empty) resting.showing = false;
// The body, laid out first: a recap is centred in its card; without one the line is centred on
// the glass.
@@ -382,7 +399,7 @@ void ht_focus_face(ht_scene_t *s, const ht_character_face_t *f, uint8_t frame, u
ht_lv_label(&body, sf, status, CARD_W, 1, true); // no card around it: the full width
body_h = sf->height;
} else {
- int n = ht_lv_label(&body, ef, resting_line(f->recipient), EMPTY_W, 2, false);
+ int n = ht_lv_label(&body, ef, resting_line(f), EMPTY_W, 2, false);
body_h = (n < 2 ? n : 2) * ef->height;
}
int body_y = has_recap ? CARD_Y + (CARD_H - body_h) / 2 : HT_HEIGHT / 2 - body_h / 2;
diff --git a/devices/harness-device/firmware/test/test_character.c b/devices/harness-device/firmware/test/test_character.c
index 9f9442d64..8f5020b22 100644
--- a/devices/harness-device/firmware/test/test_character.c
+++ b/devices/harness-device/firmware/test/test_character.c
@@ -412,13 +412,12 @@ static void focus_face(void)
assert(above > 0 && (below - above == 0 || below - above == 1));
}
- // Resting: one of the invitations, the same one for the same agent on every frame, centred,
- // and two agents do not all say the same thing.
+ // Resting: one of the invitations, centred, holding still while the face stays up (both draws
+ // of an agent say the same), and picked afresh when the face comes back.
f.activity = ""; f.elapsed = 0;
static const char *const resting[] = {"Let's build it", "Do anything", "What's next?",
"Ready when you are", "Tap to talk", "Say the word", "Make it happen", "Start something"};
char first[64] = "";
- int distinct = 0;
const char *names[] = {"Payments refactor", "Landing page", "Deploy firmware", "Docs sweep",
"Bug triage", "Release notes"};
for (unsigned k = 0; k < sizeof names / sizeof names[0]; k++) {
@@ -443,11 +442,38 @@ static void focus_face(void)
int top = scene.runs[1].y - (56 - pet_of("claude")->h) / 2;
int above = top - TITLE_BOTTOM, below = l1->y - (top + 56);
assert(above > 0 && (below - above == 0 || below - above == 1));
- if (!k && !again) snprintf(first, sizeof first, "%s", said);
- else if (!again && strcmp(said, first)) distinct++;
+ if (!again) snprintf(first, sizeof first, "%s", said);
+ else assert(!strcmp(said, first)); // a redraw never swaps it
}
}
- assert(distinct > 0);
+ /*
+ * RANDOM WHEREVER IT SHOWS (owner, 2026-10-02): the same name every time — "Choose a pane",
+ * the face with no agent — still gets a new line each time the resting face returns, never
+ * the one it just showed, and over a few returns most of the list.
+ */
+ {
+ f.recipient = "Choose a pane";
+ char last[64] = "", seen[8][64];
+ int kinds = 0;
+ for (int visit = 0; visit < 24; visit++) {
+ f.activity = "Working"; f.elapsed = 3; f.clock_ms = 1000u + (uint32_t)visit * 977u;
+ ht_scene_clear(&scene, 0);
+ ht_character_face(&scene, &c, &f, 0xffff, ""); // away: the working line
+ f.activity = ""; f.elapsed = 0;
+ ht_scene_clear(&scene, 0);
+ ht_character_face(&scene, &c, &f, 0xffff, ""); // back to resting
+ char said[64];
+ snprintf(said, sizeof said, "%s%s", scene.runs[8].text, scene.runs[9].text);
+ squeeze(said);
+ assert(strcmp(said, last));
+ snprintf(last, sizeof last, "%s", said);
+ bool known = false;
+ for (int k = 0; k < kinds; k++) known |= !strcmp(seen[k], said);
+ if (!known && kinds < 8) snprintf(seen[kinds++], sizeof seen[0], "%s", said);
+ }
+ assert(kinds >= 5);
+ f.clock_ms = 0;
+ }
f.recipient = "Payments refactor";
// An engine this build has no mark for leaves the mark's place empty, not a wrong mark.