鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

temporary-id-safe-output

为工作流中的安全输出任务提供临时 ID 支持,使代理能在同一运行中引用尚未生成正式编号的新建问题,通过 aw_ 前缀加 12 位十六进制字符串实现占位与动态解析,并确保在创建与关联操作间自动映射、容错处理且不暴露敏感信息。

开发运维
访问 GitHub
文档Skills.MD
name
temporary-id-safe-output
description
Plan for adding temporary ID support to safe output jobs

Adding Temporary ID Support to Safe Output Jobs

This document outlines the implementation plan for adding temporary ID support to safe output jobs. Temporary IDs allow agents to reference newly created issues within the same workflow run before they have actual GitHub issue numbers.

Problem Statement

When an agent needs to create a parent issue and immediately link sub-issues to it in the same workflow run, the agent doesn't know the actual issue number until the create_issue job completes. Temporary IDs bridge this gap by allowing the agent to use placeholder IDs that are resolved to actual issue numbers at execution time.

Temporary ID Format

Temporary IDs follow the pattern aw_XXXXXXXXXXXX where:

  • aw_ is a fixed prefix identifying agentic workflow temporary IDs
  • XXXXXXXXXXXX is a 12-character lowercase hexadecimal string (6 random bytes)

Example: aw_abc123def456

Implementation Components

1. Shared Module: temporary_id.cjs

Location: pkg/workflow/js/temporary_id.cjs

This module provides shared utilities for temporary ID handling:

▼
javascript
复制代码
// Core functions generateTemporaryId() // Generate new temporary ID isTemporaryId(value) // Check if value is a temporary ID normalizeTemporaryId(tempId) // Normalize to lowercase for map lookups loadTemporaryIdMap() // Load map from GH_AW_TEMPORARY_ID_MAP env var resolveIssueNumber(value, map) // Resolve value to issue number (supports temp IDs) replaceTemporaryIdReferences(text, map) // Replace #aw_XXX references in text

2. Producer Job: create_issue

The create_issue job outputs a temporary ID map that other jobs can consume:

Go changes (pkg/workflow/create_issue.go):

  • No changes needed - already outputs temporary_id_map

JavaScript changes (pkg/workflow/js/create_issue.cjs):

  • Generate temporary ID for each created issue
  • Build map of temporary_id -> issue_number
  • Output map via core.setOutput("temporary_id_map", JSON.stringify(map))

3. Consumer Job: Adding Temporary ID Support

For each safe output job that needs to resolve temporary IDs:

Step 1: Update Go Job Builder

In pkg/workflow/<job_name>.go:

  1. Add createIssueJobName parameter to the build function:
