Repository navigation
feat(claude): report workflow tasks and preserve idle status - #307
Merged
Merged
Conversation
This was referenced Oct 10, 2026
xxchan
added a commit
that referenced
this pull request
Oct 10, 2026
… claude OAR starts (#310) Closes #309. A host started from inside Claude Code (its Bash tool, a hook) inherits that session's markers. OAR removed only `CLAUDECODE` and, since #307, `CLAUDE_CODE_ENTRYPOINT`. Lookout's static read of claude 2.1.292 plus a mock-provider run found what the rest do: - **`CLAUDE_CODE_CHILD_SESSION`:** claude counts it, like `CLAUDECODE`, as "running inside a Claude Code session". In print mode that turns off skill proposals, refuses org memory, and skips prompt history. - **`CLAUDE_CODE_MESSAGING_TOKEN`:** the parent session's credential, which OAR passed into the child. - **The others:** no effect in `-p`, or claude overwrites them. Claude itself drops them when it launches an independent claude (its daemon launcher). **Change:** `runtimes/claude/environment.ts` holds the list. It is claude's own launcher list (`CLAUDECODE`, `CLAUDE_CODE_SESSION_ID`, `CLAUDE_CODE_CHILD_SESSION`, `CLAUDE_CODE_SESSION_ATTENDED`, `CLAUDE_CODE_CHROME_MCP_ORG_DENIED`, `CLAUDE_CODE_EVAL_INTERVIEW_SESSION`, `CLAUDE_CODE_BRIDGE_SESSION_ID`, `CLAUDE_CODE_HOST_WORKTREE`, `CLAUDE_CODE_HOST_WORKTREE_FENCE`, `CLAUDE_CODE_ENTRYPOINT`) plus `CLAUDE_CODE_MESSAGING_SOCKET` and `CLAUDE_CODE_MESSAGING_TOKEN`. - Sessions drop all of them; an explicit `SessionOptions.env` value still wins, except `CLAUDECODE`. - The claude subcommands OAR runs (auth status, login, logout, account usage, model list, inventory) use the same list. - `TRACEPARENT` (trace context) and an `AI_AGENT` set by another tool pass through. **Tests:** `tests/claude/claude-launch-env.test.ts`. Every marker is removed from a session and from the subcommand environment, the two configuration variables pass, an explicit value wins, `CLAUDECODE` can't be set, and the host's own environment is untouched. Full suite (1,535), lint and typecheck pass locally. Docs: docs/runtimes/claude.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Merged
xxchan
added a commit
that referenced
this pull request
Oct 10, 2026
Release OAR and CLI 0.53.0. This PR changes only the two package version fields. **Fixed: a host prompt gets its own answer on claude** (#308, #313) - A host prompt sent while claude is busy (for example as a background task finishes) can wait behind a turn claude starts on its own. OAR used to end the prompt at that other turn's result and hand the host the wrong text. claude now reports each prompt's own `command_lifecycle` (`queued`, then `started`), and OAR attributes the turn by it: - `input_queued { inputId }` (new) means claude holds the input and has not started its turn; - `turn_active` gains an optional `inputId` for the input whose turn claude started; - a turn without that id while the prompt waits is a separate turn. `promptAndWait`, `awaitTurnEnd(…, inputId)`, `awaitIdle`, `statusOf` and the session view all follow this, live and on replay. An ordinary prompt shows no change: no idle flicker and no moved bubble. - `promptAndWait` now sends a fresh UUID `inputId` when the caller gives none. `awaitTurnEnd` takes an optional `inputId`. - **`abort()` while a host prompt is still queued** sends claude's interrupt with `cancel_queued` (when claude declares `interrupt_cancel_queued_v1`). The queued prompt is cancelled with the running turn, and `input_dropped { reason: "turn_interrupted" }` hands it back. Cost: claude also drops queued task notifications that have no id. - **A reused `inputId`:** claude ignores a user message whose id it has already seen. OAR used to wait until the abort fallback killed the process. Now `input_dropped { reason: "runtime_refused", failure: "invalid_request", message }` is emitted at once and the session takes the next prompt. Resend a dropped input with a **new** `inputId` on claude. **Added: claude workflow runs are tasks** (#305, #307) - Claude Code's local workflows (`local_workflow`) are reported as `TaskType` `"workflow"`, and agent teammates (`in_process_teammate`) as `"agent"`. A changed `task_progress.description` becomes `task_updated`. The phase and agent list (`workflow_progress`) stays in the native frame only, because it is outside claude's SDK schema. A workflow's spend appears in a later `result.modelUsage`. - A turn claude starts on its own (after a workflow, a queued message, a late steer) now emits `turn_active` at once, so the host does not show idle until text arrives. **Fixed: claude sessions no longer inherit a parent Claude Code session's markers** (#303, #307, #309, #310) - A host started from inside Claude Code passed that session's markers to every claude OAR started. The worst cases: `CLAUDE_CODE_CHILD_SESSION`, which made claude treat itself as part of the parent session; an inherited `CLAUDE_CODE_ENTRYPOINT`, which made an API-key session fail with "Not logged in"; and the parent's `CLAUDE_CODE_MESSAGING_TOKEN`. Sessions and the claude subcommands OAR runs (auth, login, logout, usage, model list, inventory, `claude update`) now drop the twelve markers claude itself drops when it launches an independent claude. An explicit `SessionOptions.env` value still wins, except `CLAUDECODE`. - A `compaction_ended` received while idle leaves status idle. **Added: install steps when OAR won't run them** (#311) - `requires_privileges` and `missing_tool` answers now carry the vendor's `steps` and `source`, for a person to run once they have the rights or the tool. OAR runs none of them. **Behavior changes** - New event kinds `input_queued`, plus optional fields on `turn_active` (`inputId`) and `input_dropped` (`failure`, `message`, only with `runtime_refused`). Hosts with an exhaustive `switch` need the new case. - `TaskType` gains `"workflow"`. - `promptAndWait` always sends an `inputId`, so the input's identity in `ConversationInput` is that id, not the request id. - On claude, resend a dropped input with a new `inputId`. Validation: every PR passed all 17 checks on its final head. #307 differed from its CI tree only in the version fields from the 0.52.0 release. #311 was verified locally on top of #310 (typecheck, lint, full tests), and its merged tree equals that verified tree. #310 and #313 merged with trees equal to their CI trees. Lookout verified each against the real claude CLI with a mock provider, with no account: three workflow recordings, the environment of every claude process, and more than a dozen lifecycle recordings for #313 (collision, steer, queue, cancel before and after start, plain interrupt, fold-in, duplicate after drop and after resume). After this PR passes CI and merges, tag its exact squash commit as `v0.53.0` to trigger npm trusted publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 19, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_11622ce01bb421428d4971c094ca3840"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> An OpenCode 1.19.6 soak agent lost harbor's channel rules ("answer only with `harbor send`") to two automatic compactions. OpenCode 1.x does not report those compactions to OAR (tracked separately in #core:#307). When it went to post its result, it searched PATH for a chat tool, found the host's `raft` CLI and used it. Changes (owner suggestion: use the system prompt): - The rules go in `appendSystemPrompt` on every open, fresh and resumed, as a Raft host's own instructions do. Compaction cannot summarize them away, and a resume that omitted the option would keep the saved value only until compaction. They now also say that other chat tools on the machine, such as `raft`, act as the host. - A runtime that declares `refusedSessionOptions.appendSystemPrompt` opens without it. So does one whose open throws `UnsupportedOptionError` for that option (OpenCode 2, Grok and Factory on resume); that error is journaled as `rules_in_messages`. Such agents get the rules in their first message and again after a reported compaction, and every other delivery starts with a one-line reminder. - A compaction reported while a delivery is in flight still brings the rules back on the next delivery. - README: agents run as the host's OS user and can reach what it is logged in to. Tests: `tests/harbor-open-rules.test.ts` (accepted, declared refusal, refusal at open retried once, other errors not retried) and `tests/harbor-deliveries.test.ts` (fallback preamble and reminder, rules in prompt not repeated, resume that loses the prompt, compaction during a delivery). Full `pnpm run check` passes: 5098 unit tests, mock 19. An independent review found the mid-delivery compaction race and the missing open tests; both are fixed in the second commit. It also confirmed that retrying the open is safe: OpenCode 2, Grok and Factory refuse before starting a process, DSH and Antigravity clean theirs up first, and Kimi, Cursor, CodeBuddy and Devin declare the refusal, so harbor never retries for them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]> Co-authored-by: xxchan <[email protected]>
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.
Claude's workflow runs currently appear as
othertasks with stale descriptions, and a turn started by a workflow notification can leave the host showing idle until text arrives. Report each run as oneworkflowtask, project changedtask_progress.descriptionvalues, and reportturn_activeonly for spontaneous root starts. Host prompts and repeated init frames produce no duplicate start event.Also remove inherited
CLAUDE_CODE_ENTRYPOINTso print mode selects its ownsdk-clientrypoint; an explicitSessionOptions.envvalue still wins. Acompaction_endedoutside a turn now preserves idle status and the previous turn outcome.Host-visible changes:
TaskTypeswitches need aworkflowcase. Claude'sin_process_teammatemaps toagent.workflow_progressstays in the redacted native frame; it creates no phase, agent or tool events. Spend still comes only fromresult.modelUsage, never tasktotal_tokens.The Claude page documents workflow gates, native identifiers, delayed spend, withhold mode, and the entrypoint/idle-compaction boundary. Lookout's three Claude 2.1.292 recordings (mock provider, no account) are committed as replay fixtures: two phases/two agents, a child Bash call, and a TaskStop-stopped run. Live-adapter regressions assert exact native frames, live/replay agreement, task identity and descriptions, usage, stop status, busy rejection at spontaneous init, and nested credential redaction.
Validation:
CI=1 pnpm run check(1,533 unit tests) andpnpm run build.No real-account calls were made. The live idle-compaction timer, withhold mode and host
stop_taskcontrol were not exercised; hoststop_taskremains outside this change.Closes #303.
Closes #305.