Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b8b01b5
feat(devtool): Tasks tab rows open in place as an accordion (FIX-1629)
claude Sep 28, 2026
efab4c3
feat(orchestration): taskToolActions exposes a board's task tools as …
claude Sep 28, 2026
4c59cae
feat(workforce): a channel can expose its boards' task tools as actio…
claude Sep 28, 2026
754743c
feat(devtool): change a task from its row through the flow's actions …
claude Sep 28, 2026
25a363b
test(goals): a task is worked from its Tasks-tab row, on the lab hire…
claude Sep 28, 2026
912ae98
docs: working a task from the Tasks tab, taskToolActions, and boardAc…
claude Sep 28, 2026
91995dd
fix(devtool): a Tasks-tab row that cannot render stays in its row (FI…
claude Sep 28, 2026
0f4dca3
fix(devtool): a row action's earlier answer is cleared when it is run…
claude Sep 28, 2026
1f2bc11
test(goals): works-a-task-from-its-row reads only the new run's answe…
claude Sep 28, 2026
f0a9724
test(goals): verdicts for FIX-1629's goal and the two re-pointed checks
claude Sep 28, 2026
7ca1aa2
refactor: fold Code Snob's subtractions — useId, no dead dispatchRun …
claude Sep 28, 2026
b8ad96f
fix: address PR review — exact board match, final root trace, decline…
claude Sep 28, 2026
a96a337
test(goals): verdicts for FIX-1629's goal after PR review round 1
claude Sep 28, 2026
6cac5bb
docs(workforce): boardActions refuses two boards with the same action…
claude Sep 28, 2026
b610984
fix(devtool): address PR review round 2 — resolved root output, every…
claude Sep 28, 2026
35a0f8e
fix(devtool): address PR review round 3 — unresolved refs anywhere, o…
claude Sep 28, 2026
cdd6593
fix(devtool): single-flight session-requests refresh, so overlapping …
claude Sep 28, 2026
b3f74ea
fix(devtool): scope row actions by listed board suffixes only; bound …
claude Sep 28, 2026
dfdb7dd
fix: read a row action's outcome off the action's own root trace, not…
claude Sep 28, 2026
b2cb8e5
fix: task actions run claimless in any scope; DevTool knows every gen…
claude Sep 29, 2026
8abb43b
fix(devtool): read request status before the action's answer; scope s…
claude Sep 29, 2026
c6448a1
fix(workforce): refuse an opted-in board whose task-action suffix mat…
claude Sep 29, 2026
8c56857
fix: show a setup failure's cause on the row; pin the displaced worke…
claude Sep 29, 2026
62bd922
test(orchestration): a retrying failTask on a held row re-queues it, …
claude Sep 29, 2026
643fbdf
test(devtool): pin that the Tasks tab's open rows do not follow the u…
claude Sep 29, 2026
002609c
fix(devtool): keep re-reading a row's suspended request until it ends…
claude Sep 29, 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
Prev Previous commit
Next Next commit
fix(devtool): scope row actions by listed board suffixes only; bound …
…a stalled list read (FIX-1629)

- taskActionsFor follows BR-10 as written: an action ending with a listed
  board's suffix belongs to that board (longest match wins); one ending with
  no listed suffix is offered on every board, whatever verb it starts with.
  An app action such as `cancelTask_now` is no longer hidden everywhere.
- The single-flight session-requests read is let go after 15s. A read that
  never settles no longer holds every joined caller, or a poller awaiting one,
  forever; the next refresh starts a fresh read whose fence retires it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014LohgYyHsXCYQd6kABH11N
  • Loading branch information
claude committed Sep 28, 2026
commit b3f74ea5d275c79eec040ccb3b4e3445402bbb9e
14 changes: 13 additions & 1 deletion packages/devtool/src/react/hooks/use-session-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { useDevTool } from "../context/devtool-context";
import { describeReadError } from "../lib/instance-ownership";
import { useWorkspaceFence } from "./use-workspace-fence";

/** How long a list read may run before a refresh stops waiting on it. */
const READ_STALL_MS = 15_000;

/** A read in flight, and the one follow-up read callers who joined it asked for. */
type Flight = {
identity: readonly unknown[];
Expand Down Expand Up @@ -111,7 +114,16 @@ export function useSessionRequests(sessionId: string | null) {
}
const entry: Flight = { identity: fence.identity, done: Promise.resolve(), next: null };
flightRef.current = entry;
entry.done = read().finally(() => {
// Bounded: the transport has no timeout, and a read that never settles
// would hold every joined caller (and a poller awaiting one) forever. Past
// the bound the flight is let go, so the next refresh begins a fresh read
// whose fence retires the hung one.
let stallTimer: ReturnType<typeof setTimeout> | undefined;
const stalled = new Promise<void>((resolve) => {
stallTimer = setTimeout(resolve, READ_STALL_MS);
});
entry.done = Promise.race([read(), stalled]).finally(() => {
clearTimeout(stallTimer);
if (flightRef.current === entry) flightRef.current = null;
});
return entry.done;
Expand Down
34 changes: 10 additions & 24 deletions packages/devtool/src/react/lib/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* row) alike.
*
* A board's task tools carry the board in their name, `<tool>_<suffix>`, and
* are offered only on that board's rows. The suffix rule mirrors
* are offered only on that board's rows; so is any action whose name ends with
* a listed board's suffix. The suffix rule mirrors
* `taskToolSuffix` in `@flow-state-dev/orchestration` rather than importing it:
* the DevTool depends on client, core and react only, as it mirrors the other
* wire shapes it reads (see `task-collection-state`).
Expand All @@ -26,37 +27,26 @@ export function taskToolSuffix(collectionId: string): string {
return collectionId.replace(/[^a-zA-Z0-9_-]/g, "_");
}

/** The eight task tools, whose suffixed names always belong to one board. */
const TASK_TOOLS = [
"addTask",
"assignTask",
"completeTask",
"failTask",
"blockTask",
"cancelTask",
"updateTask",
"listTasks",
];

function takesTaskId(schema: ActionInputSchema | undefined): boolean {
if (schema === undefined || schema.type !== "object") return false;
const field = schema.fields.taskId;
return field !== undefined && field.type === "string" && field.required;
}

/**
* The actions a row on `collectionId` offers, in the flow's order.
* The actions a row on `collectionId` offers, in the flow's order (BR-9,
* BR-10).
*
* A task tool (`<tool>_<suffix>`) is this board's only when its suffix IS this
* board's, compared whole: `cancelTask_feature_work` also ends with `_work`,
* and is not the `work` board's. Any other action is generic unless its name
* ends with a listed board's suffix; then it belongs to the board whose suffix
* is the longest match.
* An action whose name ends with `_<suffix>` of a listed board belongs to that
* board alone; when several listed suffixes match (`cancelTask_feature_work`
* ends with `_work` too), the longest wins. One whose name ends with no listed
* board's suffix is generic and offered on every board, whatever its name
* starts with: an app may name its own action `cancelTask_now`.
*
* @param actions The flow's public action names.
* @param schemas Their input schemas, as the flow list reports them.
* @param collectionId The board the row is on.
* @param boardIds Every board the tab lists for this flow, so an app action
* @param boardIds Every board the tab lists for this flow, so an action
* suffixed for another board is told apart from a generic one.
*/
export function taskActionsFor(
Expand All @@ -69,10 +59,6 @@ export function taskActionsFor(
const suffixes = [...new Set([collectionId, ...boardIds].map(taskToolSuffix))];
return actions.filter((name) => {
if (!takesTaskId(schemas?.[name])) return false;
// A task tool names its board whole, listed or not (a board with no tasks
// yet is not listed, and its tools are still never generic).
const tool = TASK_TOOLS.find((candidate) => name.startsWith(`${candidate}_`));
if (tool !== undefined) return name.slice(tool.length + 1) === own;
const owner = suffixes
.filter((suffix) => name.endsWith(`_${suffix}`))
.reduce<string | undefined>((best, suffix) => (best === undefined || suffix.length > best.length ? suffix : best), undefined);
Expand Down
20 changes: 10 additions & 10 deletions packages/devtool/test/task-actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ describe("taskActionsFor", () => {
expect(taskActionsFor(Object.keys(schemas), schemas, "b.two", ["a.one", "b.two"])).toEqual(["answer"]);
});

it("keeps a task tool for a board the tab does not list off every other board", () => {
// A board with no tasks yet is not listed, so its tools match no listed
// suffix. They are still a board's tools, not generic actions.
const schemas = { cancelTask_quiet_board: takesTaskId, answer: takesTaskId };
expect(taskActionsFor(Object.keys(schemas), schemas, "issues", ["issues"])).toEqual(["answer"]);
it("BR-10 · offers an action matching no listed board's suffix on every board, task-tool name or not", () => {
// `cancelTask_now` is an app's own action that happens to share a task
// tool's verb. Its ending names no board the tab lists, so it is generic.
const schemas = { cancelTask_now: takesTaskId, answer: takesTaskId };
const names = Object.keys(schemas);
expect(taskActionsFor(names, schemas, "issues", ["issues", "bugs"])).toEqual(["cancelTask_now", "answer"]);
expect(taskActionsFor(names, schemas, "bugs", ["issues", "bugs"])).toEqual(["cancelTask_now", "answer"]);
});

it("matches a task tool to its board exactly, not by a shared ending", () => {
// `cancelTask_feature_work` ends with `_work` too. Offered on the `work`
// rows, it would send a `work` task's id to the other board's ledger.
it("BR-10 · gives a task tool to the listed board with the longest matching suffix", () => {
// `cancelTask_feature_work` ends with `_work` too. With both boards
// listed it belongs to `feature.work` alone, not to `work`.
const schemas = { cancelTask_work: takesTaskId, cancelTask_feature_work: takesTaskId };
const names = Object.keys(schemas);
expect(taskActionsFor(names, schemas, "work", ["work", "feature.work"])).toEqual(["cancelTask_work"]);
expect(taskActionsFor(names, schemas, "feature.work", ["work", "feature.work"])).toEqual([
"cancelTask_feature_work",
]);
// The same when the longer board has no tasks yet, so the tab does not list it.
expect(taskActionsFor(names, schemas, "work", ["work"])).toEqual(["cancelTask_work"]);
});

it("gives an app's suffixed action to the board with the longest matching suffix", () => {
Expand Down
54 changes: 54 additions & 0 deletions packages/devtool/test/use-session-requests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,57 @@ describe("useSessionRequests — single-flight refresh", () => {
expect(result.current.requests).toEqual([{ id: "req_a", status: "completed" }]);
});
});

/**
* A read that never settles (FIX-1629).
*
* The transport has no timeout, so one hung list request would otherwise hold
* the single flight forever: every later refresh would join it, and a poller
* awaiting its refresh would never tick again. A flight is let go after a
* stall bound; the next refresh starts a fresh read whose fence retires the
* hung one, so its answer is discarded if it ever arrives.
*/
describe("useSessionRequests — a stalled read", () => {
beforeEach(() => {
sessionClientMock.listSessionRequests.mockReset();
recoveryClientMock.checkInterrupted.mockReset().mockResolvedValue(undefined);
devToolState.config = { userId: "devuser" };
devToolState.autoRecoverInterrupted = false;
devToolState.sessionClient = sessionClientMock;
});

it("lets go of a read that never settles, and a later refresh reads again", async () => {
let resolveHung!: (rows: unknown[]) => void;
sessionClientMock.listSessionRequests.mockReturnValueOnce(
new Promise((resolve) => (resolveHung = resolve as (rows: unknown[]) => void))
);
vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout"] });
try {
const { result } = renderHook(() => useSessionRequests("sess_1"));
await act(async () => {});
expect(sessionClientMock.listSessionRequests).toHaveBeenCalledTimes(1);

// A caller that joined the hung read is released once the bound passes,
// so a poller awaiting it ticks again.
let joinedSettled = false;
act(() => {
void result.current.refresh().then(() => (joinedSettled = true));
});
sessionClientMock.listSessionRequests.mockResolvedValue([{ id: "req_fresh", status: "completed" }]);
await act(async () => {
await vi.advanceTimersByTimeAsync(20_000);
});
expect(joinedSettled).toBe(true);
expect(sessionClientMock.listSessionRequests).toHaveBeenCalledTimes(2);
expect(result.current.requests).toEqual([{ id: "req_fresh", status: "completed" }]);

// The hung read's answer, arriving late, does not overwrite the fresh one.
await act(async () => {
resolveHung([{ id: "req_hung", status: "in_progress" }]);
});
expect(result.current.requests).toEqual([{ id: "req_fresh", status: "completed" }]);
} finally {
vi.useRealTimers();
}
});
});
Loading