Skip to content

feat(quickstart): z.ai live message check through the Console + next channel - #617

Merged
ytallo merged 2 commits into
mainfrom
feat/quickstart-zai-console-message
Jul 28, 2026
Merged

feat(quickstart): z.ai live message check through the Console + next channel#617
ytallo merged 2 commits into
mainfrom
feat/quickstart-zai-console-message

Conversation

@ytallo

@ytallo ytallo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends the quickstart validator beyond install/boot: it now proves that a message sent through the Console gets a real model reply, using z.ai as the provider — plus an option to validate the next installer channel.

Live message check (Steps 7–8, gated on ZAI_API_KEY)

  • Step 7 adds the provider from the registry (iii worker add provider-zai) and waits for provider::zai::stream to register.
  • Step 8 runs console_send.py, which speaks the engine WebSocket protocol (invokefunction/invocationresult) through the Console's /ws proxy — the exact path the browser SPA uses, so a pass exercises Console proxy → engine → harness → llm-router → provider-zai end to end:
    1. harness::send {message, model: glm-5.2, provider: zai} (bounded: max_turns: 2, max_output_tokens: 1024, max_total_tokens: 16384)
    2. poll harness::status until the turn completes (fails fast on failed/cancelled)
    3. session::messages → assert a non-empty assistant reply
  • The prompt and the assistant's reply land in EVIDENCE.md (and console-send.json in the result artifact), so every run shows the actual model output.
  • Without the secret (e.g. forks) the check is skipped and recorded as such in result.json/EVIDENCE.md — the install/boot validation still runs.
  • The engine is started before the gate and inherits the step env, so the provider worker it spawns sees ZAI_API_KEY; the key never lands in config or artifacts.

next channel option

  • III_CHANNEL=next makes the installer run with --next; exposed as a channel choice input on workflow_dispatch (cron stays on main). Concurrency group and job name are per-channel.

Evidence cleanup

  • Dropped from EVIDENCE.md: the iii.lock section and the discovery.log/console-status.log tails (poll chatter). Both logs still ship in the harness-quickstart-logs artifact.

Testing

  • bash -n, python3 -m py_compile, and YAML parse pass.
  • Evidence/timing helpers exercised in isolation (message section renders, excluded logs stay out).
  • Protocol shapes cross-checked against the repo: WS frames from rbac-proxy/src/interceptor.rs, SendRequest/SendOptions from harness/src/functions/send.rs, terminal-turn logic from harness/tests/e2e/src/context.rs, transcript pagination from the same, message shape from harness/tests/e2e/src/scenarios/common.rs.
  • A workflow_dispatch run on this branch validates end to end (uses the repo ZAI_API_KEY secret already consumed by the Harness E2E nightly).

Label no-ticket: CI/validator tooling only.

Summary by CodeRabbit

  • New Features

    • Quickstart validation can now run against either the main or next installation channel.
    • Optional live messaging validation now checks end-to-end Console responses when configured with a provider API key.
    • Quickstart results include channel and message-validation status, with supporting response evidence.
  • Bug Fixes

    • Corrected reactive automation checks to use the updated database row-change trigger name.
  • Documentation

    • Clarified quickstart validation steps, optional live checks, and next channel usage.

…channel

Extend the quickstart validator beyond install/boot: when ZAI_API_KEY is
set, it now proves a real model round-trip through the Console.

- Step 7: `iii worker add provider-zai`, wait for provider::zai::stream
- Step 8: console_send.py speaks the engine WS protocol
  (invokefunction/invocationresult) through the Console /ws proxy — the
  same path the browser uses — sending harness::send (glm-5.2 via zai),
  polling harness::status to completion, and asserting a non-empty
  assistant reply from session::messages
- result.json gains channel + message_check; EVIDENCE.md gains the
  prompt/reply section and drops the iii.lock, discovery.log and
  console-status.log noise
- III_CHANNEL=next installs from the next channel; exposed as the
  `channel` choice input on workflow_dispatch
- without ZAI_API_KEY the live check is skipped and recorded as skipped
@ytallo ytallo added the no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only) label Jul 28, 2026
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jul 28, 2026 9:13pm
workers-tech-spec Ready Ready Preview, Comment Jul 28, 2026 9:13pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds channel-aware quickstart validation, optional Console-to-provider messaging checks, richer evidence artifacts, and updates reactive automation references from database::row-change to database::row-changed.

Changes

Quickstart validation

Layer / File(s) Summary
Channel-aware installation
.github/workflows/harness-quickstart.yml, harness/tests/quickstart/run-ci.sh
Workflow dispatch supports main and next; the validator passes the selected channel to installation and records it in results.
Console message validation
harness/tests/quickstart/console_send.py, harness/tests/quickstart/run-ci.sh
Optional Z.AI validation sends a message through the Console WebSocket proxy, polls turn status, retrieves the transcript, and requires a non-empty assistant reply.
Quickstart evidence and artifacts
harness/tests/quickstart/run-ci.sh, harness/tests/quickstart/README.md, .github/workflows/harness-quickstart.yml
Results include channel and message-check status, optional reply evidence, filtered logs, updated documentation, and the console result artifact.

Reactive automation trigger rename

Layer / File(s) Summary
Updated row-change trigger references
harness/tests/e2e/README.md, harness/tests/e2e/run-ci.sh, harness/tests/e2e/src/scenarios/reactive_automation/*
Documentation, readiness checks, prompts, and evidence collection now use database::row-changed.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Validator
  participant Console
  participant Engine
  participant ZAI
  Validator->>Console: Send prompt through WebSocket
  Console->>Engine: Start assistant turn
  Engine->>ZAI: Request streamed response
  Validator->>Console: Poll status and fetch messages
  Console-->>Validator: Return completed turn and assistant reply
Loading

Possibly related PRs

Poem

A bunny hops through main and next,
Sends a prompt and checks the text.
Triggers change, the logs grow bright,
Replies bloom through WebSocket light.
“Quickstart passed!” the rabbit sings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately captures the main changes: z.ai live message checking through the Console and next-channel support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/quickstart-zai-console-message

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 49 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

… actually registers

The database worker registers its trigger type as database::row-changed
(ROW_CHANGED_TYPE in database/src/triggers/bus.rs), but the e2e stack
script polled for database::row-change and timed out after 60s, failing
every scenario job on main (run 30395783495). Align the wait, the
reactive_automation prompt/queries, and the README to the real name.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/harness-quickstart.yml (1)

27-27: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Consider persist-credentials: false on checkout.

Static analysis flags credential persistence: this job doesn't need the checked-out repo to retain git credentials afterward.

🔒 Suggested fix
       - uses: actions/checkout@v5
+        with:
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/harness-quickstart.yml at line 27, Update the
actions/checkout@v5 step in the workflow to disable persisted Git credentials by
configuring persist-credentials as false.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@harness/tests/quickstart/run-ci.sh`:
- Around line 203-210: Update the console-message evidence block in run-ci.sh to
render only when console-send.json contains valid JSON with a usable reply,
rather than merely when the file exists. Use jq validation or an equivalent
guard before printing the heading and reply, while preserving the existing
output for successful console_send.py runs and avoiding suppressed jq errors
being presented as evidence.
- Around line 489-525: Replace the asynchronous process substitution on the
console_send.py stderr redirection in the console_message_check stage with a
synchronous logging approach that preserves stderr output in console-send.log
before the failure path calls die. Keep stderr visible to the terminal and
ensure the complete diagnostics are available for collect_evidence and artifact
upload.

---

Nitpick comments:
In @.github/workflows/harness-quickstart.yml:
- Line 27: Update the actions/checkout@v5 step in the workflow to disable
persisted Git credentials by configuring persist-credentials as false.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b74d1a6-be95-417e-a5c2-4d3f7db8595b

📥 Commits

Reviewing files that changed from the base of the PR and between f921741 and 096c318.

📒 Files selected for processing (8)
  • .github/workflows/harness-quickstart.yml
  • harness/tests/e2e/README.md
  • harness/tests/e2e/run-ci.sh
  • harness/tests/e2e/src/scenarios/reactive_automation/prompt.rs
  • harness/tests/e2e/src/scenarios/reactive_automation/queries.rs
  • harness/tests/quickstart/README.md
  • harness/tests/quickstart/console_send.py
  • harness/tests/quickstart/run-ci.sh

Comment on lines +203 to +210
if [[ -f "$artifact_dir/console-send.json" ]]; then
printf '## Console message check (%s via %s)\n\n' "$send_model" "$send_provider"
printf '**Prompt:** %s\n\n' "$send_prompt"
printf '**Reply:**\n\n```\n'
jq -r '.reply' "$artifact_dir/console-send.json" 2>/dev/null
printf '```\n\n'
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Guard the console-message evidence block against a failed/empty console-send.json.

console_send.py's stdout is redirected straight to console-send.json (Line 512) even when the process exits nonzero before ever calling json.dump. When that happens this block still renders a "Console message check" heading with an empty/garbled reply (the jq -r '.reply' error is swallowed by 2>/dev/null), which reads as a partially-successful check even though message_check was set to failed.

♻️ Suggested fix
-    if [[ -f "$artifact_dir/console-send.json" ]]; then
+    if [[ -s "$artifact_dir/console-send.json" ]] && jq -e . "$artifact_dir/console-send.json" >/dev/null 2>&1; then
       printf '## Console message check (%s via %s)\n\n' "$send_model" "$send_provider"
       printf '**Prompt:** %s\n\n' "$send_prompt"
       printf '**Reply:**\n\n```\n'
       jq -r '.reply' "$artifact_dir/console-send.json" 2>/dev/null
       printf '```\n\n'
     fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ -f "$artifact_dir/console-send.json" ]]; then
printf '## Console message check (%s via %s)\n\n' "$send_model" "$send_provider"
printf '**Prompt:** %s\n\n' "$send_prompt"
printf '**Reply:**\n\n```\n'
jq -r '.reply' "$artifact_dir/console-send.json" 2>/dev/null
printf '```\n\n'
fi
if [[ -s "$artifact_dir/console-send.json" ]] && jq -e . "$artifact_dir/console-send.json" >/dev/null 2>&1; then
printf '## Console message check (%s via %s)\n\n' "$send_model" "$send_provider"
printf '**Prompt:** %s\n\n' "$send_prompt"
printf '**Reply:**\n\n
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@harness/tests/quickstart/run-ci.sh` around lines 203 - 210, Update the
console-message evidence block in run-ci.sh to render only when
console-send.json contains valid JSON with a usable reply, rather than merely
when the file exists. Use jq validation or an equivalent guard before printing
the heading and reply, while preserving the existing output for successful
console_send.py runs and avoiding suppressed jq errors being presented as
evidence.

Comment on lines +489 to +525
# ---------------------------------------------------------------------------
# Steps 7-8: add the Z.AI provider and prove a real model reply through the
# Console. Gated on ZAI_API_KEY: the engine (started in Step 2) inherited
# this shell's environment, so the provider worker it spawns sees the key.
# ---------------------------------------------------------------------------
if [[ -n "${ZAI_API_KEY:-}" ]]; then
stage_start worker_add_provider_zai
log "Step 7: iii worker add provider-zai"
run_add provider-zai 2>&1 | tee "$log_dir/provider-add.log"
wait_for_function provider::zai::stream
stage_end

stage_start console_message_check
log "Step 8: send a message through the Console /ws proxy (model=$send_model provider=$send_provider)"
message_check="failed"
python3 -m venv "$run_root/venv" >>"$log_dir/console-send.log" 2>&1 \
|| die "python3 -m venv failed (see console-send.log)"
"$run_root/venv/bin/pip" install --quiet websockets >>"$log_dir/console-send.log" 2>&1 \
|| die "pip install websockets failed (see console-send.log)"
if ! "$run_root/venv/bin/python" "$script_dir/console_send.py" \
--url "ws://127.0.0.1:$console_port/ws" \
--model "$send_model" --provider "$send_provider" \
--prompt "$send_prompt" --timeout "$turn_timeout_seconds" \
>"$artifact_dir/console-send.json" \
2> >(tee -a "$log_dir/console-send.log" >&2); then
die "console message send failed (see console-send.log)"
fi
reply=$(jq -er '.reply | select(length > 0)' "$artifact_dir/console-send.json") \
|| die "console send did not produce a non-empty assistant reply"
ok "assistant replied through the Console (${#reply} chars)"
message_check="passed"
stage_end
else
log "Steps 7-8: ZAI_API_KEY is not set; skipping provider add + Console message check"
fi

log "ALL QUICKSTART ASSERTIONS PASSED ($cli_version, channel=$channel, message_check=$message_check)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Process-substitution stderr tee can race with die on failure.

2> >(tee -a "$log_dir/console-send.log" >&2) (Line 513) writes stderr asynchronously via a subshell that bash does not wait on. If the python command fails and die exits right after, the last lines of console-send.log — the exact diagnostics needed to debug the failure — can be missing when collect_evidence/artifact upload runs.

♻️ Suggested fix (avoid async process substitution)
-  if ! "$run_root/venv/bin/python" "$script_dir/console_send.py" \
-    --url "ws://127.0.0.1:$console_port/ws" \
-    --model "$send_model" --provider "$send_provider" \
-    --prompt "$send_prompt" --timeout "$turn_timeout_seconds" \
-    >"$artifact_dir/console-send.json" \
-    2> >(tee -a "$log_dir/console-send.log" >&2); then
-    die "console message send failed (see console-send.log)"
-  fi
+  if ! "$run_root/venv/bin/python" "$script_dir/console_send.py" \
+    --url "ws://127.0.0.1:$console_port/ws" \
+    --model "$send_model" --provider "$send_provider" \
+    --prompt "$send_prompt" --timeout "$turn_timeout_seconds" \
+    >"$artifact_dir/console-send.json" \
+    2>>"$log_dir/console-send.log"; then
+    cat "$log_dir/console-send.log" >&2
+    die "console message send failed (see console-send.log)"
+  fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# ---------------------------------------------------------------------------
# Steps 7-8: add the Z.AI provider and prove a real model reply through the
# Console. Gated on ZAI_API_KEY: the engine (started in Step 2) inherited
# this shell's environment, so the provider worker it spawns sees the key.
# ---------------------------------------------------------------------------
if [[ -n "${ZAI_API_KEY:-}" ]]; then
stage_start worker_add_provider_zai
log "Step 7: iii worker add provider-zai"
run_add provider-zai 2>&1 | tee "$log_dir/provider-add.log"
wait_for_function provider::zai::stream
stage_end
stage_start console_message_check
log "Step 8: send a message through the Console /ws proxy (model=$send_model provider=$send_provider)"
message_check="failed"
python3 -m venv "$run_root/venv" >>"$log_dir/console-send.log" 2>&1 \
|| die "python3 -m venv failed (see console-send.log)"
"$run_root/venv/bin/pip" install --quiet websockets >>"$log_dir/console-send.log" 2>&1 \
|| die "pip install websockets failed (see console-send.log)"
if ! "$run_root/venv/bin/python" "$script_dir/console_send.py" \
--url "ws://127.0.0.1:$console_port/ws" \
--model "$send_model" --provider "$send_provider" \
--prompt "$send_prompt" --timeout "$turn_timeout_seconds" \
>"$artifact_dir/console-send.json" \
2> >(tee -a "$log_dir/console-send.log" >&2); then
die "console message send failed (see console-send.log)"
fi
reply=$(jq -er '.reply | select(length > 0)' "$artifact_dir/console-send.json") \
|| die "console send did not produce a non-empty assistant reply"
ok "assistant replied through the Console (${#reply} chars)"
message_check="passed"
stage_end
else
log "Steps 7-8: ZAI_API_KEY is not set; skipping provider add + Console message check"
fi
log "ALL QUICKSTART ASSERTIONS PASSED ($cli_version, channel=$channel, message_check=$message_check)"
# ---------------------------------------------------------------------------
# Steps 7-8: add the Z.AI provider and prove a real model reply through the
# Console. Gated on ZAI_API_KEY: the engine (started in Step 2) inherited
# this shell's environment, so the provider worker it spawns sees the key.
# ---------------------------------------------------------------------------
if [[ -n "${ZAI_API_KEY:-}" ]]; then
stage_start worker_add_provider_zai
log "Step 7: iii worker add provider-zai"
run_add provider-zai 2>&1 | tee "$log_dir/provider-add.log"
wait_for_function provider::zai::stream
stage_end
stage_start console_message_check
log "Step 8: send a message through the Console /ws proxy (model=$send_model provider=$send_provider)"
message_check="failed"
python3 -m venv "$run_root/venv" >>"$log_dir/console-send.log" 2>&1 \
|| die "python3 -m venv failed (see console-send.log)"
"$run_root/venv/bin/pip" install --quiet websockets >>"$log_dir/console-send.log" 2>&1 \
|| die "pip install websockets failed (see console-send.log)"
if ! "$run_root/venv/bin/python" "$script_dir/console_send.py" \
--url "ws://127.0.0.1:$console_port/ws" \
--model "$send_model" --provider "$send_provider" \
--prompt "$send_prompt" --timeout "$turn_timeout_seconds" \
>"$artifact_dir/console-send.json" \
2>>"$log_dir/console-send.log"; then
cat "$log_dir/console-send.log" >&2
die "console message send failed (see console-send.log)"
fi
reply=$(jq -er '.reply | select(length > 0)' "$artifact_dir/console-send.json") \
|| die "console send did not produce a non-empty assistant reply"
ok "assistant replied through the Console (${`#reply`} chars)"
message_check="passed"
stage_end
else
log "Steps 7-8: ZAI_API_KEY is not set; skipping provider add + Console message check"
fi
log "ALL QUICKSTART ASSERTIONS PASSED ($cli_version, channel=$channel, message_check=$message_check)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@harness/tests/quickstart/run-ci.sh` around lines 489 - 525, Replace the
asynchronous process substitution on the console_send.py stderr redirection in
the console_message_check stage with a synchronous logging approach that
preserves stderr output in console-send.log before the failure path calls die.
Keep stderr visible to the terminal and ensure the complete diagnostics are
available for collect_evidence and artifact upload.

@ytallo
ytallo merged commit fef309a into main Jul 28, 2026
17 checks passed
@ytallo
ytallo deleted the feat/quickstart-zai-console-message branch July 28, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant