fix: sealed peer sync smoke + clearer approval denials (0.9.18)

CLI/Docker assert AEAD sync; status shows sealed channel; headless denials no longer pretend the user refused.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 11:18:04 +08:00
co-authored by Cursor
parent 5900b53642
commit 1605d74f17
7 changed files with 68 additions and 12 deletions
+14 -4
View File
@@ -1030,9 +1030,13 @@ static void sandbox_escalate(turn_t *t, cst_tool_ctx_t *ctx,
}
if (ans == CST_PERM_DENY) {
const char *note =
"\n[cst: blocked by the sandbox (writes are limited to the "
"workspace and temp dir); the user did not allow running it "
"outside]\n";
(t->hooks && t->hooks->on_permission)
? "\n[cst: blocked by the sandbox (writes are limited to the "
"workspace and temp dir); the user did not allow running it "
"outside]\n"
: "\n[cst: blocked by the sandbox (writes are limited to the "
"workspace and temp dir); no interactive approval channel to "
"rerun outside — use CST_APPROVAL=yolo or the TUI]\n";
cst_buf_t b = {0};
if (tr->out)
cst_buf_append(&b, tr->out, tr->out_len);
@@ -1284,7 +1288,13 @@ static void exec_begin(turn_t *t, pcall_t *pc, exec_t *x) {
pc->status = PC_DUP;
hook_status(t, "skip duplicate read");
} else if (!allow) {
set_output(pc, "denied by user", 14, 1);
const char *msg =
(t->hooks && t->hooks->on_permission)
? "denied by user"
: "error: tool needs approval but no interactive channel is "
"available (headless/auto without YOLO). Set CST_APPROVAL=yolo "
"or CST_AUTO_APPROVE=1, or run in the TUI.";
set_output(pc, msg, strlen(msg), 1);
pc->status = PC_DENIED;
hook_tool(t, "denied", c, detail);
} else {
+1
View File
@@ -468,5 +468,6 @@ char *cst_parliament_status_text(void) {
svc_id[0] ? svc_id : "-", svc_port);
else
cst_buf_puts(&b, "service stopped\n");
cst_buf_puts(&b, "peer_sync sealed (X25519 + XChaCha20-Poly1305)\n");
return cst_buf_steal(&b);
}
+41 -2
View File
@@ -247,7 +247,27 @@ int cst_parliament_cli_peer_listen(int port, const char *instance_id) {
os_net_close(ls);
return 1;
}
printf("peer_ok remote=%s host=%s\n", sess.remote.instance_id, sess.host);
printf("peer_ok remote=%s host=%s sealed=%d\n", sess.remote.instance_id,
sess.host, sess.sealed);
fflush(stdout);
{
cst_peer_sync_bundle_t local = {0};
cst_parliament_meta_t m;
memset(&m, 0, sizeof(m));
(void)cst_parliament_load(&m);
local.revision = m.revision;
snprintf(local.parliament_id, sizeof(local.parliament_id), "%s",
m.parliament_id);
snprintf(local.project_id, sizeof(local.project_id), "%s", m.project_id);
snprintf(local.chair_instance, sizeof(local.chair_instance), "%s",
m.chair_instance);
local.context = cst_parliament_context_get();
if (cst_peer_sync(&sess, &local, 15000, err, sizeof(err)) != 0)
fprintf(stderr, "peer_sync failed: %s\n", err);
else
printf("peer_sync rev=%lu sealed=1\n", local.revision);
free(local.context);
}
cst_peer_close(&sess);
os_net_close(ls);
return 0;
@@ -274,7 +294,26 @@ int cst_parliament_cli_peer_dial(const char *host, int port,
fprintf(stderr, "dial/handshake failed: %s\n", err);
return 1;
}
printf("peer_ok remote=%s\n", sess.remote.instance_id);
printf("peer_ok remote=%s sealed=%d\n", sess.remote.instance_id, sess.sealed);
fflush(stdout);
{
cst_peer_sync_bundle_t local = {0};
cst_parliament_meta_t m;
memset(&m, 0, sizeof(m));
(void)cst_parliament_load(&m);
local.revision = m.revision;
snprintf(local.parliament_id, sizeof(local.parliament_id), "%s",
m.parliament_id);
snprintf(local.project_id, sizeof(local.project_id), "%s", m.project_id);
snprintf(local.chair_instance, sizeof(local.chair_instance), "%s",
m.chair_instance);
local.context = cst_parliament_context_get();
if (cst_peer_sync(&sess, &local, 15000, err, sizeof(err)) != 0)
fprintf(stderr, "peer_sync failed: %s\n", err);
else
printf("peer_sync rev=%lu sealed=1\n", local.revision);
free(local.context);
}
cst_peer_close(&sess);
return 0;
}