Repository navigation
feat(agent): redesign AX prompts, universal maka:// Read, and human-symmetric Session* tools - #6958
Conversation
…ymmetric Session* tools Unify maka://session/<id> and cross-session tool-result URIs into Read, replace the 17 raw RPC-mirror Session* tools exposed to agents with 7 human-symmetric Session* tools (SessionList, SessionRead, SessionCreate, SessionSend, SessionRespond, SessionStop, SessionManage), align native and external executor prompt/reference preparation, inline worker completion summaries, and clean up Code Mode declarations and deferred tool discovery. Generated-by: Maka (Antigravity / Gemini)
Astro-Han
left a comment
There was a problem hiding this comment.
I found two P2 regression-test integration issues at 4ebf4f5cdd144b9445cf1a38a9220ec2d24f0a55. These findings concern the existing tests left inconsistent with this PR's intentional contract changes; they are not claims that the larger page limit, reference guidance or readable diagnostics should be reverted.
- The captured-directory test no longer creates a continuation. Raising
MAX_PAGE_CHARSfrom 7,500 to 24,000 makes its unchanged 20,000-character file fit in one response. The test then passesnext: nullback to Read and fails before exercising continuation after directory replacement. Original root job 133515490753 reportsinvalid type: null, expected struct ReadInputatplugins/workspace/workspace-files/engine/tests/read.rs:243. - Two native desktop tests still assert the old prepared-message and error contracts. Original Windows job 133493132177 reaches both assertions: the conversation-reference test at line 1162 sees the newly appended
<session_references>block, while the Session tool presentation test at line 1983 receives the new readable unavailable-session diagnostic but still searches foragent_session_unavailable. Both tests passed in the current target's Windows job 133425832964. Update their expectations to the new contracts while preserving the assertions about the original message, reference identity and displayed tool result.
The failing PR jobs checked merge commit 8a3e476fb86892f1ad3e4e4a69f0dad777f291c0. I fetched that commit and verified that the five relevant production/test files match the PR head byte for byte; the filesystem regression fixture is also unchanged from the target. I inspected the public diff and the corresponding source paths. I did not run these tests locally.
This is a scoped CI follow-up, not a complete review of the 55-file AX redesign. The other Windows Markdown failure and the Harbor JSON decoding failures need separate attribution; I have not attributed them to this PR.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
|
|
||
| pub const MAX_PAGE_CHARS: usize = 7_500; | ||
| pub const DESCRIPTION: &str = "Read a file or a Maka resource using path. Resource shortcuts: task:<id>, attachment:<id>, archive:<event-id>. Prefer short prefixes: retain any fixed ID prefix (such as attachment-) and keep the next 12 ID characters, e.g. task:fd427bd7-8a6 or attachment:attachment-8ac3b2615d42. Prefixes must be unique within this Session; exact IDs take precedence and ambiguous prefixes require more characters. Files require their actual paths. PNG, JPEG, GIF and WebP files return images. Text returns one bounded page; offset is a zero-based starting line and limit is a positive line count. A large limit cannot bypass the response-size cap. If next is non-null, pass that complete object unchanged to Read to continue the requested range. partialLine means a line spans pages. Continuations reject changed content; restart with the original path."; | ||
| pub const MAX_PAGE_CHARS: usize = 24_000; |
There was a problem hiding this comment.
[P2] Keep the captured-directory fixture larger than one Read page
The existing captured_directory_survives_replacement_and_denies_escape_and_special_files regression uses 20,000 ASCII characters. After this increase it gets next: null, so read(&executor, inside_cursor) at engine/tests/read.rs:243 fails with invalid type: null, expected struct ReadInput in job 133515490753. Its outside-cursor rejection also stops exercising a real cursor. Size the fixture relative to the new bound and assert that both cursors exist before continuing, so CI and the directory-replacement coverage remain meaningful.
| pub(crate) fn humanize_agent_error(err: String) -> String { | ||
| match err.as_str() { | ||
| "agent_session_unavailable" => { | ||
| "Session or Room was not found or is archived; check the ID with SessionList".into() |
There was a problem hiding this comment.
[P2] Adapt the existing native desktop assertions to the new AX contracts
This readable diagnostic replaces the literal agent_session_unavailable that desktop_presents_session_tools_in_chat_and_trajectory still requires at desktop_new_session.rs:1983. The same Windows job (133493132177) also fails desktop_composer_references_a_conversation_without_waking_it at line 1162 because preparation now appends <session_references> to its previously exact raw-text expectation. Both tests pass on the target's job 133425832964. Update these existing regressions alongside the production contract changes rather than leaving the native suite red.
…lls, and archived results Keep Goal tool visibility static across turns, append external executor skill instructions to the turn message tail instead of mutating request.instructions, and retain MAX_PAGE_CHARS = 7_500 for automatic tool-result pruning. Generated-by: Maka (Antigravity / Gemini)
Astro-Han
left a comment
There was a problem hiding this comment.
The paging regression from my previous review is fixed at e6c7d1365532b02bf9a11163608b7dbb7880275e. MAX_PAGE_CHARS is back to 7,500, so the unchanged 20,000-character captured-directory fixture requires continuation again. The original root test job 133728202236 explicitly reports captured_directory_survives_replacement_and_denies_escape_and_special_files passing (106 tests passed in that slice). I withdraw that finding for this head.
The P2 native-test expectation finding remains. The prepared-message renderer, readable unavailable-session diagnostic, and both corresponding assertions are byte-for-byte unchanged from 4ebf4f5cdd144b9445cf1a38a9220ec2d24f0a55:
products/maka/terminal-shell/tests/real_host/desktop_new_session.rs:1162still compares the full prepared user message to the original composer text, despite the appended<session_references>block.- The assertion at line 1983 still searches for
agent_session_unavailable, whilehumanize_agent_errorreturns the readable diagnostic.
The previous Windows failure and macOS failure both reached these assertions. This is carry-forward based on unchanged production and test code, not a claim that I reran the native tests on the new head. Please update these expectations while preserving the checks of original message/reference identity and displayed tool results.
I reviewed the five-file follow-up: the page-cap restoration, static Goal-tool visibility, synchronous catalog call sites, the removed dynamic-visibility assertion, and moving external per-turn skill guidance from request.instructions to the message tail. I fetched the current CI merge 66edbf66c2978dac0370cfea06dbf5c9497897ed and verified that eight relevant source/test files match this raw head. The current run also has two Harbor failures (invalid type: map, expected f64); I have not attributed those to this change. Other checks are still running.
This is a scoped follow-up, not a complete review of the current 54-file redesign. I did not run Rust or native desktop tests locally, or verify real external-executor cache reuse and restart behavior.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
…uation, and CI - Type-check Computed SQL replies for SessionCreate, forkFrom, and SessionStop instead of dropping closures via NativeMutation::map; reject conflicting forkFrom options explicitly. - Pin through watermarks on maka://session/<id> Read continuations and scope cross-session imported tool-result URIs to the target session with caller work custody. - Retain Role::Failure, Compaction, and requested Thinking chunks in SessionRead/Read, expose SessionRunOverview.error, fall back to session_history for external/failed <worker_result> snippets, and fix SessionList exclusive cursor pagination. - Fix Workbench sessionManage/sessionRead activity cards, nested bracket parsing in extract_session_references, external executor skill metadata placement, and workspace serde_json arbitrary_precision deserialization in maka-eval. Generated-by: Maka (Antigravity / Gemini)
…-up turns - Inherit the session's most recent Run skill metadata prompt in DriverExecutor when background wake-up turns (SessionCompletion, ScheduledTask, Goal) have empty input preparation, preventing instructions_digest ping-pong and redundant system-instruction re-injection. - Extract the final Assistant message (grouped by message_id/position) for external-executor <worker_result> snippets so earlier transition chatter does not truncate the conclusion. - Normalize multiline string literals in render_session_markdown and close the cross-session tool-result Read assertion in ax_session_tools. Generated-by: Maka (Antigravity / Gemini)
Astro-Han
left a comment
There was a problem hiding this comment.
The conversation-reference assertion is corrected at db7ff00c18cd3a22dc316c0dc3e7814476d316e3: desktop_new_session.rs:1162–1167 now accepts the original text followed by <session_references>. Applying those string checks to the captured failing message from the previous Windows job passes, whereas the previous equality check fails. This is a replay of the captured string assertion, not a native desktop rerun. I withdraw that part of the finding.
P2: the unavailable-session expectation remains at products/maka/terminal-shell/tests/real_host/desktop_new_session.rs:1989. desktop_presents_session_tools_in_chat_and_trajectory still searches the next model request for agent_session_unavailable. That complete test function and humanize_agent_error are unchanged from the previous head. The current session_send_tool still maps the error through humanize_agent_error, producing Session or Room was not found or is archived; check the ID with SessionList. The previous Windows job reaches this assertion and fails. Please update this remaining expectation while retaining the checks of the displayed tool result. This carry-forward is based on the unchanged fixture and error conversion; I have not run this test at the new head.
I inspected the relevant native-test changes, the current send/error path, and the paging/guest-decoder follow-up diff. The rewrite also changes Session tool behavior, external-executor wake-up skill handling, archived-result access, and UI presentation; those changes require separate verification. This is not a complete review of the current 60-file PR. I did not run Rust, native UI tests, real external-executor cache/restart checks, or Harbor locally. Current CI is still pending.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
…ized Session tool error - Update desktop_presents_session_tools_in_chat_and_trajectory to expect the humanized SessionSend diagnostic returned to the model while keeping UI trajectory checks intact. - Map the humanized unavailable-session diagnostic alongside agent_session_unavailable in toolActivityPresentation so Workbench cards continue localizing Conversation is unavailable. Generated-by: Maka (Antigravity / Gemini)
Astro-Han
left a comment
There was a problem hiding this comment.
The remaining native-test expectation from my previous review is corrected at 49bad6380a743d3babb9e54b460d2aa41273d83c. desktop_presents_session_tools_in_chat_and_trajectory now checks the readable Session/Room diagnostic that SessionSend actually returns, while retaining the trajectory/display checks. The previous failing Windows request contains that diagnostic and fails the old error-code check; the updated string check accepts it. I withdraw that specific P2 finding.
The three-file follow-up also maps both the legacy error code and the readable diagnostic to the existing localized “Conversation is unavailable” message in toolActivityPresentation.ts, including failed-result envelopes. I exercised the actual activityFailure and activityProjection functions, with their production record/script-reply helpers and controlled translation/presentation adapters: 12 checks pass on this head; five fail against the previous implementation. These are function-level checks and a replay of a captured request, not native UI test runs or validation of all translations.
The PR is now merged as b9bc647e347ccce0b1ad35da1cd16923fad3a9e1; all 61 changed source paths match the final raw head. This update closes the reported expectation mismatch, not the complete AX redesign review. I did not run Rust or native desktop tests locally, or verify real external-executor cache/restart behavior. CI is still pending, and the landing's delegated-Harbor test reports a separate stepsObserved mismatch (3 versus 2); I have not attributed that failure to a specific change.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
#6970 added the required `incognito` field to `Create`, while #6958 added a `Create` literal for the SessionCreate tool without it, so rust-preview stopped compiling. The tool does not let the model opt in; `creation_policy` still makes a child incognito when its caller is. Generated-by: Claude Code
Run scheduled investigations in fresh worker Sessions under the Bot, defaulting new plans to read-only and previewing standard Session tool grants within the parent ceiling. Share investigation records, notification decisions, and quoted user feedback across turns through DiscoveryMemory and #6958 Session readers, persist draft quotes with escaped shared rendering, and add desktop plan management. Refs #6716. Generated-by: OpenAI Codex
Summary
Redesigns Maka's Agent Experience (AX) end-to-end across system prompts, cross-executor input preparation, universal
maka://resource reading, Code Mode tool declarations/discovery, and theSession*tool suite so agents interact with conversations and Rooms as naturally as humans do—while keeping prompt prefixes invariant across steps and turns.Key changes:
Readformaka://session/<id>& cross-session tool results:Readnow natively resolvesmaka://session/<id>(andsession:<id>) into a clean Markdown digest of Room posts or Agent conversation turns (withresultPathlinks tomaka://session/<id>/tool-results/<event-id>for lossless tool-output inspection), fixes theTextPageScannewline snap-back bug when a short header precedes a large single-line payload (retainingMAX_PAGE_CHARS = 7_500so automatic tool-result pruning never bloats history context), and returns actionable URI diagnostics (e.g. pointinghttp(s)://toWebFetch).<session_references>&MessageOriginguidance: Inline[#Room](maka://session/<id>)and[@Session](maka://session/<id>)links deterministically attach<session_references>pointing directly toRead({"path":"maka://session/<id>"}), andMessageOrigin::prompt_headerprovides localized (en/zh-CN/zh-TW) guidance forRoom,Session,Automation, andGoalorigins.Session*tool suite (17 -> 7 tools): Replaces the 17 low-level RPC-mirrorSession*bindings exposed to agents with 7 human-symmetric tools while keeping all underlying UI/Eval RPCs intact:SessionList: unified search/filtering withscope="children"defaultingparentSessionIdto the caller.SessionRead: 7-in-1 inspection (metadata, active/latest Run & blockers, live output preview, inlineInteractionRecords, queued messages, and turn digest / raw / Room transcript with self-contained opaque cursors; omitssessionIdto self-inspect).SessionCreate: unifies creation andforkFrom, defaultsworkspaceto"same", supports 1-word"worktree", and inherits the caller's active backend whenbackendandpresetIdare omitted.SessionSend: defaultsonCompleteto"notify_caller"for Agent callers and wakes the caller with an inline<worker_result>summary upon completion.SessionRespond: answers worker questions and permission escalations.SessionStop: optionalrunId(stops whichever Run is active by default).SessionManage: unifiesupdate,archive,restore,remove,edit_queue, andcontinue_runwith automatic revision resolution whenexpectedRevisionis omitted.skills::promptinstructions appended to the turn's message tail (preservinginstructions_digestand thread prefix cache), renderedquotes,directory_references,<session_references>, MCP serverinstructions, and updated Antigravity profile orientation.maka_assistant::prompt(net ~125 tokens shorter after removing the hardcoded 200-word preset paragraph), static deferred-tool inventory inexec.description, compactALL_TOOLSentries without redundantdeclare const toolswrappers or& (string)intersections, explicitRead/ShellTypeScript return shapes,nodeRepl.write/emitImageguidance oncua_repl, and removal of leaked"operation receipt"Host jargon across tool descriptions.Verification
node scripts/ci.mjs check format— passednode scripts/ci.mjs check licenses&node scripts/ci.mjs check notices— passed (all 2,548 covered files verified)node scripts/ci.mjs run contracts— passed (5 runtime SDK declaration files regenerated & verified;plugin-sdk,bundle, andmaka-workbenchUI types clean)node scripts/ci.mjs check tooling-tests&node scripts/ci.mjs run product— passedcargo nextest run -p maka-tools --lib— 5/5 passed (including newdeclarationsand deferredexecinventory tests)cargo nextest run -p maka-agent-facts -p maka-assistant -p maka-agent-engine -p maka-files-native --lib— 60/60 passed (including newmaka://session/URI diagnostics and newline snap-back regression tests)cargo nextest run -p maka-agent-native --libtargeted suites (preset_acceptance,ax_session_tools,attachments,recall,title,parallel_tool_results,completion) — 26/26 passed (including new end-to-enduniversal_read_and_human_symmetric_session_tools_coordinate_rooms_and_workersand externalrender_message_texttests)cargo check -p maka-eval --tests && cargo check -p maka-cli --tests && cargo check -p maka-terminal-shell --tests— passed; full live GUI/CLI desktop E2E suites (just test-desktop) were not run locally.AI use
Select exactly one:
Tool(s) and scope: Maka (Antigravity / Gemini) — audited AX issues across prompts/tools/executors and implemented the prompt,
Read, Code Mode declaration, external executor parity, andSession*tool redesign and tests.Checklist
Does this PR entail a change in behavior?