Skip to content

Fix/agy cesar tooling and codeblock render#175

Merged
cukas merged 4 commits into
mainfrom
fix/agy-cesar-tooling-and-codeblock-render
Jun 8, 2026
Merged

Fix/agy cesar tooling and codeblock render#175
cukas merged 4 commits into
mainfrom
fix/agy-cesar-tooling-and-codeblock-render

Conversation

@cukas

@cukas cukas commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

cukas and others added 4 commits June 8, 2026 10:42
Two unrelated Cesar/TUI bugs surfaced from a real session:

1. agy could not use tools as acting-Cesar. When the configured Cesar
   returns empty, agon falls back to acting-Cesar dispatched in 'exec'
   mode. The adapter injects an agy-specific OUTPUT RULES block
   (engine.id === 'agy' && mode !== 'agent') that forbids file edits /
   tool use and forces a single-pass text answer — so agy refused every
   tool and confabulated a "system harness" excuse. Acting-Cesar (and the
   brain recovery path) are agentic leading roles, so dispatch them in
   'agent' mode when the engine supports it (agy's agent and exec modes
   are the same agentic CLI), falling back to 'exec' otherwise. Matches
   the injection's own intent ("agent mode is left agentic on purpose").

2. CodeBlockView rendered every line wrapped with stray border pipes on
   blank rows. The width math was inconsistent: the box was sized to the
   longest line while code rows padded to the terminal width, so each row
   overflowed the box and Ink wrapped it. Rewrote all rows (border,
   header, code, overflow) around one coherent inner `body` width so each
   row is exactly rowWidth; over-long lines truncate instead of wrapping.

Compile + build clean; 221/221 cesar/adapter/render tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`agon review branch:NAME` runs `git diff NAME...HEAD`, which reviews HEAD's
changes relative to NAME as the base — correct when NAME is the base branch
(e.g. branch:main). But when NAME resolves to the same commit as HEAD (the
common footgun of targeting the branch you're currently on), it's an empty
self-diff that surfaced as a silent "No changes to review." A caller — or
Cesar — could mistake that for a clean review and confabulate success.

Now resolveReviewTarget compares the rev-parsed SHAs of NAME and HEAD and
throws an actionable error pointing at the right targets (branch:main for the
branch's commits, uncommitted for working-tree changes) before any engine is
dispatched.

review tests: 58/58 pass. Verified: `agon review branch:<current>` now errors
loudly pre-dispatch instead of returning empty.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…" lies

Weak coding-plan engines as Cesar narrate that they dispatched or are running
an async review/forge/agent job ("three reviewers are reading the diff in
parallel", "I kicked off the review", "I'll report when they land") without
ever calling the tool. Cesar's turn has no jobManager access, but it has a
grounded turn-local signal: ctx.cesar.pendingDelegation is set only when a
handoff tool (Review/Forge/Agent/…) is actually emitted this turn. So a
dispatch/running claim + a null pendingDelegation = a fabricated delegation.

Adds detectFabricatedDelegation(text) (requires BOTH a delegable target AND a
dispatch/running claim, so a plain answer mentioning "review" doesn't trip it)
and a guard in brain.kern after the plan-mode nudge: when it fires and nothing
is pending or running, re-prompt once with a [SYSTEM] grounding message — call
the real tool now, or tell the user plainly nothing is running. Mirrors the
existing plan-mode / final-answer nudges; soft (re-prompt, never blocks).

Pairs with the branch:X review fix: that turns a silent "No changes" into a
loud error, so Cesar can't mistake a no-op review for a successful one.

Tests: detectFabricatedDelegation covered with the real transcript phrases +
negatives; 198/198 cesar/brain/pty/adapter tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rings the terminal bell and flips the window title when a turn finishes or
when Cesar needs the user (a question or a plan awaiting approval), so a
backgrounded terminal surfaces a bell + title dot. Originally built by Cesar
(minimax-coding-plan-m3); this completes and corrects it.

- New packages/cli/src/kern/lib/terminal-notify.kern: bell() (BEL once) and
  setWindowTitle(label) (OSC 0 ; label BEL). Both no-op when stdout isn't a TTY
  (piped/CI) and honour AGON_NO_BELL / AGON_NO_TITLE opt-outs.
- Wired into app.kern: bell on await (question / plan-approval, deduped per
  plan id) and on done, with a single-shot pendingBellRef guard; title shows
  "● agon — running" / "● agon — input needed" / "agon".

Fixes in the wiring (the part Cesar left broken — its plan's wire step failed
verify):
- The done-bell only fired on two edge paths (status dashboard / empty
  mode-switch) because the MAIN turn-completion path ended via a direct
  setReplState, bypassing transition()'s bell hook. Route it through
  transition(finishReplState) so every completed turn rings (no-op for job
  turns that already went idle at handoff).
- Background jobs (forge/review/etc.) now ring + reset the title when they
  complete or fail — the "alert me when the long job is done" case.

Adds tests/unit/terminal-notify.test.ts (the unit step Cesar's plan never
reached): BEL-once / opt-out / non-TTY for bell, OSC sequence / opt-out /
non-TTY for setWindowTitle. Full suite green: 1994/1994.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cukas cukas merged commit 7c5eb57 into main Jun 8, 2026
2 checks passed
@cukas cukas deleted the fix/agy-cesar-tooling-and-codeblock-render branch June 8, 2026 09:35
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.

1 participant