@webpieces/agent-workflow-rules 0.4.849 → 0.4.850

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,3 +22,27 @@ The public source and guard hooks keep their existing binary names. Import share
22
22
  The committed dispatcher is upgraded from the installed published release; this extraction does not regenerate it from unreleased source.
23
23
 
24
24
  This pack owns its concrete policy schemas, mode enums, optional tuning, and reviewed seeds. Workflow rule/field retirements and keyless safeguard metadata are published by the workflow owner.
25
+
26
+ ## Reviewer submissions from linked worktrees
27
+
28
+ The guards hook writes the one-use reviewer identity stamp in the command's effective tree,
29
+ using the same leading `cd`/`pushd` resolver as the Bash guards. Session and agent identity
30
+ still come from the genuine hook payload. Submit with a literal absolute path:
31
+
32
+ ```sh
33
+ cd '/absolute/reviewed-worktree' && pnpm wp-write-review --checklist checklist-id --file /absolute/verdict.json
34
+ ```
35
+
36
+ A native Codex CLI 0.160.0 capture on 2026-10-03 showed that `exec_command` with
37
+ `cmd: "pwd"` and `workdir: "/private/tmp/wp-1105-probe/target"` executes in the target,
38
+ but PreToolUse receives `cwd: "/private/tmp/wp-1105-probe/session"` and
39
+ `tool_input: {"command": "pwd"}`. The execution workdir is absent. The captured envelope
40
+ is in `src/adapters/__fixtures__/codex-workdir-pre-tool-use.json`. `workdir` alone cannot
41
+ route a stamp; use the leading `cd` form even when also setting the tool's `workdir`.
42
+ [Official hook documentation](https://learn.chatgpt.com/docs/hooks) likewise defines
43
+ `cwd` as the session directory and normalizes unified exec to `Bash`.
44
+
45
+ On a missing/expired stamp, `wp-write-review` names the submission cwd and expected
46
+ worktree stamp path. Check hook delivery and tree selection before reinstalling hooks.
47
+ Never copy stamps between trees or substitute coordinator identity. This source change
48
+ takes effect in consumers after publication and upgrade of `@webpieces/agent-workflow-rules`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/agent-workflow-rules",
3
- "version": "0.4.849",
3
+ "version": "0.4.850",
4
4
  "description": "Independent workflow guards, guard hook, installation and shim management for AI coding agents.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -24,20 +24,20 @@
24
24
  "directory": "packages/tooling/agent-workflow-rules"
25
25
  },
