Skip to content

Route request_continuation to queue successors, approval issues or workflow dispatch - #80174

Merged
elefthei merged 1 commit into
work-queue-v4-timelessfrom
request-continuation-routes
Nov 23, 2026
Merged

elefthei merged 1 commit into
work-queue-v4-timelessfrom
request-continuation-routes

Conversation

@elefthei

@elefthei elefthei commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #79748 (work-queue-v4-timeless); review that one first. The queue route writes v4 ledger records that #79748 introduces.

request_continuation (merged in #79834) is advisory: an agent can say more work remains, and audit/logs/health count it, but nothing acts on it. This PR adds an opt-in route so a request can create exactly one follow-up, bounded by depth. Without route, behavior is unchanged. work-queue-v4-timeless is now rebased onto main, so this PR builds on #79834 directly instead of carrying a copy of it.

safe-outputs:
  request-continuation:
    route: dispatch        # or workqueue, issue
    workflow: my-follow-up # dispatch only: local workflow ID
    max-depth: 3           # workqueue/dispatch: 1–16, default 1

Routes

  • workqueue (assignment-bound queue workers). The worker's finish commit appends Completion and one successor Work atomically. The successor depends on the parent, inherits its graph, pool, priority, fairness key, profile and payload, and gets the message as assignment.claims[i].continuation. Replay rejects a duplicate, pre-existing or unpaired successor (request_invalid).
  • issue (queue workers). The publisher opens one approval issue in the queue repository. The successor carries an Issue dependency with the new approved condition. It becomes ready only when a User with write, maintain or admin closes that issue as completed. Closes by bots, by triage-only users or as "not planned" don't approve. The ready Observation records approved_by and is committed together with the Claim it releases. max-depth is rejected here; each approval releases one successor.
  • dispatch (ordinary workflows). Process Safe Outputs dispatches the named local workflow on the default branch with a gh_aw_continuation JSON input: version, message, remaining depth, source run. The remaining budget is the smaller of the local max-depth and the inbound remaining. At zero the request is recorded and not dispatched. The receiver must declare gh_aw_continuation as a string input with no default. Self-targets, queue workers and workflow_call workflows are rejected at compile time.

Routed forms accept only max: 1. They use the global safe-outputs.authorization; queue admission is request_continuation:admit.

Replay protection

A new agent-job output, continuation_evidence, is <run_id>:<run_attempt>:<sha256 of agent_output.json>. It is computed just before the artifact upload. Process Safe Outputs and the worker finalizer check run attempt, digest and file bounds before routing, so a publisher-only rerun can't replay an earlier attempt's request.

Ledger and compatibility

The v4 ledger gains an optional Work continuation, finish commits that carry a successor Work, the Issue condition approved, and Observation approved_by. JS and Go replay apply the same inheritance, depth, size and approval rules. WorkQueueV4.tla::Complete now allows one previously absent successor. specs/work-queue/fixtures/canonical-prefix.json adds accepted and rejected continuation, approval and checkpoint cases. Existing ledgers replay unchanged.

Older v4 readers reject a finish commit that carries Work. Upgrade workers, dispatchers, maintenance and the CLI before turning on a queue route against a shared ledger.

Worth a careful look

  • work_queue_dependency_resolver.cjs::approvalPredicate checks the closer's role when the dispatcher plans, not when the issue was closed. The ready observation is committed in the same dispatch_next commit that claims the successor. A writer who closes the issue and loses access before the next dispatcher run does not approve it.
  • finish_work_queue_claim.cjs also ships in the MCP and safe-outputs bundles (through work_queue_claim_scope.cjs). safe_output_authorization.cjs calls core.setSecret, which would corrupt an MCP server's stdout. So work_queue_continuation.cjs::authorizationProtocol loads it by a non-literal path, and only in the trusted finish step. setup.sh deploys the continuation modules and check_permissions_utils.cjs to both bundles, but not the authorization module.
  • pr-sous-chef.lock.yml changes only because the shared validation registry now lists request_continuation; that workflow doesn't enable it.

Validation

  • make fmt and make recompile (370 workflows) change nothing.
  • npm run typecheck in actions/setup/js: 0 errors.
  • make agent-report-progress (BASE_REF=origin/main) on the rebased stack (8433f57, merged as 0414cf3 with an identical tree): every check passes, including custom Go linters and impacted JS tests (72 files / 2096 tests).
  • After the rebase, this PR changes 70 files instead of 144: the pkg/cli analytics and the logs/audit schemas now come from main unchanged, so the earlier 38 custom-linter findings in copied code are gone.

Copilot AI adaptive review requested due to automatic review settings November 22, 2026 23:30
* @param {any} payload
* @returns {string}
*/
function renderContinuationRequest(payload) {
core.info("request_continuation: follow-up requested; continuation not confirmed");
return {
success: true,
message: message.message,

Copilot AI 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.

🟡 Changes recommended

Unresolved critical defects can misattribute stale continuation evidence after reruns, expose private task content in logs, and reject completion after resource effects have run.

11 open issues
What changed in this PR

Extends gh-aw’s advisory continuation signal with opt-in follow-up routing, building on the v4 work-queue ledger from #79748. It also ports the signal and analytics introduced in #79834.

Changes:

  • Add bounded routing to queue successors, approval-gated successors, or another local workflow.
  • Bind routing evidence to the producing run attempt and extend queue replay and assignments for continuations and approvals.
  • Add request analytics, schemas, documentation, tests, and advisory adoption in three workflows.
File Description
specs/​work-queue/​WorkQueueV4.tla Model atomic continuation successors.
specs/​work-queue/​README.md Document successor-bearing finish commits.
schemas/​logs.schema.json Add continuation reports and totals.
schemas/​logs-jsonl.schema.json Add continuation fields to JSONL reports.
schemas/​audit.schema.json Add audit continuation evidence fields.
pkg/​workqueue/​types.go Define continuation and approver data.
pkg/​workqueue/​selection.go Include continuation context in assignments.
pkg/​workqueue/​request.go Permit successor Work in finish requests.
pkg/​workqueue/​replay.go Validate successors and approval evidence.
pkg/​workqueue/​lifecycle.go Require approval before claiming gated Work.
pkg/​workflow/​work_queue_repo_config.go Detect dispatcher approval-read needs.
pkg/​workflow/​work_queue_memory.go Reserve the continuation tool name.
pkg/​workflow/​unified_prompt_step.go Include continuation tools and route guidance.
pkg/​workflow/​safe_outputs_validation_config.go Register continuation message validation.
pkg/​workflow/​safe_outputs_tools.go Classify continuation as an internal tool.
pkg/​workflow/​safe_outputs_tools_computation.go Include enabled continuation tools.
pkg/​workflow/​safe_outputs_state.go Recognize routed continuation processing.
pkg/​workflow/​safe_outputs_permissions.go Add routing and approval-read permissions.
pkg/​workflow/​safe_outputs_max_validation.go Validate bounded request limits.
pkg/​workflow/​safe_outputs_max_validation_test.go Cover continuation limit rules.
pkg/​workflow/​safe_outputs_handler_registry_test.go Verify continuation handler registration.
pkg/​workflow/​safe_outputs_handler_registry_diagnostics.go Generate trusted route descriptors.
pkg/​workflow/​safe_outputs_config_types.go Add continuation configuration fields.
pkg/​workflow/​safe_outputs_config_generation.go Strip trusted routing details from agent configuration.
pkg/​workflow/​safe_outputs_config_extraction.go Parse continuation configuration.
pkg/​workflow/​safe_outputs_authorization.go Classify routing and admission authorization.
pkg/​workflow/​safe_output_handlers.go Register the continuation safe output.
pkg/​workflow/​request_continuation_test.go Test advisory configuration and compilation.
pkg/​workflow/​prompt_constants.go Name route-specific prompt fragments.
pkg/​workflow/​notify_comment.go Add conclusion request recording.
pkg/​workflow/​notify_comment_conclusion_helpers.go Generate the request-recording step.
pkg/​workflow/​js/​safe_outputs_tools.json Define the embedded continuation tool.
pkg/​workflow/​compiler.go Invoke continuation route validation.
pkg/​workflow/​compiler_yaml_post_agent.go Bind evidence before artifact uploads.
pkg/​workflow/​compiler_validators.go Validate continuation authorization settings.
pkg/​workflow/​compiler_safe_outputs_steps.go Pass routing evidence to trusted processing.
pkg/​workflow/​compiler_safe_outputs_job.go Configure routed processing and queue finalization.
pkg/​workflow/​compiler_main_job_helpers.go Expose continuation evidence as a job output.
pkg/​workflow/​authorization_inventory.go Report queue admission authorization.
pkg/​parser/​schemas/​main_workflow_schema.json Define continuation configuration and constraints.
pkg/​parser/​schema_request_continuation_test.go Test advisory and routed schema rules.
pkg/​cli/​outcome_eval.go Exclude request intent from adoption evaluation.
pkg/​cli/​outcome_eval_test.go Test request exclusion from outcomes.
pkg/​cli/​mcp_tools_privileged.go Describe continuation evidence in logs responses.
pkg/​cli/​mcp_tools_health.go Describe cached continuation health metrics.
pkg/​cli/​logs_run_summary.go Persist requests in run summaries.
pkg/​cli/​logs_run_cache.go Validate and backfill cached request evidence.
pkg/​cli/​logs_run_cache_test.go Test prior-attempt artifact invalidation.
pkg/​cli/​logs_run_analysis.go Extract continuation requests during analysis.
pkg/​cli/​logs_orchestrator_filters.go Carry requests into processed runs.
pkg/​cli/​logs_models.go Add request reports and provenance.
pkg/​cli/​logs_metrics.go Extract requests and distinguish unavailable evidence.
pkg/​cli/​logs_format_tsv.go Render continuation summary totals.
pkg/​cli/​logs_format_compact.go Render request details and availability totals.
pkg/​cli/​logs_episode_retrieval_artifacts.go Collect and deduplicate episode requests.
pkg/​cli/​logs_cached_json.go Backfill cached requests and audit counts.
pkg/​cli/​health_revisions.go Apply continuation metrics to current health.
pkg/​cli/​health_metrics.go Add continuation health reports.
pkg/​cli/​health_durable.go Include requests in session-evidence rendering.
pkg/​cli/​health_continuation_requests.go Summarize cached requests and unavailable runs.
pkg/​cli/​drain3_integration.go Convert requests into analysis events.
pkg/​cli/​continuation_requests.go Share counting, invalidation, merging, and rendering helpers.
pkg/​cli/​authorization_verify.go Recognize queue authorization coverage.
pkg/​cli/​audit.go Carry continuation analysis results.
pkg/​cli/​audit_summary_build.go Include requests in audit summaries.
pkg/​cli/​audit_run_pipeline.go Backfill requests and invalidate artifact markers.
pkg/​cli/​audit_run_pipeline_detection_test.go Test cached agent-output lookup behavior.
pkg/​cli/​audit_report.go Include requests in assembled audit data.
pkg/​cli/​audit_report_types.go Add structured audit request reports.
pkg/​cli/​audit_report_render.go Render requests and evidence availability.
pkg/​cli/​audit_render_output.go Merge request evidence into audit caches.
pkg/​cli/​audit_expanded.go Add session continuation request counts.
pkg/​cli/​audit_cache.go Refresh cached audit request evidence.
pkg/​cli/​audit_analysis_fanout.go Run continuation extraction alongside other analyses.
docs/​src/​content/​docs/​reference/​safe-outputs.md Document routes, limits, permissions, and analytics.
docs/​adr/​79834-opt-in-request-continuation-signal.md Record the advisory signal’s original design.
actions/​setup/​setup.sh Deploy continuation runtime modules to bundles.
actions/​setup/​session_parsers.go Embed continuation runtime dependencies.
actions/​setup/​md/​safe_outputs_request_continuation_queue.md Explain queue handoffs and untrusted context.
actions/​setup/​md/​safe_outputs_request_continuation_dispatch.md Explain bounded dispatch handoffs.
actions/​setup/​js/​work_queue_scheduler.cjs Attach continuation context to assignments.
actions/​setup/​js/​work_queue_replay.cjs Enforce successor and approval replay rules.
actions/​setup/​js/​work_queue_replay_v4.test.cjs Test atomic successors and replay protection.
actions/​setup/​js/​work_queue_mcp_server.test.cjs Test successor context visibility.
actions/​setup/​js/​work_queue_mcp_server.cjs Expose continuation context beside payloads.
actions/​setup/​js/​work_queue_graph.test.cjs Test inheritance, budgets, and approval structure.
actions/​setup/​js/​work_queue_dispatch.test.cjs Test approval permission-read budgeting.
actions/​setup/​js/​work_queue_dispatch.cjs Refresh approvals and pair them with Claims.
actions/​setup/​js/​work_queue_dependency_resolver.test.cjs Test closer identity, roles, and approval states.
actions/​setup/​js/​work_queue_dependency_resolver.cjs Resolve writer-approved Issue dependencies.
actions/​setup/​js/​work_queue_control_adapter.cjs Expose scoped collaborator permission reads.
actions/​setup/​js/​work_queue_conformance_fixture_generator.cjs Generate continuation and approval fixtures.
actions/​setup/​js/​work_queue_conformance_checks.cjs Check continuation replay and checkpoints.
actions/​setup/​js/​work_queue_claim_scope.test.cjs Test assignment continuation validation.
actions/​setup/​js/​work_queue_claim_scope.cjs Validate continuation members in assignments.
actions/​setup/​js/​types/​safe-outputs.d.ts Add the continuation item type.
actions/​setup/​js/​safeoutputs_cli.cjs Classify requests as non-terminal diagnostics.
actions/​setup/​js/​safe_outputs_tools.json Define the runtime continuation tool.
actions/​setup/​js/​safe_output_submission.test.cjs Test continuation dependency restrictions.
actions/​setup/​js/​safe_output_submission.cjs Reject request dependency participation.
actions/​setup/​js/​safe_output_manifest.cjs Exclude continuation requests from mutation manifests.
actions/​setup/​js/​request_continuation_handler.test.cjs Test advisory handling and route validation.
actions/​setup/​js/​request_continuation_handler.cjs Process advisory and routed requests.
actions/​setup/​js/​record_request_continuation.test.cjs Test timestamp recording without routing.
actions/​setup/​js/​record_request_continuation.cjs Record trusted request timestamps.
actions/​setup/​js/​pi_tool_policy.cjs Reserve continuation reporting for the parent agent.
actions/​setup/​js/​log_parser_shared.test.cjs Test request preview rendering.
actions/​setup/​js/​load_agent_output.cjs Classify requests as diagnostic output.
actions/​setup/​js/​handle_noop_message.test.cjs Test request-aware no-op classification.
actions/​setup/​js/​handle_noop_message.cjs Keep requests separate from task mutations.
actions/​setup/​js/​handle_agent_failure.test.cjs Test requests without completion evidence.
actions/​setup/​js/​handle_agent_failure.cjs Avoid treating request intent as completed work.
actions/​setup/​js/​finish_work_queue_claim.test.cjs Test successor ordering, receipts, and pending limits.
actions/​setup/​js/​create_prompt.cjs Render inbound continuation input as untrusted data.
actions/​setup/​js/​collect_ndjson_output.test.cjs Test timestamps and routed request rejection.
actions/​setup/​js/​collect_ndjson_output.cjs Validate routed requests and stamp timestamps.
actions/​setup/​js/​check_permissions_utils.cjs Extract reusable repository-role matching.
actions/​setup/​js/​bind_continuation_evidence.test.cjs Test digest binding and file rejection.
actions/​setup/​js/​bind_continuation_evidence.cjs Hash final output with run-attempt identity.
.github/​workflows/​spec-extractor.md Enable advisory extraction follow-up requests.
.github/​workflows/​pr-sous-chef.lock.yml Refresh shared validation registry only.
.github/​workflows/​mattpocock-skills-reviewer.md Enable advisory review follow-up requests.
.github/​workflows/​contribution-check.md Enable advisory evaluation follow-up requests.
.changeset/​minor-request-continuation-routes.md Describe routing and ledger compatibility requirements.

Review effort: Max (adaptive)

Comment on lines +27 to +28
// Do not echo potentially sensitive agent content into Actions logs.
core.info("request_continuation: follow-up requested; continuation not confirmed");
if (canonical(operation) !== canonical(continuationChild(parent, continuation, approval))) throw invalid("a continuation must inherit exactly from its parent");
// An automatic hop spends one unit of its parent's budget; a zero balance cannot hand off.
if (continuation.route === "workqueue" && parent.continuation && continuation.remaining >= parent.continuation.remaining) throw invalid("an automatic continuation must decrease its remaining budget");
validateGraphAdmission(state, [operation]);
}

func processedRunFromSummary(summary *RunSummary, runOutputDir string) ProcessedRun {
backfillContinuationRequests(&summary.ContinuationRequests, summary.Run, runOutputDir, false)
Comment thread pkg/cli/logs_run_cache.go Outdated
if !ok || workQueueLogsMissing(params.includeWorkQueue, runOutputDir) {
return nil, false
}
if continuationEvidenceIdentityChanged(summary.Run, run) {
return { route, max_depth: maxDepth, aw_context: false };
}
const file = descriptor.workflow_file;
if (typeof file !== "string" || !/^[A-Za-z0-9_.-]+\.(?:lock\.yml|yml)$/.test(file) || file.startsWith(".")) throw routeError("continuation_config_invalid", "dispatch requires a compiled local workflow_file");
const { matchRepositoryRole, resolveRepositoryRole } = require("./check_permissions_utils.cjs");

const COMMIT_SHA = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
const LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/;
Comment on lines +165 to +167
if (state.observations.get(key)?.state !== "ready" && !edges.has(key)) {
edges.set(key, edge);
if (edge.condition === "approved") approvals++;
Comment on lines +348 to +353
for _, artifact := range []string{constants.AgentArtifactName.String(), constants.AgentOutputFallbackArtifactName.String()} {
markerPath := filepath.Join(runOutputDir, downloadedArtifactsMarkerDir, artifact)
if err := os.Remove(markerPath); err != nil && !errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("failed to invalidate %s download marker: %w", artifact, err)
}
}
Comment on lines +100 to +102
if auditData == nil || requests == nil {
return false
}
Comment on lines +132 to +135
if route == RequestContinuationRouteIssue {
workQueueRepoConfigLog.Printf("Worker %s uses issue-gated continuations; dispatcher reads approval Issues", worker)
data.SafeOutputs.workQueueApprovalReads = true
return nil
…val issues or dispatch

- Opt-in safe-outputs.request-continuation.route: workqueue (finish commit appends one
  successor Work), issue (successor gated on an approval issue closed as completed by a
  writer) or dispatch (named local workflow with a bounded gh_aw_continuation input).
- continuation_evidence binds routed requests to the producing run attempt.
- v4 ledger: optional Work continuation, finish-carried successor Work, Issue condition
  approved, Observation approved_by; JS/Go replay, TLA model and canonical fixtures.
- Trusted finish step loads safe_output_authorization.cjs by non-literal path so the MCP
  and safe-outputs bundles never deploy a module that calls core.setSecret.
@elefthei
elefthei force-pushed the work-queue-v4-timeless branch from 0810fb3 to 8cd94e7 Compare November 23, 2026 03:30
@elefthei
elefthei force-pushed the request-continuation-routes branch from e9acf9b to 8433f57 Compare November 23, 2026 03:30
@elefthei
elefthei merged commit 0414cf3 into work-queue-v4-timeless Nov 23, 2026
@elefthei
elefthei deleted the request-continuation-routes branch November 23, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants