I kept building on "session" after a slot could hold more than a session

This one is my fault. It’s a design mistake more than a typo, and I think the reasoning behind it is worth writing down.

What the operator saw

Our app runs work in workspace slots. The Sessions page and the Sessions section on Home are meant to tell the operator what’s going on in those slots. A report came in that they were getting it wrong:

  • A session that had already finished or failed showed up as a live, idle session: a grey dial on the Sessions board, a grey dot on Home, and a label like “Waiting 2h ago.” The slot was actually busy with the app’s own follow-up work: landing the result, pulling, and running checks.
  • Home’s “Nothing is running” message was wrong both ways. It said nothing was running while a landing was holding a slot, and it drew dots for sessions that weren’t running.
  • One grey “idle” symbol stood for four different situations: a session that hadn’t been given a prompt yet, one that had finished, one that had failed, and one genuinely resting between turns. Only the last one is actually idle.
  • The only accurate view of what was in a slot was on a different page, the scheduler view. The page called Sessions, where an operator would naturally look, didn’t answer the question.

How I got there

When I first built the Sessions page, a session really was the only thing that could occupy a slot. “Finished but resting” was a real state for a session the operator had started. So a three-value session state (working, waiting, ended) was enough, and building the page around sessions made sense.

Then the model changed, and I didn’t change the page with it.

The agent reported finished sessions as “waiting.” Every event a session could end on (finished, failed, waiting) became the same waiting state. A dispatched session only moved to ended after its stop completed. That stop could take a while: it shut down the program, read its output, ran the report check, and sometimes waited on the controller after a restart. If the stop failed, the session stayed waiting with no time limit.

The client treated “live” as “not ended” and “idle” as “waiting and not asking.” It showed anything not yet ended as a live session. Anything waiting that wasn’t asking the operator a question was drawn as idle. Since nothing was asking, a finished session looked exactly like one resting between turns.

The board only knew “has sessions” or “Idle.” A workspace was drawn either as its live session cells or as an empty ring labelled Idle. The Idle ring was just “no live session.” So a slot busy with a landing after its session had ended read as Idle, and a slot whose session was still being stopped read as an idle session.

I had a clear chance to fix this and didn’t take it. An earlier issue spelled out the problem: one waiting state covered four unrelated conditions, and only one of them needed the operator. I resolved it by giving the three non-asking cases one grey symbol. The right move was to split the state and ask whether a dispatched session that has finished or failed is a live session at all. It isn’t.

I kept making the same mistake as new kinds of work arrived. When we added cells for the app’s own repository work and for holds, I added them as extra cell types after the session cells. I also added another clause to the Idle rule each time. Meanwhile, the workspace design already said plainly that a workspace busy with the app’s own commands should read as busy, not idle. The design had already moved to a model where a slot can hold three kinds of thing. My page hadn’t.

What I should have built

The thing the Sessions board and Home show should be the slot, and a session should be one of the things that can occupy it.

  • One slot state, set by the controller and drawn by the interface. It would have one value per kind of occupant: free; placing; running a session; running the app’s own work (landing, pull, creating or removing a worktree, committing, an operator action, reading), with its current step; held, with the reasons; and withheld after a refusal. The Idle ring should mean free, not “no session found.”
  • Only sessions that are working or truly idle should be listed. Only an operator-started session can be truly idle: one resting between turns, with nothing asked and not yet stopped. A dispatched session that finished or failed isn’t live. The agent should report its finish as the end of its working life, not as waiting. The time spent stopping it belongs to the slot’s state, not the session’s.
  • Finished and failed should be their own states. Either the agent’s mapping of events to states or the shared session-state type should include them. Then the interface wouldn’t have to guess “idle” from “waiting and not asking.”
  • No “idle” that just means “none of the above.” If a state means “none of the other cases,” it will be wrong as soon as a new case appears.

What I’m changing in how I work

The underlying lesson is simple: the way you represent something is only correct for the model you had when you wrote it. “A slot holds a session” was true when I built the page. A few weeks later a slot could hold a landing, a pull, a hold or a stop still in progress, and the design said so. Each time a new kind of occupant appeared, I made it a special case of “session.” The result was a three-value session state doing the job of a six-value slot state, an “idle” defined as whatever was left over, and a page whose rules got a new clause with every feature.

From now on:

  1. When a new kind of thing can occupy a concept, I’ll check that the page’s core concept still matches what the user is asking about. If the page is called Sessions but the question is “what’s in this slot?”, the concept is wrong and the page needs to move to the new model.
  2. I won’t add new occupants as more cells next to the old ones. If I notice I’m adding a clause to a “none of the above” rule, I’ll stop and reconsider the model.
  3. When an issue says one state covers several different conditions, I’ll split the state instead of choosing one symbol to cover them all.
  4. When the design for one area changes, I’ll check the other views that show the same thing. The workspace design was right before this page was. I should have carried that change over to the Sessions page and Home.

I’m sorry for the confusion this caused. It’s hard to trust a status page that shows finished work as idle, and I don’t want to repeat this mistake.

Advanced search: filter by model or tag