feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

feat(cli): expose one-shot Cloud Session activation protocol - #1587

Merged
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation
Aug 1, 2026
Merged

feat(cli): expose one-shot Cloud Session activation protocol#1587
Astro-Han merged 2 commits into
apache:mainfrom
Nyvo-io:feat/1554-cloud-activation

Conversation

@Nyvo-io

Copy link
Copy Markdown
Contributor

Closes#1554

Summary

  • add strict maka activate JSONL entry point with versioned request/output contracts
  • require explicit non-overlapping state, workspace, and config roots
  • support new/resumed sessions, safe-boundary continuation, bounded redacted runtime events, deterministic outcomes, timeout, and clean shutdown
  • keep existing maka run text output unchanged

Scope

Session Bundle, CAS/SessionRepository, sandbox lifecycle, activation leases/deduplication, cross-activation approval workflow, and Cloud Session fork remain out of scope.

Verification

  • npm --workspace maka-agent run build
  • node --test packages/cli/dist/__tests__/activation-command.test.js
  • npm --workspace maka-agent run test:dist (661 passed)
  • npm --workspace maka-agent run typecheck (CLI/dependencies pass; existing desktop preload @maka/ui dist artifact is unavailable in this worktree)

@Astro-Han

Copy link
Copy Markdown
Contributor

Checked at f42a5a2.

P1: root overlap is checked in one direction only

pathsOverlap(left, right) checks whether right is inside left, but not the reverse. With the fixed state, workspace, config ordering, this permits layouts such as:

  • state inside the agent workspace;
  • workspace inside the credential/config root.

The root check needs symmetric containment for each pair, preferably through the existing root-layout implementation.

Code: packages/cli/src/activation-command.ts:655

P1: resumed activation writes non-JSON data to the JSONL stream

Existing-session activation calls the continuation planner. Its lifecycle callback uses:

console.info("[runtime-resume]", ...)

console.info writes to stdout, which is also the activation protocol stream. A line-oriented client receives JSON, then a [runtime-resume] line, then JSON. Parsing fails on every real resumed activation.

Code: packages/cli/src/runtime-bootstrap.ts:768

P2:

  • Malformed input exits without the protocol's terminal fatal_failure outcome.
  • Existing auth, tool_failed, and similar states are emitted with requiredAction: "grant_permission", which is the wrong recovery action and falls outside the public blocked-reason model.

@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed all review points in commit 66b371e:\n\n- root containment validation is symmetric for every state/workspace/config pair;\n- activation resume diagnostics use stderr, keeping stdout valid JSONL;\n- malformed input now emits a terminal fatal_failure outcome;\n- non-permission blocked sessions (auth/tool_failed/etc.) now return retryable_failure with retry_activation instead of grant_permission.\n\nAdded regression coverage for each case. Verification: CLI typecheck passes, format check passes, and the focused activation/runtime-bootstrap suite passes all 33 tests.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 66b371e. The previous findings are fixed: root overlap is checked both ways, activation resume diagnostics stay on stderr, malformed JSON emits a terminal fatal_failure, and non-permission blocked sessions return retryable_failure with retry_activation. The focused CLI tests pass, 33/33. No remaining findings.

The branch still conflicts with current main in runtime-bootstrap.test.ts, so it needs a rebase before merge.

@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 66b371e to 0f9a38aCompareJuly 30, 2026 06:28
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Rebased onto the latest main at 0f9a38a; the branch is now mergeable. During the final review I also made root-layout rejection side-effect-free, so unsafe state/workspace/config layouts are rejected before any missing directory is created, with a regression test covering that contract. Verification on the rebased branch: CLI typecheck and build pass, formatting and git diff checks pass, focused activation/runtime-bootstrap tests pass 35/35, full CLI tests pass 689/689, and CI typecheck/test/e2e all pass.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rechecked 0f9a38ad. The previous four findings remain fixed, and the root-layout validation now rejects unsafe layouts before creating directories.

One P1 remains. The activation command handles sandbox_boundary_request, but the actual activation surface cannot create that event. buildCliRuntime exposes the boundary tool and its create/settle callbacks only to the TUI.

Under activation's default explore managed boundary, a real Write produces a sandbox_boundary_required tool result instead. Activation does not inspect that failure, so the run can finish as completed if the model responds after the failed write, or fall back to a generic retryable_failure. It cannot produce the deterministic in-flight blocked outcome promised by the protocol.

The current blocked test injects sandbox_boundary_request through a fake runtime, so it does not cover the production wiring. Cross-activation approval can stay out of scope, but the unhandled sandbox failure still needs to map to blocked, or the request path needs to be wired and immediately denied.