▼
go
复制代码
func (c *Compiler) build<JobName>Job(data *WorkflowData, mainJobName string, createIssueJobName string) (*Job, error) {
  1. Add environment variable to pass the temporary ID map:
▼
go
复制代码
if createIssueJobName != "" { customEnvVars = append(customEnvVars, fmt.Sprintf(" GH_AW_TEMPORARY_ID_MAP: ${{ needs.%s.outputs.temporary_id_map }}\n", createIssueJobName)) }
  1. Add create_issue to the job's needs array:
▼
go
复制代码
needs := []string{mainJobName} if createIssueJobName != "" { needs = append(needs, createIssueJobName) }
  1. Update the SafeOutputJobConfig to use the dynamic needs:
▼
go
复制代码
return c.buildSafeOutputJob(data, SafeOutputJobConfig{ // ... Needs: needs, // ... })

Step 2: Update Compiler Jobs

In pkg/workflow/compiler_jobs.go:

Pass the createIssueJobName when building the job:

▼
go
复制代码
job, err := c.build<JobName>Job(data, mainJobName, createIssueJobName)

Step 3: Update JavaScript Script

In pkg/workflow/js/<job_name>.cjs:

  1. Import the temporary ID utilities:
▼
javascript
复制代码
const { loadTemporaryIdMap, resolveIssueNumber } = require("./temporary_id.cjs");
  1. Load the temporary ID map at the start of main():
▼
javascript
复制代码
const temporaryIdMap = loadTemporaryIdMap(); if (temporaryIdMap.size > 0) { core.info(`Loaded temporary ID map with ${temporaryIdMap.size} entries`); }
  1. Use resolveIssueNumber() to resolve issue numbers:
▼
javascript
复制代码
const resolved = resolveIssueNumber(item.issue_number, temporaryIdMap); if (resolved.errorMessage) { core.warning(`Failed to resolve issue: ${resolved.errorMessage}`); continue; } const issueNumber = resolved.resolved; if (resolved.wasTemporaryId) { core.info(`Resolved temporary ID '${item.issue_number}' to issue #${issueNumber}`); }

Step 4: Update Agent Ingestion Validation

In pkg/workflow/js/collect_ndjson_output.cjs:

Add validation for fields that accept temporary IDs:

▼
javascript
复制代码
function isValidIssueNumberOrTemporaryId(value) { if (typeof value === "number" && Number.isInteger(value) && value > 0) { return true; } if (typeof value === "string" && /^aw_[0-9a-f]{12}$/i.test(value)) { return true; } return false; }

Use this validation for fields like parent_issue_number, sub_issue_number, etc.

4. Failure Handling

When temporary ID resolution fails, the job should:

  • Log a warning with core.warning() instead of failing with core.setFailed()
  • Continue processing other items
  • Include failures in the step summary
  • Complete successfully with warnings

This ensures that:

  • Partial success is possible (some links may work while others fail)
  • The workflow doesn't fail catastrophically due to a single resolution failure
  • Users can review warnings in the step summary

Example Usage

Workflow Configuration

▼
yaml
复制代码
safe-outputs: create-issue: title-prefix: "[Parent] " labels: [tracking] max: 3 link-sub-issue: max: 10

Agent Output

▼
json
复制代码
{"type": "create_issue", "temporary_id": "aw_abc123def456", "title": "Parent: Feature X", "body": "..."} {"type": "link_sub_issue", "parent_issue_number": "aw_abc123def456", "sub_issue_number": 42} {"type": "link_sub_issue", "parent_issue_number": "aw_abc123def456", "sub_issue_number": 43}

Execution Flow

  1. main job: Agent generates output with temporary ID aw_abc123def456
  2. create_issue job: Creates issue #100, outputs {"aw_abc123def456": 100}
  3. link_sub_issue job:
    • Loads temporary ID map
    • Resolves aw_abc123def456 → 100
    • Links issues #42 and #43 as sub-issues of #100

Jobs That Support Temporary IDs

JobField(s)Status
link_sub_issueparent_issue_number, sub_issue_number✅ Implemented
add_commentissue_number (via text replacement)✅ Implemented
update_issueissue_number🔄 Can be added
close_pull_request-N/A (uses PR numbers)

Testing

Unit Tests

Add tests in pkg/workflow/js/temporary_id.test.cjs for:

  • isTemporaryId() with valid and invalid inputs
  • resolveIssueNumber() with temporary IDs and regular numbers
  • loadTemporaryIdMap() with various JSON inputs

Integration Tests

Add tests in pkg/workflow/<job_name>_dependencies_test.go to verify:

  • Job includes create_issue in needs when configured
  • GH_AW_TEMPORARY_ID_MAP env var is set correctly
  • Job works without create_issue dependency

Security Considerations

  1. Temporary IDs are only valid within a single workflow run
  2. The map is passed via environment variables (not exposed externally)
  3. Agents cannot forge temporary IDs to reference issues from other workflows
  4. Resolution failures are logged but don't expose the temporary ID map contents

Checklist for Adding Support to a New Job

  • Update Go job builder to accept createIssueJobName parameter
  • Add GH_AW_TEMPORARY_ID_MAP environment variable
  • Update needs array to include create_issue conditionally
  • Update compiler_jobs.go to pass createIssueJobName
  • Import temporary ID utilities in JavaScript script
  • Use resolveIssueNumber() for issue number fields
  • Update validation in collect_ndjson_output.cjs if needed
  • Add unit tests for the resolution logic
  • Add integration tests for job dependencies
  • Update documentation
开发运维

快捷安装

复制到终端去安装 Skill

npxskillsaddgithubnext/gh-aw--skill"temporary-id-safe-output"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
retrieving-developer-knowledge
retrieving-developer-knowledge 用于搜索、获取和整合 Google 官方开发者文档,覆盖 Google Cloud、AI/Gemini、Android、Chrome、Web、Flutter、Go、Firebase 等平台,适用于查询 gcloud CLI 命令、API 语法、IAM 权限或架构对比等场景。
diff-intake
diff-intake 读取 PR 或分支差异,生成结构化 YAML 变更摘要,用于下游 analytics instrumentation 技能。适用于用户提交 PR 链接、分支对比或原始 diff 后需理解变更内容、评估分析覆盖或启动埋点流程的场景。
load-balancer-configurator
根据用户需求自动生成各类负载均衡器的生产级配置,覆盖 ALB、NLB、Nginx 和 HAProxy 等主流类型,适配不同协议、端口、健康检查及后端服务拓扑,支持直接集成到基础设施即代码流程中。
implement
实现 Linus Dashboard 的功能开发与集成,基于 TypeScript 和 Python 构建前后端组件,遵循严格的代码规范与架构模式,完成视图、卡片、服务及传感器等模块的创建与验证,确保高质量交付并兼容 Home Assistant 生态。
cloud-scheduler-job-creator
自动处理 Google Cloud Platform 中的云调度任务创建,提供符合最佳实践的配置方案与生产级代码生成,支持计算、存储、大数据及机器学习服务的集成部署。