Repository navigation
Agent inbox: show failed turns and a latest-activity line on each card - #491
Merged
Merged
Conversation
…tivity line per card (ThinkFlowLab#471)
Collaborator
Author
|
Self-review: PASS
|
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 20, 2026
…nkFlowLab#481/ThinkFlowLab#501/ThinkFlowLab#505) Regenerated ds-bot patches after merge.
Collaborator
Author
|
Self-review: PASS
|
Birfy
added a commit
to Birfy/FlyBot
that referenced
this pull request
Oct 23, 2026
…kFlowLab#669) Part of ThinkFlowLab#471 — the **v1 count board** from the spec of record (triage 2026-10-21): one `N tool calls` line per card, for that card's own place. The three-column board with a List/Board toggle stays v2 and needs the owner, so this PR does not close the issue. ## Reproduce On `main` `c74e1207` no inbox card can show a tool-call count: `inboxModel` builds its cards from approvals, running turns, tasks and ended turns, but neither `workView()` nor `endedView()` in `core/src/host/turns.js` records how many tools a turn ran, so there is nothing to render. (Failed turns and the *Latest* line from ThinkFlowLab#491 stay exactly as they are.) ## What changed - `core/src/host/turns.js`: counts `tool/call` events per turn (`entry.toolCalls`, reset at `turn/start`). The running turn's count rides `work.bots[id].calls` and its `work.rooms[roomId][]` entry (only above 0); a turn that ended keeps its own count as `calls` on its `endedView()` entry. One source — the events the activity feed already folds; no new endpoint, no new polling. - `core/src/client/inbox.js`: `toolCalls(card)` reads the count for the card's own place — the turn running there now (the Bot's own chat, or that one group), else the newest ended turn there — never summed across places, `0` when unknown; `InboxCard` draws one muted `N tool calls` line (`bt-inbox-calls`) only when it is above 0. Grouping, the 7-day Done cap, `needsCount`, the latest-activity line and the read-only **Open** action are unchanged. - `core/src/client/i18n.js`: `{count} tool calls` / `{count} 次工具调用`. - `docs/subsystems/core-client.md` and `core-host.md`; the inbox model and host tests, plus the ThinkFlowLab#553 work-view expectation in `core/test/group-work.test.js`. - Generated, not hand-edited: `core/client.js` (`npm run build`) and `patches/ds-bot/` (`generate` then `check`). ## What I ran Tip SHA: `1958157a007ae2809bf7ea82426f985f39b52074` (Node 22.23.3, `TZ=UTC`): - `node --import ./test/harness-resolve.mjs --test test/inbox.test.js` → 21/21. - `node --import ./test/harness-resolve.mjs --test test/approval-notices.test.js` → 12/12; `test/group-work.test.js` → 15/15. - `node --import ./test/harness-resolve.mjs --test --test-concurrency=4 "test/*.test.js"` (the CI `test` job's suite) → **1204/1204, exit 0**. `--test-concurrency=4` only because this box has a 512-pid cgroup: the default 192-way spawn hits `spawn EAGAIN` with other benches running; it changes nothing about the tests. - `cd core && npm run lint` → oxlint 0 errors (43 pre-existing warnings), `arch-docs: OK (13 changed file(s))`. - `node scripts/build-client.mjs --check` → OK; `node scripts/ds-bot-patches.mjs check` → `ds-bot/` = pin (tree `5834c00`, v0.1.5), 10 patches apply cleanly, `core/` = `ds-bot/` + patches. - `plugins/social` 317/317, `plugins/timeline` 104/104, `plugins/tree` 89/89. ## Red without the source change With `core/src/client/inbox.js`, `core/src/client/i18n.js` and `core/src/host/turns.js` at main `c74e1207` and the new tests kept: - `test/inbox.test.js` → 19/21: both new tests fail (`Cannot read properties of undefined` — no `calls` on the model, no `bt-inbox-calls` row). - `test/approval-notices.test.js` → 11/12: the new host test fails — the running turn and the ended turn carry no `calls`. ## Not run - The smoke bench (`CONTEXT_WINDOW=100000 CHECK_RATIO=0.45 dev/bench.sh smoke 3096 8796 reset`): it stops at `pnpm: not found` on this box (no pnpm installed), and the desktop/web profile it starts is not available here. The change is a count folded from `session/event` and read by the client, with the host covered by `core/test/approval-notices.test.js`; green `tests-ok` at the tip is the gate. ## Risk - **T2** by `risk-rules.json` (`core/src/host/turns.js`; client, tests and docs are T1/T0), so it needs your PASS at this tip plus green `tests-ok`. Nothing here touches authz, secrets, permissions or saved state. - The count is per turn and per place and process-local, like the rest of the work snapshot: after a restart a Done card shows no count until that place's next ended turn. A program's sub-calls (`run_code`) are not counted — the spec of record says `tool/call` events. - `1 tool calls` reads slightly off; the spec of record fixes the copy as `{count} tool calls`, so it stays that way unless you want a singular key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #471 (first slice, owner decision 2026-10-20 option a). #471 also lists items the owner deferred (board view, tool-call counts, first-run guide, team views waiting for #51/#149/#55/#57, inbox-side task actions), so this PR does not close it.
What
work.ended, the same ended-turn entries the finish/fail notifications use (Proactive reminders 1/3: event reminders (approval waiting, failed, finished) in app and desktop #353, PR Notify when my own Bots finish or fail a turn, with one Notifications switch #470); no second event source. A card shows while that failure is the latest ended turn in its place (a Bot's own chat or one group), younger than 7 days, and the Bot is not running or waiting for an approval there. A later finished turn clears it, and that chat is then not also in Done. Title: the chat's last line (The last turn did not finish without the Session list); reason: the failure text. Open only.Latest: …(full text on hover): a task's newest note, else what its Bot runs there now (running turns and tasks only), else the chat's last line. Left out when it only repeats the title or reason.turns.js): past the last 20 ended turns, a place's latest turn is kept while it is a failure younger than 7 days (at most 50), so busy Bots elsewhere do not push an unresolved failure out of the inbox. Notifications are unaffected (they already skip entries they told or that predate the window).Test
core/test/inbox.test.js: failed-turn cards (own Bots only, latest-in-place, cleared by running/waiting/a later finished turn, 7 days, badge count, Open only) and the latest-activity row (sources, no repeats, rendering).core/test/approval-notices.test.js: the host keeps a still-latest failure past the last 20 and drops it once a finished turn follows.ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify: pass (core 1080, social 296, tree 80, timeline 83, scripts 93, interop 37, live-e2e 16; 0 failures; plugin lint ok; patches check ok; arch-docs OK).Docs:
docs/subsystems/core-client.md(Agent inbox),docs/subsystems/core-host.md(endedView). Changelog:changelog.d/471-inbox-failed-turns.added.md.Risk tier: T2 (estimate; the controller sets the label)