26
26
  "dependencies": {
27
- "@webpieces/hook-runtime": "0.4.849",
28
- "@webpieces/rules-config": "0.4.849",
27
+ "@webpieces/hook-runtime": "0.4.850",
28
+ "@webpieces/rules-config": "0.4.850",
29
29
  "inversify": "7.10.4",
30
30
  "reflect-metadata": "0.2.2",
31
- "@webpieces/tooling-common": "0.4.849",
32
- "@webpieces/repo-workflow-core": "0.4.849",
31
+ "@webpieces/tooling-common": "0.4.850",
32
+ "@webpieces/repo-workflow-core": "0.4.850",
33
33
  "tslib": "2.8.1",
34
- "@webpieces/rules-sdk": "0.4.849"
34
+ "@webpieces/rules-sdk": "0.4.850"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
39
  "devDependencies": {
40
- "@webpieces/tooling-testkit": "0.4.849"
40
+ "@webpieces/tooling-testkit": "0.4.850"
41
41
  },
42
42
  "types": "./src/index.d.ts",
43
43
  "bin": {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReviewIdentityStamper = void 0;
4
4
  const repo_workflow_core_1 = require("@webpieces/repo-workflow-core");
5
+ const hook_runtime_1 = require("@webpieces/hook-runtime");
5
6
  /**
6
7
  * Tells `pnpm wp-write-review` WHO invoked it (issue #863).
7
8
  *
@@ -24,9 +25,11 @@ class ReviewIdentityStamper {
24
25
  const checklists = this.stamps.invokedChecklists(command);
25
26
  if (checklists.length === 0)
26
27
  return;
28
+ // Match the Bash guards: payload cwd is the session directory, before any leading cd.
29
+ const commandCwd = new hook_runtime_1.EffectiveTreeResolver().effectiveCwd(command, cwd);
27
30
  const now = new Date().toISOString();
28
31
  for (const checklistId of checklists) {
29
- this.stamps.write(cwd, new repo_workflow_core_1.ReviewIdentityStamp(checklistId, event.aiType, event.sessionId, event.agentId, event.agentType, cwd, now));
32
+ this.stamps.write(commandCwd, new repo_workflow_core_1.ReviewIdentityStamp(checklistId, event.aiType, event.sessionId, event.agentId, event.agentType, commandCwd, now));
30
33
  }
31
34
  }
32
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"review-identity-stamper.js","sourceRoot":"","sources":["../../../../../../packages/tooling/agent-workflow-rules/src/adapters/review-identity-stamper.ts"],"names":[],"mappings":";;;AAAA,sEAAsH;AAItH;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAqB;IACD;IAA7B,YAA6B,SAAqC,yCAAoB;QAAzD,WAAM,GAAN,MAAM,CAAmD;IAAG,CAAC;IAE1F,KAAK,CAAC,KAAqB,EAAE,OAAe,EAAE,GAAW;QACrD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QACpC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,MAAM,WAAW,IAAI,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,wCAAmB,CAC1C,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAC/F,CAAC;IACL,CAAC;CACJ;AAZD,sDAYC","sourcesContent":["import { ReviewIdentityStamp, ReviewIdentityStampService, reviewIdentityStamps } from '@webpieces/repo-workflow-core';\n\nimport { AgentHookEvent } from '@webpieces/hook-runtime';\n\n/**\n * Tells `pnpm wp-write-review` WHO invoked it (issue #863).\n *\n * The bin runs inside the Bash call, and a Bash child sees only its environment — which in neither harness\n * distinguishes a reviewer subagent from its coordinator (see ReviewIdentityStamp for the detail). This\n * hook, by contrast, is handed the harness's own `agent_id` for the very call that is about to run the bin.\n * So for every checklist a command submits, it writes one stamp the bin consumes a moment later. The bin\n * then REFUSES a stamp that names the coordinating agent — closing the forgery path a Codex coordinator\n * took on two merged PRs — and records the subagent's identity in the verdict's provenance.\n *\n * Called ONLY for a Bash call the guards have already ALLOWED: a denied command never runs the bin, and a\n * stamp it left behind would be an identity waiting to be borrowed.\n */\nexport class ReviewIdentityStamper {\n constructor(private readonly stamps: ReviewIdentityStampService = reviewIdentityStamps) {}\n\n stamp(event: AgentHookEvent, command: string, cwd: string): void {\n const checklists = this.stamps.invokedChecklists(command);\n if (checklists.length === 0) return;\n const now = new Date().toISOString();\n for (const checklistId of checklists) {\n this.stamps.write(cwd, new ReviewIdentityStamp(\n checklistId, event.aiType, event.sessionId, event.agentId, event.agentType, cwd, now));\n }\n }\n}\n"]}
1
+ {"version":3,"file":"review-identity-stamper.js","sourceRoot":"","sources":["../../../../../../packages/tooling/agent-workflow-rules/src/adapters/review-identity-stamper.ts"],"names":[],"mappings":";;;AAAA,sEAAsH;AAEtH,0DAAgF;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAqB;IACD;IAA7B,YAA6B,SAAqC,yCAAoB;QAAzD,WAAM,GAAN,MAAM,CAAmD;IAAG,CAAC;IAE1F,KAAK,CAAC,KAAqB,EAAE,OAAe,EAAE,GAAW;QACrD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QACpC,sFAAsF;QACtF,MAAM,UAAU,GAAG,IAAI,oCAAqB,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1E,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,MAAM,WAAW,IAAI,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,wCAAmB,CACjD,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;QACtG,CAAC;IACL,CAAC;CACJ;AAdD,sDAcC","sourcesContent":["import { ReviewIdentityStamp, ReviewIdentityStampService, reviewIdentityStamps } from '@webpieces/repo-workflow-core';\n\nimport { AgentHookEvent, EffectiveTreeResolver } from '@webpieces/hook-runtime';\n\n/**\n * Tells `pnpm wp-write-review` WHO invoked it (issue #863).\n *\n * The bin runs inside the Bash call, and a Bash child sees only its environment — which in neither harness\n * distinguishes a reviewer subagent from its coordinator (see ReviewIdentityStamp for the detail). This\n * hook, by contrast, is handed the harness's own `agent_id` for the very call that is about to run the bin.\n * So for every checklist a command submits, it writes one stamp the bin consumes a moment later. The bin\n * then REFUSES a stamp that names the coordinating agent — closing the forgery path a Codex coordinator\n * took on two merged PRs — and records the subagent's identity in the verdict's provenance.\n *\n * Called ONLY for a Bash call the guards have already ALLOWED: a denied command never runs the bin, and a\n * stamp it left behind would be an identity waiting to be borrowed.\n */\nexport class ReviewIdentityStamper {\n constructor(private readonly stamps: ReviewIdentityStampService = reviewIdentityStamps) {}\n\n stamp(event: AgentHookEvent, command: string, cwd: string): void {\n const checklists = this.stamps.invokedChecklists(command);\n if (checklists.length === 0) return;\n // Match the Bash guards: payload cwd is the session directory, before any leading cd.\n const commandCwd = new EffectiveTreeResolver().effectiveCwd(command, cwd);\n const now = new Date().toISOString();\n for (const checklistId of checklists) {\n this.stamps.write(commandCwd, new ReviewIdentityStamp(\n checklistId, event.aiType, event.sessionId, event.agentId, event.agentType, commandCwd, now));\n }\n }\n}\n"]}