Skip to content

feat: let agents review, approve and abort building block runs without a terminal - #85

Open
j0g3sc wants to merge 6 commits into
mainfrom
claude/cli-gaps-pr-plan-8932c4
Open

j0g3sc wants to merge 6 commits into
mainfrom
claude/cli-gaps-pr-plan-8932c4

Conversation

@j0g3sc

@j0g3sc j0g3sc commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Agents and scripts could not approve or abort a building block run: approve-run and abort-run only work on a terminal, so they read the plan from the bbrun logs JSON of the run before and sent the raw approve and abort requests. This PR closes that gap, one commit per step, plus two commits that correct them after a review:

  1. meshstack bbrun plan <run-uuid> follows the waiting run's predecessor to the detect run, prints its logs as text, and prints the detect run's uuid together with the approve-run command to approve it. approve-run reuses the same lookup.
  2. approve-run <uuid> --run <run-uuid> --detect-run <detect-run-uuid> approves without asking. --run names the run to approve, as abort-run --run does, and --detect-run the plan the caller reviewed; the two go together. The approval is bound to that plan: if meshStack has planned the run again since, or the uuid is not the run's detect run, meshStack answers 409. The command then says that the user has to see the new plan and allow it again.
  3. abort-run <uuid> --run <run-uuid> aborts that run without asking, whether it waits for approval or is in progress, and also if it is not the latest run. It names the run instead of taking a --yes, and refuses a run of another building block.
  4. bb wait and trigger-run --wait name the action, the waiting run and bbrun plan when they stop at APPROVE_RUN. They do not name the detect run: status.latestDryRunUuid is null while the run waits, and bbrun plan finds the detect run itself.

Without a terminal and without the new flags, both commands still refuse, and now point to their --help. The meshstack-cli skill describes the new flow under Approval gates and preflight runs.

Known limits

  • abort-run --run aborts the run in whatever state it is in, and does not ask. If someone approves a waiting run after the caller read it, the apply in progress stops. The skill tells agents to read the building block again right before.
  • bbrun plan prints the detect run's uuid in a log line on stderr, and has no -o flag.
  • No acceptance test covers the approval flow: the local stack has no definition with an approval policy.

🤖 Generated with Claude Code

j0g3sc and others added 4 commits November 13, 2026 11:04
'meshstack buildingblockrun plan <run-uuid>' follows the waiting run's
predecessor to the detect run, prints its logs as text and names it, so
that an agent no longer reads the plan from the logs JSON of the run
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'meshstack buildingblock approve-run <uuid> --detect-run <run-uuid>'
approves the plan of the detect run that 'meshstack buildingblockrun
plan' named, without asking. It still approves only that plan: if
meshStack has planned the run again since, the approval fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'meshstack buildingblock abort-run <uuid> --run <run-uuid>' aborts that
run of the building block without asking, so that a script can reject a
stale waiting run without the raw abort request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'meshstack buildingblock wait' and 'trigger-run --wait' now name the run
that waits for approval and the detect run whose plan it waits on, and
point to 'meshstack buildingblockrun plan'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meshcloud-gh-actions

meshcloud-gh-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on 44399e2db3a80d95393198968c5fedc2e5fbf5a0.

Scope Coverage
Unit tests 78.7%
Acceptance tests 54.5%
Combined 81.2%
Uncovered functions
client/api_key.go:52: meshApiKeyClient.Create 0.0%
client/api_key.go:56: meshApiKeyClient.Read 0.0%
client/api_key.go:60: meshApiKeyClient.Update 0.0%
client/api_key.go:64: meshApiKeyClient.Delete 0.0%
client/api_key_permissions.go:20: ApiKeyPermissions.AllCodes 0.0%
client/api_key_permissions.go:33: ApiKeyPermissions.WorkspaceCodes 0.0%
client/api_key_permissions.go:262: AllApiKeyPermissions 0.0%
client/api_key_permissions.go:266: WorkspacePermissionCodes 0.0%
client/building_block_definition.go:71: MeshBuildingBlockDefinitionApprovalPolicies.NothingRequiresApproval 0.0%
client/building_block_definition.go:82: DisabledSchedule 0.0%
client/building_block_definition.go:89: MeshBuildingBlockDefinitionSchedule.IsDisabled 0.0%
client/building_block_definition.go:93: MeshBuildingBlockDefinitionSpec.HasNeutralPolicies 0.0%
client/building_block_definition.go:97: MeshBuildingBlockDefinitionSpec.WithNeutralPolicies 0.0%
client/building_block_definition.go:166: meshBuildingBlockDefinitionClient.List 0.0%
client/building_block_definition.go:173: meshBuildingBlockDefinitionClient.Read 0.0%
client/building_block_definition.go:177: meshBuildingBlockDefinitionClient.Create 0.0%
client/building_block_definition.go:181: meshBuildingBlockDefinitionClient.Update 0.0%
client/building_block_definition.go:185: meshBuildingBlockDefinitionClient.Delete 0.0%
client/building_block_definition_version.go:101: MeshBuildingBlockType.TagInputTargets 0.0%
client/building_block_definition_version.go:245: meshBuildingBlockDefinitionVersionClient.Create 0.0%
client/building_block_definition_version.go:254: meshBuildingBlockDefinitionVersionClient.Update 0.0%
client/building_block_definition_version_implementation.go:81: MeshBuildingBlockDefinitionImplementation.InferType 0.0%
client/building_block_definition_version_implementation.go:95: MeshBuildingBlockDefinitionImplementation.MarshalJSONTo 0.0%
client/building_block_definition_version_implementation.go:108: *MeshBuildingBlockDefinitionImplementation.UnmarshalJSONFrom 0.0%
client/building_block_runner.go:93: meshBuildingBlockRunnerClient.Create 0.0%
... and 127 more

covdata func names a method without its receiver, so an entry can belong to an implementation nothing selects rather than to a function the tests never reached. Open the file and line before reading one as a coverage gap.

j0g3sc and others added 2 commits November 13, 2026 15:35
A review of the pull request found these:

- 'bb wait' and 'trigger-run --wait' named an empty detect run at
  APPROVE_RUN, because meshStack sends status.latestDryRunUuid as null
  while the waiting run is the newest run. They name the action again
  and point to 'bbrun plan <waiting run>', which finds the detect run.
- 'approve-run --detect-run': the 409 message no longer says the plan
  changed when the caller named the wrong detect run, and it says that
  the user has to see a new plan. The command prints how to follow the
  approved run.
- 'abort-run --run' no longer reads the building block first, and its
  tests cover a run in progress, a run that cannot be aborted and a run
  of another building block.
- 'bbrun plan': the error for a run without a predecessor says which
  run to give, the approve hint asks for the user's go-ahead, and the
  documented grep skips the step status lines.
- The meshstack-cli skill describes how to wait after an approval, asks
  for the user's go-ahead before an approval or an abort, no longer
  leaves a stray line behind the abort example, and lists the two
  commands in its table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
'approve-run' without a terminal takes the run to approve with --run,
together with --detect-run for the plan the caller reviewed, so that both
commands name the run they act on the same way. The two flags belong
together.

- Both commands read the named run, check that it belongs to the
  building block, and act on it. 'approve-run' refuses a run that does
  not wait for approval any more, and no longer reads the building block
  first.
- Both commands detect the flag with Flags().Changed, so an all-zero
  uuid is not taken for a missing flag.
- 'bbrun plan', the help texts and the skill show the new command line.
- The tests cover the flag pair, a run that does not wait for approval
  and a run of another building block.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to 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.

1 participant