Repository navigation
Conversation
…s Protocol Every native PTY agent without a managed session or Antigravity hook read as "waiting / pty_running_state_unknown", because CCCC deliberately never infers idle from terminal output. Claude Code, Codex and Antigravity now report their own state in-band with OSC 7501 (Claude Code and Antigravity only after the terminal answers the capability query), so CCCC can show real working, idle and blocked state without guessing. - runtime: a focused program_status module ports the wire grammar (Orca, MIT): key=value bodies, BEL or ST, base64 msg/title, the 4096-byte cap, child records ignored for the root, and OSC 133;A / ESC c / state=clear ending the record. The output reader parses reports in the same pass as terminal queries, the query responder answers ESC]7501;? with the exact supported states and kinds, and the record is kept per launch (cleared when its output ends) under its own lock so status reads never wait on transcript I/O. - session owner: a new terminal_read kind program_status carries the record from the owner process to the daemon; an older owner rejects it and the Actor simply has no program status. - daemon: a runtime-agnostic agent_status module defines one normalized status (state, reason, source, updated_at, blocked kind, message, progress) with one provider per source (managed session, Antigravity hook, OSC 7501, Dots) and resolves precedence in one place: managed > hook > program status > fallbacks. working_state and the Mail notice gates are thin consumers. Projections add effective_status_source, effective_blocked_kind, effective_status_message and effective_progress; existing keys keep their meaning. An idle, done or error report admits early Mail notices like an idle hook; working and blocked do not, and the pre-submission recheck reads the exact launch. - web: trusts any structured source over terminal heuristics, shows a blocked agent as needing input with its kind and message, and rings it for attention, all from the normalized fields only. - docs: the IPC standard documents the normalized model, precedence and the OSC 7501 contract; the runtime guide explains it for users.
ChesterRa
added a commit
that referenced
this pull request
Dec 1, 2026
Observe root OSC 7501 reports from the current PTY when managed session or hook state is unavailable. Name the terminal as the source and show the reported wait reason when known. Keep reports scoped to the PTY across daemon reattachment. Group state and Mail use the established working-state rules. Free-form terminal text stays in the transcript. Based on the terminal status proposal in #244. Verified workspace formatting and Clippy, 26 isolated Rust tests, 5,635 Web tests, and 138 pytest tests. Verified the sign-in wait with Antigravity CLI 1.5.20 on Linux in an offline browser smoke test and exercised other transitions with a PTY fixture. Co-authored-by: waterbang <hsb@truesightai.com>
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.
What
Every agent running in a native PTY currently reports
effective_working_state="waiting"witheffective_working_reason="pty_running_state_unknown", because CCCC deliberately never guesses idle from terminal output. Several CLIs now report their own state in-band through the OSC 7501 Program Status Protocol. Measured with the real CLIs in a PTY:ESC]7501;?query and reports only after the terminal answers:idle,workingon a prompt,doneat turn end.idle/working/donewithout a query.blocked:kind=auth"Sign in required" andblocked:kind=permission"Trust this folder?".This PR makes CCCC a terminal that speaks the protocol and turns those reports into agent state, behind a runtime-agnostic model.
Runtime (
crates/cccc-runtime)program_status.rs: the wire grammar (BEL/ST terminators, base64msg/title, 4096-byte cap, malformed reports discarded, childidrecords ignored for the root), a scanner that survives sequences split across reads, and the latest root record per PTY launch.OSC 133;A,ESC cand the end of the launch's output clear it.terminal_query_responder.rsanswers the query withESC]7501;?:states=idle,working,done,blocked,error:kinds=permission,question,auth ESC\, within the existing per-read response and OSC length limits.cccc_runtime::program_status(group, actor)likelast_output. The session owner serves it through a newTerminalRead::ProgramStatus; an older owner rejects the read and the actor simply has no program status.Daemon: one normalized status model (
crates/cccc-daemon/src/ops/agent_status/)program_status> configured-managed pending > Dots > headless/PTY fallbacks.managed.rs,antigravity_hook.rs,program_status.rs,dots.rs). Only providers know which runtime speaks which protocol; nothing above the resolver branches on the runtime.working_state.rsbecomes a thin consumer.ready_for_mail_noticeand the pre-submission rechecks use the resolver, matched to the exact launch (pid and start time):idle/done/erroradmit early Mail notices,blockedandworkingdo not.effective_status_source,effective_blocked_kind,effective_status_message,effective_progress; existing keys keep their meaning.Web: decisions come only from the normalized fields. A structured source overrides terminal heuristics;
blockedshows as needing input with its kind and message and rings for attention. The store only merges the new fields when a payload carries them.Docs: the IPC standard documents the model, precedence, the OSC 7501 contract and the Mail-notice rule;
docs/guide/runtimes.mdexplains it for users and now says new Antigravity PTYs get their idle state from OSC 7501 instead of ordinary Mail timing.Verification
OutputReader.effective_working_reason="program_status"and early-Mail gating;session_owner::program_status_testsruns a real owner child process, asserts the in-process registry has no such session, and checks Mail is withheld while blocked and delivered once idle. Existingworking_statetests pass unchanged.scripts/quality_gate.sh faston this branch passes (clippy, workspace, runtime, daemon nextest, doc and Web checks); the touched Web test files pass on this base (2378 tests).blocked/permission/ "Trust this folder?" in a new folder, andidle → working → idlewithsource=program_statusaround a one-line prompt in a trusted folder, with no hooks installed.