Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 8 additions & 5 deletions crates/engine/src/doc_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4287,10 +4287,11 @@ impl DocHost {
"queued message is blocked for editing or review".into(),
));
}
if self
.sessions()
.is_some_and(|sessions| sessions.defers_to_turn_end(chat_id, None))
{
if self.sessions().is_some_and(|sessions| {
sessions.defers_to_turn_end(chat_id, None)
|| (candidate.attachments.is_empty()
&& sessions.holds_command_until_turn_end(chat_id, &candidate.text))
}) {
// Send next: lead the ordinary rows; the drain delivers it the
// moment the current turn ends.
let Some(item) = handle.doc.take_queued(id)? else {
Expand Down Expand Up @@ -6011,7 +6012,9 @@ impl DocHost {
let unsteerable_turn =
sessions.turn_in_flight(chat_id) && !sessions.live_run_steerable(chat_id);
if !prompt.trim().is_empty()
&& (unsteerable_turn || sessions.defers_to_turn_end(chat_id, None))
&& (unsteerable_turn
|| sessions.defers_to_turn_end(chat_id, None)
|| sessions.holds_command_until_turn_end(chat_id, &prompt))
{
let id = message_id.unwrap_or_else(new_id);
self.hold_until_turn_end(handle, &id, &prompt, issued_at, true, None)?;
Expand Down
27 changes: 12 additions & 15 deletions crates/engine/src/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,15 @@ impl SessionsEngine {
.is_some_and(is_active)
}

/// A native command sent during a turn waits for the turn to end: steered
/// in, the provider would run it in place of the turn's task.
pub fn holds_command_until_turn_end(&self, chat_id: &str, prompt: &str) -> bool {
self.turn_in_flight(chat_id)
&& lock(&self.inner.runs).get(chat_id).is_some_and(|h| {
zeron_proto::invocation::native_command(prompt, h.runtime_config.harness_id)
})
}

/// Whether the chat's live runtime reports background work (subagents,
/// background shells) still running — parked or not.
pub fn holds_background_work(&self, chat_id: &str) -> bool {
Expand Down Expand Up @@ -2598,7 +2607,7 @@ impl Inner {
current: Option<&str>,
provider: ProviderSession<'_>,
) -> Option<String> {
if native_command(prompt, harness_id)
if zeron_proto::invocation::native_command(prompt, harness_id)
|| !self
.workspace()
.and_then(|ws| ws.chat(chat_id).ok().flatten())
Expand Down Expand Up @@ -2661,18 +2670,6 @@ impl Inner {
}
}

/// Whether the provider routes this prompt as a native command: its delivered
/// text leads with `/name` (Codex `command_request`, OpenCode commands, Claude
/// slash commands). Anything put in front of it would make it model input.
fn native_command(prompt: &str, harness: HarnessId) -> bool {
let delivered = if harness == HarnessId::Codex {
zeron_proto::invocation::invocation_prompt(prompt)
} else {
zeron_proto::invocation::harness_prompt(prompt, harness)
};
zeron_proto::invocation::leading_command(&delivered).is_some()
}

/// A turn is in flight: streaming, or parked on a question it is still owed an
/// answer to. Notably NOT a persistent session that has parked between turns —
/// that holds a warm child with nothing outstanding.
Expand Down Expand Up @@ -3370,7 +3367,7 @@ async fn drive_run(
} else if request.resume.is_none()
&& !resume_state.idle
&& !carried_history
&& !native_command(&request.prompt, harness_id)
&& !zeron_proto::invocation::native_command(&request.prompt, harness_id)
&& let Some(brief) = doc.carried_context()
{
request.prompt = format!("{brief}\n\n{}", request.prompt);
Expand All @@ -3379,7 +3376,7 @@ async fn drive_run(
// its role and the notes. Slash commands are left bare so they still parse.
if request.resume.is_none()
&& !resume_state.idle
&& !native_command(&request.prompt, harness_id)
&& !zeron_proto::invocation::native_command(&request.prompt, harness_id)
&& let Some(workspace) = inner.workspace()
&& let Some(prefix) = crate::conductor::conductor_prompt_prefix(&workspace, &chat_id)
{
Expand Down
43 changes: 43 additions & 0 deletions crates/engine/tests/message_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,49 @@ async fn held_policy_keeps_a_steerable_message_visible_until_steer_now() {
core.shutdown().await;
}

/// A command steered into a running turn would replace its task, so even a
/// mid-turn agent gets it next, ahead of ordinary rows, once the turn ends.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn steer_now_sends_a_command_next_instead_of_into_the_turn() {
let (core, harness, prompts) = setup(SteeringMode::StepBoundary).await;

core.doc_host
.queue_message(CHAT, "opening", Vec::new())
.expect("queue opening");
wait_for(
|| prompts.lock().unwrap().iter().any(|p| p == "opening"),
"the first turn to start",
)
.await;
core.doc_host
.queue_message(CHAT, "ordinary", Vec::new())
.expect("queue ordinary message");
let command = core
.doc_host
.queue_message(CHAT, "/compact", Vec::new())
.expect("queue command");

assert!(
core.doc_host
.steer_queued_now(CHAT, &command)
.await
.unwrap()
);
tokio::time::sleep(Duration::from_millis(150)).await;
assert_eq!(queue_texts(&core), vec!["/compact", "ordinary"]);
assert_eq!(*prompts.lock().unwrap(), vec!["opening".to_owned()]);

let _ = harness.finish.send(());
wait_for(
|| prompts.lock().unwrap().iter().any(|p| p == "/compact"),
"the command at the turn end",
)
.await;
assert_eq!(queue_texts(&core), vec!["ordinary"]);
let _ = harness.finish.send(());
core.shutdown().await;
}

/// Send next on a turn-boundary agent: the row jumps ahead of ordinary rows
/// and goes out the moment the current turn ends, not into the transcript now.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
Expand Down
12 changes: 12 additions & 0 deletions crates/proto/src/invocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@ pub fn leading_command(text: &str) -> Option<(&str, &str)> {
Some((name, parts.next().unwrap_or_default().trim()))
}

/// Whether the provider routes this prompt as a native command: its delivered
/// text leads with `/name` (Codex `command_request`, OpenCode commands, Claude
/// slash commands). Anything put in front of it would make it model input.
pub fn native_command(prompt: &str, harness: crate::HarnessId) -> bool {
let delivered = if harness == crate::HarnessId::Codex {
invocation_prompt(prompt)
} else {
harness_prompt(prompt, harness)
};
leading_command(&delivered).is_some()
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
9 changes: 9 additions & 0 deletions crates/ui/src/pickers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,15 @@ impl Pickers {
})
}

/// Whether a queued `prompt` would steer into the running turn: a native
/// command waits for the turn to end instead.
pub(crate) fn steers_prompt_mid_turn(&self, prompt: &str, cx: &App) -> bool {
self.steers_mid_turn(cx)
&& !self
.effective_harness(cx)
.is_some_and(|harness| zeron_proto::invocation::native_command(prompt, harness))
}

/// The fully-resolved config the composer threads into the Run request and
/// `Mutate createChat`: concrete model + reasoning whenever the catalog is
/// loaded (no "engine picks a default" passthrough).
Expand Down
11 changes: 7 additions & 4 deletions crates/ui/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl QueuePrimaryAction {
fn tooltip(self) -> &'static str {
match self {
Self::Steer => "Steer (keep current work running)",
Self::SendNext => "Send at the next turn (this agent cannot steer mid-turn)",
Self::SendNext => "Send when the current turn ends",
Self::SendNow => "Send now (interrupt)",
}
}
Expand Down Expand Up @@ -574,7 +574,9 @@ impl Composer {
interaction_blocked,
host_supports_actions,
!item.attachments.is_empty(),
self.pickers().read(cx).steers_mid_turn(cx),
self.pickers()
.read(cx)
.steers_prompt_mid_turn(&item.text, cx),
);
let primary_action = resolved_primary.unwrap_or(QueuePrimaryAction::SendNow);
let primary_id = item.id.clone();
Expand Down Expand Up @@ -1409,7 +1411,7 @@ impl Composer {
if self.editing_queued.is_some() {
return;
}
let (id, delivery_blocked, host_supports_actions, has_attachments) = {
let (id, text, delivery_blocked, host_supports_actions, has_attachments) = {
let state = self.state.read(cx);
let Some(chat_id) = state.selected_chat.as_deref() else {
return;
Expand All @@ -1419,6 +1421,7 @@ impl Composer {
};
(
item.id.clone(),
item.text.clone(),
item.delivery_gate.is_some(),
state.chat_host_supports(
chat_id,
Expand All @@ -1431,7 +1434,7 @@ impl Composer {
delivery_blocked,
host_supports_actions,
has_attachments,
self.pickers().read(cx).steers_mid_turn(cx),
self.pickers().read(cx).steers_prompt_mid_turn(&text, cx),
) else {
return;
};
Expand Down
5 changes: 5 additions & 0 deletions docs/godspeed/T3-GAPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ These rows say MISSING or PARTIAL but the code has them now: mark unread, settle

| Area | Feature (what the user can do) | T3 evidence | Godspeed status | Value |
|---|---|---|---|---|
| Git | The app's own git commands never start Git's auto maintenance, so a failing `gc --auto` can't strand a full-size `tmp_pack_*` after every fetch | `apps/server/src/vcs/VcsProcess.ts` (`serverGitConfigEnv`, `58aa80dcdf`) | MISSING (no `gc.auto`/`maintenance.auto` override on the engine's `git_program()` spawns) | Med |
| Git | Branch switches are refused while a chat is working in the same shared checkout | `571b8697da` | MISSING (unverified; check the branch picker against a running chat) | Med |
| Agents | Durable workflows: scripted multi-step runs with signals, store keys and questions, on web and mobile | `e414cfd4be`, `69c1d53826` | MISSING (always-on agents and conductors cover part of it) | Low |
| Agents | Agents file problems with the app itself upstream when feedback is turned on (Theo's Cmd+K "triage") | `fe9c98c98f` | MISSING | Low |
| Agents | Child-thread approvals appear in the parent thread with the child's name and Approve / Decline, answerable without switching threads | `apps/web/src/components/chat/ChildThreadApprovals.tsx`; `packages/client-runtime/src/state/threadRequests.ts` (`createChildThreadApprovalsAtom`) (`70f475f511`) | PARTIAL: the lanes card shows a child's Needs approval status and opens it in the right pane (`ui/src/shell/session_lanes.rs`); no inline card in the parent composer | Med |
| Agents | MCP Apps: a Claude tool call that returns an MCP App UI resource renders it inline in the thread | `a21d788752` | MISSING (Godspeed renders `show_visual` Luau visuals, not MCP App resources) | Low |
| Projects | Clone repositories into ghq-style `<host>/<owner>/<repo>` folders (setting) | `packages/shared/src/cloneUrl.ts` (`707dcdaa16`) | MISSING (`project_transfer.rs` clones into a flat folder) | Low |
Expand Down Expand Up @@ -221,6 +225,7 @@ These T3 features were checked and Godspeed has them, so they are not rows above

| Feature | Godspeed PR |
|---|---|
| A slash command promoted during a turn waits for the turn end instead of steering; its queue row offers Send next | #116 |
| Regenerate a chat's title from its whole conversation (chat menu and command palette) | #106 |
| Markdown file previews hide a leading YAML frontmatter block (SKILL.md, agent files) instead of showing it as a rule and a heading; task toggles and line comments keep their offsets | #105 |
| Claude approval, question and MCP form cards close when Claude withdraws the request (a PermissionRequest hook answered it), and the request gets no stale answer | #101 |
Expand Down
12 changes: 11 additions & 1 deletion docs/godspeed/T3-WATCH.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Godspeed always-on agent ("T3 watch") reviews new T3 Code commits and releases
(github.com/pingdotgg/t3code), decides which features are worth having in Godspeed, implements the
best one natively per run, and opens a pull request for review. It never merges.

Reviewed T3 through: pingdotgg/t3code@3e03072eb6 (2026-11-12)
Reviewed T3 through: pingdotgg/t3code@5b643a4913 (2026-11-23)

## Rules

Expand All @@ -23,6 +23,16 @@ Newest first. Status: `PR #n`, `queued` (worth doing, not yet built), `skipped (

| Date | T3 change | Status |
|---|---|---|
| 2026-11-23 | A slash command promoted during a turn waits for the turn end instead of steering, since a provider runs a steered command in place of the turn's task (`c385377544`) | PR #116 |
| 2026-11-23 | Git commands the app runs itself never start Git's auto maintenance (`maintenance.auto=false`, `gc.auto=0`): a failing `gc --auto` reruns after each fetch and strands a full-size `tmp_pack_*` (`58aa80dcdf`) | queued (9 `git_program()` spawn sites in the engine; add the env in one helper) |
| 2026-11-23 | Refuse branch switches while a thread works in the shared checkout (`571b8697da`) | queued (check our branch picker against a running chat in the same folder) |
| 2026-11-23 | Claude turns no longer stall on empty or partial stream usage frames (`66ca7cdbb1`); a Claude turn reads messages added in a terminal (`350b05ac3c`); steer replies written as thinking show (`6ba17d97a1`); wake the agent when Claude exits while awaiting background work (`03920ad8aa`) | queued (check `harness/src/claude` usage parsing and exit path) |
| 2026-11-23 | Limits shows why a provider's usage is unavailable (`ba4f99ae43`, `9c25b71395`) | queued (our usage rows go blank on a probe error) |
| 2026-11-23 | Agents file T3 problems when feedback is on (`fe9c98c98f`) | skipped (needs an upstream tracker; noted in T3-GAPS with Theo's triage idea) |
| 2026-11-23 | Durable workflows on server, web and mobile (`e414cfd4be`, `69c1d53826`) | skipped (large; overlaps always-on agents and conductors, added to T3-GAPS) |
| 2026-11-23 | ACP handshake bound (`2f19cec079`), queued message on the thread's current pick (`08804b2170`), commands verbatim with pending context (`ecdd8e2c21`), image uploads before send (`3b3f8808f4`), Queue for sessions that can't steer (`c3a330d834`) | skipped (Godspeed already does these) |
| 2026-11-23 | Sidebar rows show the environment instead of the branch (`cd3a57ac72`), sidebar folder button picks a project (`dbb5bdb582`), multiple Linear accounts, outside-agent MCP events, server metrics scripts | skipped (design choice, covered by #96, no Linear integration, T3-internal) |
| 2026-11-23 | ~300 minor fixes: git status perf, Office/RTF/ODT previews and attachments, Antigravity/Cursor/Pi/OpenCode, Windows, mobile, i18n, relay, issues, CI | skipped (internal/minor) |
| 2026-11-12 | Regenerate a thread's title from the thread menu, now also from a bindable shortcut; the regenerate prompt reads the whole conversation and the previous title (`cfb7cae2b9`, `ThreadTitleRegenerationService`) | PR #106 |
| 2026-11-12 | Reply to an assistant response from its hover actions, quoting it into the composer (`c0f85e7f79`); a quote in a sent message shows as an inset card (`1a8ecc64b7`) | queued (we quote a text selection with Ask; no whole-response Reply, and sent quotes render as plain blockquotes) |
| 2026-11-12 | A steer that cuts off a streaming Claude reply marks it interrupted (`c7618f6c10`); final replies stay visible after steering (`836b86a5d6`); a model change sent with a Claude steer applies to the running turn (`5984bbb36e`) | queued (check `harness/src/claude` steer path) |
Expand Down
Loading