Skip to content

feat(orchestrator): renew in the same thread from GitHub and the T3 thread list - #336

Open
bfcarrasco wants to merge 1 commit into
mainfrom
feat/orchestrator-renewal-same-thread
Open

bfcarrasco wants to merge 1 commit into
mainfrom
feat/orchestrator-renewal-same-thread

Conversation

@bfcarrasco

Copy link
Copy Markdown
Owner

Request

Closes #326 (spec #318, behaviour 11).

Acceptance criteria:

  • After a finished goal, and after a compaction, the orchestrator restarts in the same thread with a fresh context (T3's fresh session for a thread). Where T3 cannot do that for a thread's own session, it starts a successor thread, names it to the owner and settles itself.
  • Renewed in the middle of a queue, it names the same running lanes, open PRs and waiting owner questions as before, from tracker.mjs board and the T3 thread list alone.
  • Lanes that were running are picked up and still wake it; none is started twice.
  • An owner question asked before the renewal is not asked again.
  • Evidence: the token count of the first turn after a renewal, against the last turn before it.

Change

  • skills/orchestrator/SKILL.md: a Renewal section. The thread sends itself a message with t3_thread_send and freshContext: true (T3: "Start a new provider session without the thread's earlier context, like /clear"), carrying no state; a successor thread only where T3 refuses that. After a renewal it reads t3_thread_list (settled: false, all projects, subagents) through lane.mjs lanes, then tracker.mjs board for those repos.
  • Lane titles are now <owner/repo>#<n> <title>, so a renewal maps a lane to its repo and ticket; a ticket that is claimed or has a running lane gets no second lane.
  • Owner questions are recorded on their issue (comment plus ready-for-human), so the board's readyForHuman shows what was asked. Finished lanes nothing waits on are settled, which keeps the thread list small (settled: false returned 9 of 2053 threads here).
  • scripts/lane.mjs lanes [<earlier orchestrator thread id>...]: reads t3_thread_list pages, keeps threads whose parent is this orchestrator (or the one it replaced), and prints repo, ticket, thread, status, running, the repos and the board's -R arguments.

Proof

  • node --test "tests/*.test.mjs" and node tools/check-plugin.mjs pass locally; tests/lane.test.mjs covers parent filtering, title parsing, the successor case over several pages, and the CLI.
  • The fields lanes reads (currentThreadId, parentThreadId, status) and the settled filter were read from a live t3_thread_list in T3 Code.
  • Not run: a real T3 renewal mid-queue and the token count before and after it. Per the owner's decision on Orchestrator: one T3 Code thread that runs work in all repos from goal to merged #318 that run is optional; it is the owner's T3 test.

…hread list

The orchestrator throws its context away after each finished goal and after a
compaction (T3 fresh session, or a successor thread where T3 refuses it), then
rebuilds its picture from `tracker.mjs board` and `lane.mjs lanes`, which reads
its lanes from the T3 thread list by parent and `<owner/repo>#<n>` title.
Owner questions live on their issue as a comment plus `ready-for-human`, so a
renewal does not ask them again.
@bfcarrasco

Copy link
Copy Markdown
Owner Author

bstack-judge: UNPROVEN tier=1 missing=T3 Code tools (t3_thread_send with freshContext, t3_thread_list, delegate_task) sha=016544bc10629f27a95701473ea02739ca1f97f2

Owner: the proof could not be run here: T3 Code tools (t3_thread_send with freshContext, t3_thread_list, delegate_task); run the judge on a machine that has it, or give the owner's OK line as the whole PR comment: bstack-user-ok sha=016544bc10629f27a95701473ea02739ca1f97f2. Nothing is asked of the builder.

PR 336, head 016544b. Verdict: UNPROVEN. I found no defect, but the T3 behaviour in four criteria could not be run here.

Criteria and proof

  1. Fresh-context restart in the same thread, with a successor thread as fallback. UNPROVEN. I have no T3 tools. The t3_thread_send freshContext flag, the t3_thread_configure call and the "T3 refuses" fallback exist only as instructions in plugins/bstack/skills/orchestrator/SKILL.md. tests/lane.test.mjs only checks that the text mentions freshContext: true.
  2. After a renewal it names the same lanes, PRs and questions. PARTLY PROVEN.
    • node plugins/bstack/scripts/lane.mjs lanes on fixture thread lists printed repo, ticket, thread, status, running, the repos and -R o/r.
    • It kept only threads whose parent is the orchestrator and whose title starts with <owner/repo>#<n>. A title like o/r#7x was rejected.
    • A successor also gets the lanes of the earlier thread when that thread's id is passed.
    • tracker.mjs board accepts repeated -R and has readyForHuman, built from the ready-for-human label (plugins/bstack/scripts/tracker.mjs).
    • Not run: a live mid-queue renewal.
  3. Running lanes picked up and none started twice. PARTLY PROVEN. lane.mjs lanes marks running: true for non-finished statuses. The "no second lane" rule is SKILL.md text only, so I could not show a duplicate being prevented.
  4. A question asked before is not asked again. PARTLY PROVEN. It rests on the ready-for-human label on the issue plus board.readyForHuman. That mechanism exists and the SKILL.md steps are coherent. Not run end to end.
  5. Token-count evidence. UNPROVEN. The PR body says it was not run, and the owner's decision on Orchestrator: one T3 Code thread that runs work in all repos from goal to merged #318 makes it optional.

Tests

  • node --test tests/lane.test.mjs on head: 11 of 11 pass.
  • On base, the new tests cannot pass, because lanes is not exported from lane.mjs. I did not run the base-code swap.
  • I did not run the full suite. The PR body says it passes locally and bstack/checks covers it.

Findings

  • F1 (no block): FINISHED in lane.mjs is idle, completed, interrupted, failed, cancelled, rolled_back. I found no list of real T3 status values in the repo. A status outside this set, such as ready, is reported as running: true. That errs toward not restarting a lane, so it is safe. A lane that has actually finished could still be reported as running. It is not blocking, but the status values should be checked against a live t3_thread_list.

Dropped hypotheses

  • Empty list or no currentThreadId: exits 1 with a clear message.
  • UTF-8 BOM on stdin: tested and handled.
  • Another orchestrator's lanes: filtered out by parent id.
  • A lane title without a repo prefix: skipped.
  • A lane title with an owner/repo containing dots or dashes: handled.
{"findings":[{"id":"F1","title":"Finished-status set in lane.mjs is unverified; unknown statuses report running:true","reproduction":"echo '{\"currentThreadId\":\"o\",\"threads\":[{\"threadId\":\"a\",\"title\":\"o/r#7 x\",\"status\":\"ready\",\"parentThreadId\":\"o\"}]}' | node plugins/bstack/scripts/lane.mjs lanes","base":"not run","head":"pass","blocks":"no","files":["plugins/bstack/scripts/lane.mjs"]}],"missing":"T3 Code tools (t3_thread_send with freshContext, t3_thread_list, delegate_task) and a live renewal mid-queue with token counts"}

@bfcarrasco

Copy link
Copy Markdown
Owner Author

Status: head 016544b. CI is green. The judge returned UNPROVEN only because it has no T3 Code tools. It found no defect; F1 does not block, and its status set matches the statuses enum of t3_thread_list. The next step is the owner's T3 test of a renewal mid-queue, then the OK line. The branch feat/orchestrator-renewal-same-thread is pushed.

@bfcarrasco

Copy link
Copy Markdown
Owner Author

bstack-user-ok sha=016544bc10629f27a95701473ea02739ca1f97f2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orchestrator: renewal in the same thread, from GitHub alone

1 participant