Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions docs/cli/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ cases fail earlier:
See
[pi § Per-persona model configuration](../runtimes/pi.md#per-persona-model-configuration).

## Live progress

Progress display depends on the selected runtime. See
[Claude Workflow progress](../runtimes/claude.md#live-claude-workflow-progress)
for Claude background tasks, agent lifecycle metadata and display limits.

## Output artifacts

Each run produces artifacts in the output directory. Relative `--output-dir`
Expand Down
110 changes: 110 additions & 0 deletions docs/runtimes/claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ fullsend run triage --model opus --effort high
Choosing between runtimes is in [Agent runtimes](../runtimes.md). Selection, precedence and the
config keys live there too.

Background Workflow phase/agent changes and runtime lifecycle/status notices
are displayed from Claude's structured event stream. See
[live Workflow progress](#live-claude-workflow-progress)
for the display behavior and its limits; it does not include full nested tool
stdout/stderr.

## Models

Pass an alias or a model id. fullsend resolves `opus`, `sonnet` and `haiku` itself and passes the
Expand Down Expand Up @@ -324,6 +330,110 @@ These are the places Claude Code differs from pi — useful when comparing a run
hook wiring is passed explicitly with `--settings` so it loads regardless, but repo-supplied hooks
are a separate exposure to be aware of.

## Live Claude Workflow progress

When Claude Code emits background task and Workflow progress, `fullsend run`
prints task identity, agent labels, attributed phases, state changes, and
available tool names/context. For example:

```console
⚙ Task wf-example / agent #1 (reader) [Read]: read input — running (attempt 1)
⚙ Task wf-example / agent #1 (reader) [Read]: read input — completed (attempt 1)
⚙ Task wf-example / agent #2 (creator) [Create]: strategy-create — running (tool: Bash: python3 create.py) (attempt 1)
```

Unchanged snapshots and counter-only updates do not repeat the same display
line. Text is sanitized, credential-redacted, and bounded before display or
retention in the bounded display cache. Progress text uses Unicode cleanup:
bidirectional overrides, invisible format characters and Unicode tags are
removed, and compatibility characters are normalized. The CLI applies the
same cleanup to credential literals before matching.
A dedicated reconciler owns lifecycle and deduplication; the renderer prints
its safe messages. Parser/`OnEvent` callbacks and captured stream bytes keep
their original snapshot content.

Concurrent tasks and agents retain
separate identities. Task tool/status fields retain omitted values;
explicit empty strings clear them. Pausing hides the last summary until the
task resumes; a terminal state or new run clears it. Partial lifecycle
patches retain known task labels and state; explicit starts can reset an
identity. Late running snapshots do not reopen known terminal tasks or
agents. Sparse agent snapshots retain known
labels, phases and tool context. Error, blocked and cached metadata persists
within a state; state changes clear omitted transient metadata. Explicit
empty strings and false flags also clear their corresponding fields.

Task visibility, terminal state and run watermarks are retained separately
from agent display rows. New runs and terminal task states retire old agent
rows. Tracking admits up to 1,024 task identities and 1,024 agents per task,
with a shared 16,384-row threshold for admitting new agent rows. At a limit,
new identities or agent rows are suppressed; tracked rows and task guards
remain.
Agent-row capacity becomes available when tasks finish or open new runs.
Task-identity slots stay reserved for the renderer's lifetime.

Run IDs follow the Agent SDK opening order; late frames from superseded
runs are ignored, so they cannot steal later updates without a run ID.
Visibility belongs to each run: promoting its first late run ID preserves
its hidden classification, while a distinct named run does not inherit an
older run's visibility. Hook names and event attribution survive sparse
progress/completion messages for the same hook ID.

Workflow agent wire states are only `start`, `progress`, `done` and `error`.
A `start` record with `queuedAt` and no `startedAt` is queued; a record with
`startedAt` is executing. Started agents display their one-based `attempt`
when supplied. A retry start has an `attempt` greater than one; its display
includes `attempt` and the supplied `lastAttemptReason`
(`stalled`, `throttled` or `user-retry`). Later progress is running, with the
attempt retained, and each new attempt is visible even when its label and
tool are unchanged. `error` plus `skipped: true` is skipped, not failed.
Older records without timing metadata retain the best-effort running display.
These derived statuses do not assume extra values in the agent wire enum.

The display handles these structured Claude events when the runtime emits
them. Task progress shapes were checked against Claude Code 2.1.296 capture
and the embedded 2.1.312 emitter/schema; this is version-bound compatibility,
not a promise of a stable public protocol. In particular, `workflow_progress`
(including `workflow_agent` metadata) and `system/task_summary` are
**undocumented internal Claude Code extensions**, not public Agent SDK
contracts in the inspected version. They may change or disappear without
notice in any Claude patch release. Support is best-effort; unsupported
shapes are ignored for display and raw events remain available for diagnosis.
A newly recorded live 2.1.312 Workflow stream has not been qualified here.

Workflow agents use their positive index as stable identity within a task/run.
A late `agentId` is retained as display attribution, and learning it alone
does not add another progress line. If the index is absent, the agent ID is
the identity fallback.

| Event | Console behavior |
| --- | --- |
| `task_started` | Task identity and description; ambient/hidden starts suppress subsequent progress while tracked. |
| `task_progress` | Task description, last tool and progress summary; best-effort decoding of the undocumented internal `workflow_progress` agent metadata. |
| `task_updated` | Pending, running, paused, completed, failed and killed states; description-only patches and bounded errors. |
| `task_notification` | Completion, failure or stop, including a worker-restart cause when supplied; full result summary excluded. |
| `task_summary` | Undocumented internal mid-turn summary; best-effort display, with null/empty values clearing deduplication silently. |
| `background_tasks_changed` | Count of reported non-ambient background tasks; membership is not execution or completion evidence. |
| `hook_started`, `hook_progress`, `hook_response` | Hook name/event, running/outcome and exit code; stdout/stderr/output excluded. Fullsend launches Claude without `--include-hook-events`, and the inspected Claude 2.1.312 producer emits only SessionStart and Setup hook events in that mode, so those are the only hook rows real runs produce; the decoder still renders other hook events if a future launch enables them. |
| `permission_denied` | Tool/agent identity and bounded decision reason; tool-result body excluded. |
| `status`, `session_state_changed` | Compaction, session state and action-required transitions; per-request status chatter excluded. |
| `informational`, `notification` | Salient notices, suggestions, warnings and text notifications; unkeyed occurrences repeat, transcript-only info excluded. |
| `rate_limit_event` | Warnings, rejection, supplied reset time and subsequent recovery; routine initial allowed status suppressed. |

Declared `workflow_phase` records do not prove live advancement and are not
rendered as phase starts. Internal `workflow_log` entries are filtered out
of SDK progress by the inspected Claude 2.1.312 producer; Fullsend cannot
display records absent from its input stream. This is not a stream of full
nested tool stdout/stderr, prompts, result bodies or hook output. Unknown
message kinds/states and malformed records are ignored for display; raw
events remain in `output.jsonl` for diagnosis and future compatibility work.

Task completion and session idle are distinct from the run's validated
business result. Progress counters do not add to token/cost totals. The
periodic `Agent running (...)` heartbeat still reports elapsed time rather
than proving progress. The display is advisory, not a durable task registry;
very large sessions can evict cached identity and deduplication state.

## Troubleshooting

**The model is not what you asked for.** Check `metrics.json`: `requested_model` is what was handed
Expand Down
55 changes: 55 additions & 0 deletions internal/cli/progress_redaction_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package cli

import (
"bytes"
"strings"
"testing"

agentruntime "github.com/fullsend-ai/fullsend/internal/runtime"
"github.com/fullsend-ai/fullsend/internal/security"
"github.com/fullsend-ai/fullsend/internal/ui"
)

func TestRedactProgressSecretLiterals(t *testing.T) {
for _, tc := range []struct{ name, secret, input string }{
{"split tab", "opaque\trunner credential", "opaque\trun\x1b[31mner credential"},
{"split markers", "opaque::runner%0Acredential", "opaque:\x1b[31m:runner%0Acredential"},
{"Unicode literal", "opaque-\u200bcredential", "opaque-\u200bcred\u2066ential"},
{"compatibility literal", "opaque-credential", "opaque-cred\u202eential"},
{"short normalized value", "opaque\x1b[31m", "opaque"},
} {
t.Run(tc.name, func(t *testing.T) {
var out bytes.Buffer
r := agentruntime.NewEventRenderer(ui.New(&out))
r.RedactProgress = func(s string) string { return redactProgressSecretLiterals(s, map[string]string{"X_TOKEN": tc.secret}) }
r.Handle(agentruntime.TaskProgressEvent{TaskID: "wf", State: agentruntime.TaskRunning, Label: tc.input})
if strings.Contains(out.String(), "opaque") || !strings.Contains(out.String(), "[REDACTED") {
t.Fatalf("normalized credential escaped: %q", out.String())
}
})
}
const longer = "opaque-prefix-shortsecret-tail"
env := map[string]string{"LONG_TOKEN": longer, "SHORT_TOKEN": "shortsecret", "EMPTY_TOKEN": "\x1b[31m\x1b[0m"}
var out bytes.Buffer
r := agentruntime.NewEventRenderer(ui.New(&out))
r.RedactProgress = func(s string) string { return redactProgressSecretLiterals(s, env) }
r.Handle(agentruntime.TaskProgressEvent{TaskID: "wf", State: agentruntime.TaskRunning, Label: "opaque-prefix-\x1b[31mshortsecret-tail"})
if strings.Contains(out.String(), "opaque") || strings.Contains(out.String(), "-tail") {
t.Fatalf("nested literal leaked: %q", out.String())
}
// Empty normalized literals must not inject replacements everywhere.
if got := redactProgressSecretLiterals("ordinary", env); got != "ordinary" {
t.Fatalf("empty normalization matched text: %q", got)
}
t.Setenv("GH_WORKFLOW_TOKEN", "provider\tcredential-for-test")
if got := redactProgressSecretLiterals("provider credential-for-test", nil); strings.Contains(got, "provider") {
t.Fatalf("provider alias unredacted: %q", got)
}
const registered = "registered\tcredential-for-progress-test"
if !security.RegisterRuntimeSecret(registered) {
t.Fatal("register fake runtime secret")
}
if got := redactProgressSecretLiterals("registered credential-for-progress-test", nil); got != "***" {
t.Fatalf("registered alias unredacted: %q", got)
}
}
32 changes: 28 additions & 4 deletions internal/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2768,6 +2768,10 @@ func runAgent(ctx context.Context, agentName, fullsendDir, outputBase, targetRep
collector.attachInput(agentSpan, agentPrompt, promptHidesAlterations(validationFeedback, promptSanitized))
toolSpans := newToolSpanTracker(tracer, agentCtx)
toolSpans.runnerEnv = h.RunnerEnv
renderer := agentruntime.NewEventRenderer(printer)
renderer.RedactProgress = func(text string) string {
return redactProgressSecretLiterals(text, h.RunnerEnv)
}
var metrics agentruntime.RunMetrics
hooksSettings := ""
if h.SecurityEnabled() {
Expand All @@ -2792,7 +2796,7 @@ func runAgent(ctx context.Context, agentName, fullsendDir, outputBase, targetRep
Forge: forgePlatform,
ModelAliases: configModelAliases,
ForgeClient: playbackForgeClient,
OnEvent: iterationEventHandler(agentruntime.NewEventRenderer(printer).Handle, collector, toolSpans),
OnEvent: iterationEventHandler(renderer.Handle, collector, toolSpans),
}, printer, agentStart, &metrics)
close(heartbeatDone)
lastIterElapsed = time.Since(agentStart)
Expand Down Expand Up @@ -4308,6 +4312,16 @@ func preScriptLogResult(res prescript.Result, runnerEnv map[string]string) presc
// (runner secrets among them). Unlike redactFeedback it runs no pattern
// scan, so text that merely looks like a secret is left alone.
func redactSecretLiterals(feedback string, runnerEnv map[string]string) string {
return redactSecretLiteralsWithNormalizer(feedback, runnerEnv, nil)
}

// redactProgressSecretLiterals masks both literal forms because progress
// cleanup can alter a secret itself.
func redactProgressSecretLiterals(feedback string, runnerEnv map[string]string) string {
return redactSecretLiteralsWithNormalizer(feedback, runnerEnv, agentruntime.NormalizeProgressText)
}

func redactSecretLiteralsWithNormalizer(feedback string, runnerEnv map[string]string, normalize func(string) string) string {
// All exact literals are replaced in one pass, longest first, so a
// value that is a substring of another never leaves part of the longer
// one visible, whichever source each came from. envLiterals covers
Expand All @@ -4318,9 +4332,19 @@ func redactSecretLiterals(feedback string, runnerEnv map[string]string) string {
var literals []literal
seen := map[string]bool{}
add := func(value, mask string) {
if len(value) >= minRedactableSecretLen && !seen[value] {
seen[value] = true
literals = append(literals, literal{value, mask})
if len(value) < minRedactableSecretLen {
return
}
values := []string{value}
if normalize != nil {
values = append(values, normalize(value))
}
for _, value := range values {
// An eligible original may normalize to a short sensitive value.
if value != "" && !seen[value] {
seen[value] = true
literals = append(literals, literal{value, mask})
}
}
}
for _, l := range envLiterals(runnerEnv) {
Expand Down
33 changes: 33 additions & 0 deletions internal/cli/workflow_progress_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cli

import (
"strings"
"testing"

agentruntime "github.com/fullsend-ai/fullsend/internal/runtime"
"github.com/fullsend-ai/fullsend/internal/ui"
"github.com/stretchr/testify/assert"
)

func TestIterationEventHandler_WorkflowProgressIsDisplayOnly(t *testing.T) {
t.Setenv("GITHUB_ACTIONS", "")
const secret = "opaque-workflow-runner-secret-for-test"
const provider = "opaque-workflow-provider-secret-for-test"
t.Setenv("GH_WORKFLOW_TOKEN", provider)
var output strings.Builder
renderer := agentruntime.NewEventRenderer(ui.New(&output))
renderer.RedactProgress = func(s string) string { return redactSecretLiterals(s, map[string]string{"PUSH_TOKEN": secret}) }
collector := newContentCollector(4096)
tracker, _, agent := toolSpanFixture(t)
defer agent.End()
handler := iterationEventHandler(renderer.Handle, collector, tracker)
handler(agentruntime.TaskProgressEvent{TaskID: "workflow", State: agentruntime.TaskPaused, Label: secret, Detail: provider})
handler(agentruntime.StatusProgressEvent{Kind: "notice", Label: "Hook", Detail: secret + " " + provider})
assert.Contains(t, output.String(), "paused")
assert.Contains(t, output.String(), "Hook")
assert.NotContains(t, output.String(), secret)
assert.NotContains(t, output.String(), provider)
assert.Empty(t, collector.parts, "status metadata must not become model output")
assert.Zero(t, tracker.created, "status metadata must not fabricate tool spans")
assert.Empty(t, tracker.open)
}
Loading
Loading