Skip to content

feat(server): compact agent-toolkit session output and full ids in next-call hints (TEC-1818) - #355

Merged
bk-agent-01 merged 3 commits into
stagefrom
t3/tec-1818-compact-session-output
Oct 29, 2026
Merged

bk-agent-01 merged 3 commits into
stagefrom
t3/tec-1818-compact-session-output

Conversation

@bk-agent-01

@bk-agent-01 bk-agent-01 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Closes TEC-1818

Summary

Agent-toolkit results are now short by default. Next-call hints now use the full session id, so they always resolve.

One t3_find_sessions line, before:

1. `86157111` **Compact output** · project bkt3 · TEC-1818 · TEC-1624 · PR #301 (open, checks passing) · PR #300 (merged, checks passing) · PR #299 (closed) — idle, last change 1m ago

After (default detail: "compact"):

1. `86157111` **Compact output** · project bkt3 · 2 tickets · 3 PRs (1 open) — idle, last change 1m ago

detail: "full" gives the old line exactly.

What changed:

  1. t3_find_sessions, t3_inbox, t3_answer and t3_session_brief take detail: "compact" | "full". The default is compact. A single ticket or pull request still shows as itself.
  2. In JSON mode, compact replaces the linear and pullRequests arrays with linearCount, pullRequestCount and openPullRequestCount. Full keeps the arrays.
  3. Every generated next-call hint uses the full session id. The short ref stays for display. Subagent ids (thread:delegated-task:...) can share a short ref, so a short ref can match several sessions.
  4. t3_list_sessions takes an opaque cursor and returns nextCursor. The order is the same as before (newest change first). It now drops linearLinks to linearLinkCount unless detail: "full".
  5. Question options, request ids and answer calls are not changed.

Decisions

Decision Options Why Undo Confidence
t3_whoami and t3_wait also use compact tags Compact everywhere / only the four named tools They share the same heading code. The ticket goal is "short by default". Pass the detail to their context Sure
Request ids in hints stay short Full / short A request id resolves only inside one session, so it cannot collide with another session. Use the full request id in requestRef Sure
Schedule ids in hints stay short Full / short Out of scope: the ticket is about session ids. Session hints in schedules and watch notes now use the full id. Change shortRef(task.id) calls Sure
t3_list_sessions cursor Offset / keyset on the last session / both The cursor keeps the offset and the last session. The next page starts after that session when it did not change, so a new session does not shift the page. It falls back to the offset. Use the offset only Sure
t3_list_sessions compact by default Default compact / default full The ticket asks for shorter default output. Callers that read linearLinks must pass detail: "full". No caller in this repository reads it. Make full the default Sure

Acceptance check

Ticket item Proof Status
Compact heading is the default; full keeps today's output compactOutput.test.ts "session heading detail" passed in CI run 40739549318
JSON compact gives counts; full gives arrays compactOutput.test.ts "session tags as data" passed in CI run 40739549318
Next-call hints use the full session id compactOutput.test.ts "next-call hints", render.test.ts, scheduledTaskWatch.expbkt3.test.ts passed in CI run 40739549318
Question options and request ids are kept compactOutput.test.ts "names the full session id in t3_inbox hints" passed in CI run 40739549318
t3_list_sessions cursor pages, compact linearLinks handlers.listSessionsPaging.test.ts passed in CI run 40739549318

How I tested

No local tests on the shared host; CI runs the suite.

CI run 40739549318 on head 2de0a3039: Lint, Build and Typecheck, Fork markers and the new tests pass (compactOutput.test.ts 8, handlers.listSessionsPaging.test.ts 5, render.test.ts 6, scheduledTaskWatch.expbkt3.test.ts 7). Test Server 4 fails in src/storageCleanup.test.ts > "compares the checked-out branch without a full status". That failure is already on stage: the last run of PR #354 (40705333893) fails the same test. This PR does not touch storage cleanup.

Cross-review: not run yet. The orchestrating session owns the review step.

🤖 Generated with Claude Code

…all hints

- t3_find_sessions, t3_inbox, t3_answer and t3_session_brief take
  detail: "compact" | "full" (default compact). Compact counts tickets and
  pull requests ("2 tickets · 3 PRs (1 open)"), or shows the single item;
  JSON replaces the linear/pullRequests arrays with linearCount,
  pullRequestCount and openPullRequestCount. Full keeps today's output.
- Every generated next-call hint names the full session id; the short ref
  stays for display only, since subagent ids can share a short ref.
- t3_list_sessions takes an opaque cursor and returns nextCursor, in its
  newest-change-first order, and drops linearLinks to linearLinkCount
  unless detail: "full".
- Fork-owned tests: compactOutput.test.ts and
  handlers.listSessionsPaging.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Oct 28, 2026

@bk-agent-01 bk-agent-01 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cross-review r1 · gpt-6.1-sol] P2 Two correctness gaps remain: cursor recovery after an anchor disappears, and session references in wait continuation hints. No local tests ran. The storageCleanup failure also appears in base run 40705333893; this PR does not change that code.

…e resolved ids

- t3_list_sessions orders newest change first with an id tie-breaker and
  pages strictly after the last session's (updatedAt, id) key. No offset
  fallback, so a deleted or moved session neither skips nor repeats others.
- t3_wait timeout and matched-change hints name the resolved full session
  ids instead of copying the caller's references.
- Tests: deleted anchor, moved anchor, equal timestamps; short refs in wait
  hints. customGroup test now expects id order for equal change times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bk-agent-01

Copy link
Copy Markdown
Collaborator Author

Cross-review record — gpt-6.1-sol on a9cc2d4

Rounds: 2. Verdict: clean.

Round Finding Severity Outcome (commit or reason)
1 r1-1: Cursor fallback skips sessions after anchor deletion P2 Fixed in a9cc2d4. The cursor stores the last sort key. The next page selects keys strictly after it. Tests cover deletion, anchor movement, and equal timestamps.
1 r1-2: Wait hints retain ambiguous input references P2 Fixed in a9cc2d4. Both affected hints use the resolved full session IDs through waitAgainHint. Tests cover later prefix ambiguity and an unrestricted wait.
2 No new findings — Reviewed the delta and affected callers. The caller search found no dependency on snapshot order for equal timestamps.
Deferred: none. Fallback: none.

No local tests, builds, or linters ran. The known storageCleanup test failure is outside this review's scope.

@bk-agent-01
bk-agent-01 marked this pull request as ready for review October 29, 2026 06:30
@bk-agent-01

Copy link
Copy Markdown
Collaborator Author

Merge decision: tushar chose "AI fixes it" (test fix, then merge B1 and B2 to stage) in the T3 session on 2026-10-29. Head d0a97be, all checks green. Cross-review: gpt-6.1-sol clean after 2 rounds on a9cc2d4; this head only adds a clean merge of stage (#357). bkmain promotion stays tushar's call.

@bk-agent-01
bk-agent-01 merged commit 50ecac6 into stage Oct 29, 2026
29 checks passed
bk-agent-01 added a commit that referenced this pull request Oct 29, 2026
Promote stage to bkt3 (2026-10-29): agent toolkit compact output, session lifecycle tool, actionable MCP errors (#355, #356, #357)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant