fix: dispatcher.sh: handle direct-commit low-tier vault actions (#439) #455

Merged
dev-qwen merged 1 commit from fix/issue-439 into main 2026-04-08 20:21:42 +00:00
Collaborator

Fixes #439

Changes

Fixes #439 ## Changes
dev-qwen added 1 commit 2026-04-08 20:15:40 +00:00
fix: dispatcher.sh: handle direct-commit low-tier vault actions (#439)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
605fc136ae
Collaborator

AI Review

Summary

This PR connects the low-tier direct-commit path (introduced in #438) to the dispatcher. Without it, the dispatcher would reject every low-tier action because verify_admin_merged finds no PR for files committed directly to ops main. The three-part fix is coherent:

  • lib/vault.sh: prepend dispatch_mode = "direct" to the TOML before committing it to ops main
  • dispatcher.sh: get_dispatch_mode() reads the field; launch_runner() skips admin merge verification for direct-mode actions
  • vault-env.sh: add dispatch_mode to the allowlist so validation doesn't reject it

Backward compatibility is preserved — files without the field default to "pr" mode.

Findings

  • medium lib/vault.sh:179 / vault/vault-env.sh:76: dispatch_mode is now a validated known field, meaning an agent can include dispatch_mode = "direct" in the TOML content it passes to vault_request(). For medium/high-tier actions the original toml_content is written to the branch as-is (not direct_toml), so if an agent embeds this field, the dispatcher will skip verify_admin_merged for that action — even though it arrived via a PR. The safety net is that an admin must still merge the PR, but the dispatcher-level check is a second line of defense. A defense-in-depth improvement: in launch_runner(), if dispatch_mode = "direct" but VAULT_TIER != "low", log an error and reject. This would be a clean follow-up issue.

  • minor docker/edge/dispatcher.sh:306: The updated doc comment claims validate_action sets VAULT_DISPATCH_MODE, but neither validate_action() nor the underlying validate_vault_action() exports that variable. The dispatch mode is read separately via get_dispatch_mode(). The comment should drop VAULT_DISPATCH_MODE from the "Sets:" line.

No issues found

  • Trap replacement in vault.sh (line 179) correctly covers both $tmp_toml and $direct_toml — the second trap supercedes the first as intended.
  • get_dispatch_mode() defaults to "pr" for unknown/missing values, so any unrecognised mode falls through to the admin verification path safely.
  • ShellCheck passes (CI is green); quoting and error handling follow existing conventions.

Verdict

APPROVE — Fix is correct and complete; two minor concerns flagged below, neither blocking


Reviewed at 605fc13 | AGENTS.md

## AI Review <!-- reviewed: 605fc136aecb88af31fd7200ba1f2fba2b9aac9b --> ### Summary This PR connects the low-tier direct-commit path (introduced in #438) to the dispatcher. Without it, the dispatcher would reject every low-tier action because `verify_admin_merged` finds no PR for files committed directly to ops main. The three-part fix is coherent: - **lib/vault.sh**: prepend `dispatch_mode = "direct"` to the TOML before committing it to ops main - **dispatcher.sh**: `get_dispatch_mode()` reads the field; `launch_runner()` skips admin merge verification for direct-mode actions - **vault-env.sh**: add `dispatch_mode` to the allowlist so validation doesn't reject it Backward compatibility is preserved — files without the field default to `"pr"` mode. ### Findings - **medium** `lib/vault.sh:179` / `vault/vault-env.sh:76`: `dispatch_mode` is now a validated known field, meaning an agent can include `dispatch_mode = "direct"` in the TOML content it passes to `vault_request()`. For medium/high-tier actions the original `toml_content` is written to the branch as-is (not `direct_toml`), so if an agent embeds this field, the dispatcher will skip `verify_admin_merged` for that action — even though it arrived via a PR. The safety net is that an admin must still merge the PR, but the dispatcher-level check is a second line of defense. A defense-in-depth improvement: in `launch_runner()`, if `dispatch_mode = "direct"` but `VAULT_TIER != "low"`, log an error and reject. This would be a clean follow-up issue. - **minor** `docker/edge/dispatcher.sh:306`: The updated doc comment claims `validate_action` sets `VAULT_DISPATCH_MODE`, but neither `validate_action()` nor the underlying `validate_vault_action()` exports that variable. The dispatch mode is read separately via `get_dispatch_mode()`. The comment should drop `VAULT_DISPATCH_MODE` from the "Sets:" line. ### No issues found - Trap replacement in `vault.sh` (line 179) correctly covers both `$tmp_toml` and `$direct_toml` — the second trap supercedes the first as intended. - `get_dispatch_mode()` defaults to `"pr"` for unknown/missing values, so any unrecognised mode falls through to the admin verification path safely. - ShellCheck passes (CI is green); quoting and error handling follow existing conventions. ### Verdict **APPROVE** — Fix is correct and complete; two minor concerns flagged below, neither blocking --- *Reviewed at `605fc13` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-08 20:19:45 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Fix is correct and complete; two minor concerns flagged below, neither blocking

AI Review: **APPROVE** — Fix is correct and complete; two minor concerns flagged below, neither blocking
dev-qwen merged commit 6861ea0880 into main 2026-04-08 20:21:42 +00:00
dev-qwen deleted branch fix/issue-439 2026-04-08 20:21:43 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#455
No description provided.