Repository navigation
feat(coding-agent): highlight heredocs and inline scripts in shell calls - #2
ivanmilevtues wants to merge 3 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
CodeBoarding reviewStatus: 4 changed components See the full change in CodeBoarding. graph LR
n_Coding_Agent_Application["Coding Agent Application"]
n_AI_Provider_Runtime["AI Provider Runtime"]
n_Durable_State_Codemode_Runtime["Durable State #38; Codemode Runtime"]
n_Workspace_Automation_Scripts["Workspace Automation Scripts"]
n_Terminal_UI_Toolkit["Terminal UI Toolkit"]
n_Agent_Evaluation_Harness["Agent Evaluation Harness"]
n_MCP_Protocol_Client["MCP Protocol Client"]
n_Agent_Core_Loop["Agent Core Loop"]
n_Telemetry_Instrumentation["Telemetry Instrumentation"]
n_Coding_Agent_Application -- "queries models and provider credentials" --> n_AI_Provider_Runtime
n_Coding_Agent_Application -- "renders terminal UI views and layouts using" --> n_Terminal_UI_Toolkit
n_Coding_Agent_Application -- "instantiates and drives agent execution loop" --> n_Agent_Core_Loop
n_Coding_Agent_Application -- "executes scripts in codemode sandboxes" --> n_Durable_State_Codemode_Runtime
n_Coding_Agent_Application -- "manages MCP authentication and transports" --> n_MCP_Protocol_Client
n_AI_Provider_Runtime -- "prompts interactive login flow" --> n_Coding_Agent_Application
n_Durable_State_Codemode_Runtime -- "delegates execution callbacks to agent runtime" --> n_Coding_Agent_Application
n_Durable_State_Codemode_Runtime -- "queries available model catalog" --> n_AI_Provider_Runtime
n_Workspace_Automation_Scripts -- "hydrates model catalog definitions" --> n_AI_Provider_Runtime
n_Workspace_Automation_Scripts -- "loads session and auth configurations" --> n_Coding_Agent_Application
n_Workspace_Automation_Scripts -- "persists state in durable documents" --> n_Durable_State_Codemode_Runtime
n_Terminal_UI_Toolkit -- "dispatches layout and input events to views" --> n_Coding_Agent_Application
n_Agent_Evaluation_Harness -- "benchmarks model runtimes" --> n_Coding_Agent_Application
n_Agent_Evaluation_Harness -- "tests provider model interfaces" --> n_AI_Provider_Runtime
n_Agent_Evaluation_Harness -- "verifies agent state in UI evaluations" --> n_Agent_Core_Loop
n_MCP_Protocol_Client -- "persists tokens via agent credential store" --> n_Coding_Agent_Application
n_Agent_Core_Loop -- "dispatches events to message stream" --> n_AI_Provider_Runtime
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
class n_Coding_Agent_Application modified;
linkStyle 1 stroke:#7d4e00,stroke-width:2px;
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d537fb8ae3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? await failToolCallsFromTruncatedMessage(toolCalls, emit) | ||
| : await executeToolCalls(currentContext, message, config, signal, emit); | ||
| toolResults.push(...executedToolBatch.messages); | ||
| for (const result of executedToolBatch.messages) recordToolCall(result.toolName, result.isError); |
There was a problem hiding this comment.
Count calls made through runToolCall
When a tool invokes another tool through the exported runToolCall() pipeline, the nested call never reaches this block, so only the outer tool is counted. This occurs in packages/coding-agent/src/core/agent-session.ts, where nested tool calls delegate directly to runToolCall(); for example, a codemode call that invokes read twice records one codemode call and zero read calls or failures. Record outcomes in the common runToolCall/finalization path, while avoiding double-counting model-issued calls.
Useful? React with 👍 / 👎.
| errors: number; | ||
| } | ||
|
|
||
| const stats = new Map<string, ToolCallStat>(); |
There was a problem hiding this comment.
Isolate counters per agent session
When multiple Agent instances run in the same Node process, this singleton map merges their calls even though agent state and sessionId are instance-specific. A session reading getToolCallStats() therefore reports tools and failures from unrelated sessions, and calling resetToolCallStats() for one session erases the other sessions' totals, including concurrent runs. Store the counters on the agent/run or key the read, record, and reset APIs by session.
Useful? React with 👍 / 👎.
|
/codeboarding Refresh the architecture diff for the Amp community showcase using the migrated workflow. This comment is AI-generated by Amp. |
CodeBoarding review · failedThe LLM provider's token or credit quota is exhausted. Add credits or raise the quota, then re-run. See the workflow logs. |
Adapt upstream earendil-works#10021 to the current renderers for the CodeBoarding architecture demo. Co-authored-by: Armin Ronacher <armin.ronacher@active-4.com>
Shell calls can contain Python, JavaScript, Rust, and other languages inside heredocs or inline scripts. This change identifies those sections and highlights them in their own language, with long bodies collapsed until expanded.
The new shell parser feeds the Bash renderer. Bash and Write share an incremental highlighting cache, and changing the theme invalidates the cached styling. PowerShell keeps its existing display behavior.
Adapted from earendil-works/pi#10021 by Armin Ronacher to the current renderer and tool-timing APIs. This is a CodeBoarding demonstration PR and is not intended to merge.
Useful paths to explore in the architecture diff:
Validation:
npm run checkpasses; all 54 tests across shell parsing, streaming highlighting, and tool rendering pass. The branch includes the current main baseline and licensed CodeBoarding workflow.The licensed CodeBoarding review passed: 8 analyzed source files changed, affecting 4 components and 3 detailed connections. The top-level diagram highlights one connection. Expand Coding Agent Application to explore the new parser under System Utilities and the tool-rendering/theme relationships; the parser does not create a separate graph component at this analysis depth.