Expose a strict maka activate JSONL entry point with explicit roots, deterministic outcomes, safe-boundary resume, redacted bounded events, and one-shot lifecycle cleanup.
@Nyvo-io
Nyvo-ioforce-pushed the feat/1554-cloud-activation branch from 0f9a38a to cef97fdCompareJuly 31, 2026 05:45
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Addressed the remaining P1 in cef97fd3. Activation now maps unresolved production sandbox_boundary_required and requires_bypass tool failures to the deterministic blocked / permission_required / grant_permission outcome (exit 3), while preserving recovery when a later tool operation succeeds. The boundary-failure classification is shared with maka run, and the regression test exercises the production tool_result / function_response shape rather than an injected boundary request.

Verification on the latest main: focused related suites 70/70, full CLI 702/702, script tests 227/227, root typecheck, lint, format check, third-party notices, and git diff --check all pass. An independent final review reported no findings, and GitHub CI typecheck, test, and e2e are all green.

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the current head. The fixes from the earlier rounds remain intact, and I found no P0 or P1 issue.

Approving with four non-blocking protocol follow-ups. They affect recovery or bounded-output edge cases, and there is no current production Cloud coordinator relying on these paths yet.

Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/sandbox-boundary-failure.ts
Comment threadpackages/cli/src/activation-command.ts
Comment threadpackages/cli/src/activation-command.ts
@Nyvo-io

Copy link
Copy Markdown
ContributorAuthor

Thanks for the approval. I rechecked the four inline follow-ups on cef97fd3. They are explicitly non-blocking and concern future coordinator/recovery and protocol-boundary hardening; no production Cloud coordinator consumes this surface yet. The required activation behavior and prior P1s are complete, and typecheck, test, and e2e remain green.

I am leaving the implementation unchanged rather than adding an unrelated mechanical patch; these items should be tracked with the future coordinator work. This head is ready to merge once the non-blocking review threads are resolved.

@Astro-Han

Copy link
Copy Markdown
Contributor

The four review items are non-blocking for this foundation, so I’m resolving the threads and proceeding with the merge.

Please capture them in a follow-up issue before the production coordinator work begins:

  • make retry_activation executable for the same blocked session;
  • avoid treating an unrelated successful tool call as sandbox-boundary recovery;
  • represent event truncation with a valid protocol frame and include it in the budgets;
  • truncate large responses on a UTF-8 byte boundary without corrupting their representation.

Linking that issue back to #1587 will keep the protocol debt visible when the first production consumer is implemented.

@Astro-Han
Astro-Han merged commit 92cde3d into apache:mainAug 1, 2026
3 checks passed
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
Astro-Han added a commit that referenced this pull request Aug 1, 2026
… contracts (#1854)
* refactor(ci): split Storybook from e2e and demote floor layout to CSS contracts
Storybook never needed Electron: move build+smoke to a parallel job and stop
core-only changes from forcing cold Electron boots. Replace settings window-
floor and flat-shell chrome e2e with source CSS contracts; drop the unused
fixtures those specs paid for.
* ci: run Storybook only when the catalog or harness changes
Storybook is a design catalog, not a product ship gate. Typecheck already
covers story types and annotations; unit/e2e cover product behavior. Stop
forcing Chromium build+smoke on every desktop/ui/core PR — only stories,
.storybook, ui/stories, the smoke script, and core settings (THEME_PALETTES).
* refactor(desktop): demote pure layout e2e to CSS and source contracts
Delete Electron e2e that only re-measured CSS or structural source (topbar
overflow, QR bounding boxes, centerline/empty chat flush, model-picker mark
geometry, remote-access floor CSS, boot locale fixtures). Pin the same
invariants in unit contracts, and keep real product journeys plus titlebar
rendered-geometry and content-visibility scroll pin/warm-up in e2e.
* fix(ci): build workspace packages before Storybook job
The split storybook job only ran npm ci + build-storybook. Stories import
@maka/core (and other workspace packages) from dist/, so Rolldown failed
to resolve without the same build:workspace-deps step e2e used to pay for.
* fix(desktop): tighten e2e-slim contracts after dual review
Stop CSS contracts at each rule's own brace (with mutation coverage),
restore one live permission floor smoke and locale boot reload, pin topbar
menu wiring, and drop the unused settings-search fixture path.
* fix(runtime): add gateway to InvocationSource
#1587 sets runtimeSource to gateway for cloud activation, but the
INVOCATION_SOURCES union never included it, so typecheck and unit
build of packages/cli failed after merge with main.
* fix(desktop): reopen settings after locale reload without expand
Sidebar expand state can survive page.reload via localStorage, so the
Expand control is gone. Only click it when visible before re-entering
Settings for the rest of the locale journey.
* fix(cli): wait for /rename notice before asserting transcript
The title updates before the notice is rendered, so a bare assert races
and flakes in CI after the title wait already passed.
Sign up for freeto 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.

feat(cli): expose a one-shot Cloud Session activation protocol

2 participants

@Nyvo-io@Astro-Han