harness-everything 0.57.3 → 0.57.4
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +9 -0
- package/ci/action-gate.test.js +162 -0
- package/ci/mechanism-2aa-codex-action-gate-policy.test.js +37 -0
- package/docs/codex-action-gate.md +2 -0
- package/hooks/scripts/action-gate.js +71 -5
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/hooks/scripts/action-gate.js +71 -5
- package/plugins/harness-everything/plugin.json +1 -1
- package/sbom.cdx.json +7 -7
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"name": "harness-everything",
|
|
11
11
|
"source": "./",
|
|
12
12
|
"description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
|
|
13
|
-
"version": "0.57.
|
|
13
|
+
"version": "0.57.4",
|
|
14
14
|
"author": {
|
|
15
15
|
"name": "Miya Daniel"
|
|
16
16
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harness-everything",
|
|
3
3
|
"description": "Harness OS: an orchestrated agent operating system — tier routing, circuit breaker guardrails, verification gates, WAL session memory, and self-evolving workspace rules.",
|
|
4
|
-
"version": "0.57.
|
|
4
|
+
"version": "0.57.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Miya Daniel"
|
|
7
7
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.57.4](https://github.com/dyphn1/Harness-everything/compare/v0.57.3...v0.57.4) (2026-11-22)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **action-gate:** defer routine codex issue comments and completed closes ([6cdbb10](https://github.com/dyphn1/Harness-everything/commit/6cdbb108aa5c5d565abe04f9d4bf2dfd1b264448)), closes [#508](https://github.com/dyphn1/Harness-everything/issues/508)
|
|
10
|
+
* **action-gate:** keep ownerless issue repository selectors gated ([a82d2a8](https://github.com/dyphn1/Harness-everything/commit/a82d2a81787600bb96c19bdb606f6af482ee6421))
|
|
11
|
+
|
|
5
12
|
## [0.57.3](https://github.com/dyphn1/Harness-everything/compare/v0.57.2...v0.57.3) (2026-11-22)
|
|
6
13
|
|
|
7
14
|
### Bug Fixes
|
|
@@ -190,6 +197,8 @@ All notable changes to this project are documented in this file.
|
|
|
190
197
|
|
|
191
198
|
## [Unreleased]
|
|
192
199
|
|
|
200
|
+
- Codex defers exact Issue comments and completed closes to native host permissions (#508).
|
|
201
|
+
|
|
193
202
|
- OpenCode V2: accept the live `shell` tool name alongside `bash` for ledger lesson injection and turn observations, with live-shape mechanism rows (#509).
|
|
194
203
|
|
|
195
204
|
- Error-ledger lesson injection (#394): ledger records gain optional `match` rules; a shared matcher carries matched Cue/Lesson text into Claude Code, Codex and OpenCode V2 context at a `git commit` action and its commitlint failure (mechanism evidence; OpenCode V1 delivery unchecked). ROUTE-001 is superseded.
|
package/ci/action-gate.test.js
CHANGED
|
@@ -438,6 +438,168 @@ try {
|
|
|
438
438
|
check(actionGate.evaluatePreToolUse(creation, { host: 'codex', sessionDir, ruleTable: table }).kind === 'block', 'PR creation still honors the documented explicit required gate');
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
+
const issueCommentTools = [
|
|
442
|
+
'mcp__codex_apps__github__add_comment_to_issue',
|
|
443
|
+
'mcp__codex_apps__github_add_comment_to_issue',
|
|
444
|
+
];
|
|
445
|
+
const issueCompletedCloseTools = [
|
|
446
|
+
'mcp__codex_apps__github__update_issue',
|
|
447
|
+
'mcp__codex_apps__github_update_issue',
|
|
448
|
+
];
|
|
449
|
+
const issueCommentInput = { repo_full_name: 'dyphn1/Harness-everything', pr_number: 502, comment: 'routine fixture comment' };
|
|
450
|
+
const issueCloseInput = { repository_full_name: 'dyphn1/Harness-everything', issue_number: 502, state: 'closed', state_reason: 'completed' };
|
|
451
|
+
const issuePayload = (tool, input, id, extra = {}) => ({
|
|
452
|
+
...payload('', { tool, toolUseId: id }),
|
|
453
|
+
tool_name: tool,
|
|
454
|
+
tool_input: input,
|
|
455
|
+
...extra,
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
for (const [tools, input, id, expectedRule, operation] of [
|
|
459
|
+
[issueCommentTools, issueCommentInput, 'issue-comment-positive', 'routine-issue-comment', 'Issue comment'],
|
|
460
|
+
[issueCompletedCloseTools, issueCloseInput, 'issue-close-positive', 'routine-issue-completed-close', 'Issue completed-close'],
|
|
461
|
+
]) {
|
|
462
|
+
for (const tool of tools) {
|
|
463
|
+
const candidate = issuePayload(tool, input, id + '-' + tools.indexOf(tool));
|
|
464
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
465
|
+
check(result.kind === 'allow' && result.exitCode === 0 && result.stdout === null, operation + ' exact Codex tool defers to host');
|
|
466
|
+
check(result.record && result.record.disposition === 'deferred-to-host' && result.record.matchedRule === expectedRule, operation + ' records its distinct host-deferred id');
|
|
467
|
+
const descriptor = result.descriptor || (result.record && result.record.actionDescriptor);
|
|
468
|
+
check(descriptor && descriptor.action === 'mutate' && descriptor.classification === 'gated', operation + ' remains a gated mutation');
|
|
469
|
+
check(!Object.prototype.hasOwnProperty.call(result, 'permissionDecision'), operation + ' emits no Harness permission decision');
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
const issueInvalidInputs = [
|
|
474
|
+
['comment null arguments', issueCommentTools[0], null],
|
|
475
|
+
['comment missing repo selector', issueCommentTools[0], { pr_number: 502, comment: 'comment' }],
|
|
476
|
+
['comment empty repo selector', issueCommentTools[0], { ...issueCommentInput, repo_full_name: ' ' }],
|
|
477
|
+
['comment ownerless repo selector', issueCommentTools[0], { ...issueCommentInput, repo_full_name: 'repo-only' }],
|
|
478
|
+
['comment wrong repo selector type', issueCommentTools[0], { ...issueCommentInput, repo_full_name: 502 }],
|
|
479
|
+
['comment invalid issue selector', issueCommentTools[0], { ...issueCommentInput, pr_number: 0 }],
|
|
480
|
+
['comment fractional issue selector', issueCommentTools[0], { ...issueCommentInput, pr_number: 1.5 }],
|
|
481
|
+
['comment string issue selector', issueCommentTools[0], { ...issueCommentInput, pr_number: '502' }],
|
|
482
|
+
['comment missing text', issueCommentTools[0], { ...issueCommentInput, comment: '' }],
|
|
483
|
+
['comment whitespace text', issueCommentTools[0], { ...issueCommentInput, comment: ' ' }],
|
|
484
|
+
['comment invalid text type', issueCommentTools[0], { ...issueCommentInput, comment: null }],
|
|
485
|
+
['comment extra null key', issueCommentTools[0], { ...issueCommentInput, unknown: null }],
|
|
486
|
+
['close missing repo selector', issueCompletedCloseTools[0], { issue_number: 502, state: 'closed', state_reason: 'completed' }],
|
|
487
|
+
['close missing issue selector', issueCompletedCloseTools[0], { ...issueCloseInput, issue_number: null }],
|
|
488
|
+
['close empty repo selector', issueCompletedCloseTools[0], { ...issueCloseInput, repository_full_name: '' }],
|
|
489
|
+
['close ownerless repo selector', issueCompletedCloseTools[0], { ...issueCloseInput, repository_full_name: 'repo-only' }],
|
|
490
|
+
['close wrong repo selector type', issueCompletedCloseTools[0], { ...issueCloseInput, repository_full_name: 502 }],
|
|
491
|
+
['close string issue selector', issueCompletedCloseTools[0], { ...issueCloseInput, issue_number: '502' }],
|
|
492
|
+
['close wrong state', issueCompletedCloseTools[0], { ...issueCloseInput, state: 'open' }],
|
|
493
|
+
['close reopened state', issueCompletedCloseTools[0], { ...issueCloseInput, state: 'reopened' }],
|
|
494
|
+
['close wrong reason', issueCompletedCloseTools[0], { ...issueCloseInput, state_reason: 'not_planned' }],
|
|
495
|
+
['close duplicate reason', issueCompletedCloseTools[0], { ...issueCloseInput, state_reason: 'duplicate' }],
|
|
496
|
+
['close reopened reason', issueCompletedCloseTools[0], { ...issueCloseInput, state_reason: 'reopened' }],
|
|
497
|
+
['close null reason', issueCompletedCloseTools[0], { ...issueCloseInput, state_reason: null }],
|
|
498
|
+
['close missing state', issueCompletedCloseTools[0], { repository_full_name: issueCloseInput.repository_full_name, issue_number: 502, state_reason: 'completed' }],
|
|
499
|
+
['close missing reason', issueCompletedCloseTools[0], { repository_full_name: issueCloseInput.repository_full_name, issue_number: 502, state: 'closed' }],
|
|
500
|
+
['close null extra key', issueCompletedCloseTools[0], { ...issueCloseInput, title: null }],
|
|
501
|
+
];
|
|
502
|
+
for (const [name, tool, input] of issueInvalidInputs) {
|
|
503
|
+
const result = actionGate.evaluatePreToolUse(issuePayload(tool, input, 'issue-invalid-' + name.replace(/[^a-z0-9]+/gi, '-')), {
|
|
504
|
+
host: 'codex', sessionDir, ruleTable: table,
|
|
505
|
+
});
|
|
506
|
+
check(result.kind === 'block' && result.exitCode === 2 && result.record.disposition === 'rejected'
|
|
507
|
+
&& result.rule && result.rule.id === 'structured-mutate', name + ' remains gated');
|
|
508
|
+
}
|
|
509
|
+
for (const key of ['title', 'body', 'labels', 'assignees', 'milestone']) {
|
|
510
|
+
const input = { ...issueCloseInput, [key]: null };
|
|
511
|
+
const result = actionGate.evaluatePreToolUse(issuePayload(issueCompletedCloseTools[0], input, 'issue-close-extra-' + key), {
|
|
512
|
+
host: 'codex', sessionDir, ruleTable: table,
|
|
513
|
+
});
|
|
514
|
+
check(result.kind === 'block' && result.exitCode === 2, 'completed-close rejects extra ' + key + ' even when null');
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
for (const tool of [
|
|
518
|
+
'add_comment_to_issue',
|
|
519
|
+
'mcp__github__add_comment_to_issue',
|
|
520
|
+
'mcp__codex_apps__github__add_comment_to_issues',
|
|
521
|
+
'mcp__codex_apps__github_add_comment_to_issue_extra',
|
|
522
|
+
'mcp__demo__add_comment_to_issue',
|
|
523
|
+
'mcp__codex_apps__github__foo_add_comment_to_issue',
|
|
524
|
+
'mcp__github__update_issue',
|
|
525
|
+
'mcp__codex_apps__github_update_issues',
|
|
526
|
+
'local__mcp__codex_apps__github_update_issue',
|
|
527
|
+
]) {
|
|
528
|
+
const input = tool.includes('comment') ? issueCommentInput : issueCloseInput;
|
|
529
|
+
const result = actionGate.evaluatePreToolUse(issuePayload(tool, input, 'issue-spoof-' + tool.replace(/[^a-z0-9]+/gi, '-')), {
|
|
530
|
+
host: 'codex', sessionDir, ruleTable: table,
|
|
531
|
+
});
|
|
532
|
+
check(result.kind === 'block' && result.exitCode === 2, 'near-match or other provider ' + tool + ' stays gated');
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
for (const action of ['delete', 'publish', 'deploy', 'send']) {
|
|
536
|
+
const candidate = issuePayload(issueCommentTools[0], issueCommentInput, 'issue-high-risk-' + action, {
|
|
537
|
+
action_descriptor: { toolFamily: 'shell', action },
|
|
538
|
+
});
|
|
539
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
540
|
+
check(result.kind === 'block' && result.exitCode === 2, 'explicit higher-risk ' + action + ' descriptor stays gated');
|
|
541
|
+
check(result.record.actionDescriptor.toolFamily === 'mcp', 'actual Issue tool identity overrides a spoofed shell family');
|
|
542
|
+
}
|
|
543
|
+
for (const action of ['read', 'unknown']) {
|
|
544
|
+
const candidate = issuePayload(issueCommentTools[0], issueCommentInput, 'issue-downgrade-' + action, {
|
|
545
|
+
action_descriptor: { toolFamily: 'shell', action },
|
|
546
|
+
});
|
|
547
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
548
|
+
check(result.kind === 'allow' && result.record.matchedRule === 'routine-issue-comment'
|
|
549
|
+
&& result.record.actionDescriptor.toolFamily === 'mcp' && result.record.actionDescriptor.action === 'mutate',
|
|
550
|
+
'explicit ' + action + ' descriptor cannot downgrade the exact Issue mutation');
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
for (const host of ['claude', 'opencode', 'unknown']) {
|
|
554
|
+
const candidate = issuePayload(issueCommentTools[0], issueCommentInput, 'issue-host-' + host);
|
|
555
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host, sessionDir, ruleTable: table });
|
|
556
|
+
check(result.rule && result.rule.id === 'structured-mutate', host + ' issue comment keeps its existing mutation gate');
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
for (const operation of [
|
|
560
|
+
[issueCommentTools[0], issueCommentInput, 'comment'],
|
|
561
|
+
[issueCompletedCloseTools[0], issueCloseInput, 'close'],
|
|
562
|
+
]) {
|
|
563
|
+
for (let requiredAt = 0; requiredAt < 4; requiredAt++) {
|
|
564
|
+
const optionalHints = Object.assign({}, ...gateEnvelopes({ required: false }));
|
|
565
|
+
const hints = { ...optionalHints, ...gateEnvelopes({ required: true })[requiredAt] };
|
|
566
|
+
const candidate = issuePayload(operation[0], operation[1], 'issue-required-' + operation[2] + '-' + requiredAt, hints);
|
|
567
|
+
const result = actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
568
|
+
check(result.kind === 'block' && result.exitCode === 2 && result.record.disposition === 'rejected', 'required actionGate envelope ' + requiredAt + ' wins for issue ' + operation[2]);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const issueAuditCases = [
|
|
573
|
+
[issueCommentTools[0], { ...issueCommentInput, comment: 'audit comment one' }, 'issue-audit-one', 'success'],
|
|
574
|
+
[issueCommentTools[0], { ...issueCommentInput, comment: 'audit comment two' }, 'issue-audit-two', 'failure'],
|
|
575
|
+
[issueCompletedCloseTools[0], issueCloseInput, 'issue-audit-close-success', 'success'],
|
|
576
|
+
[issueCompletedCloseTools[0], issueCloseInput, 'issue-audit-close-failure', 'failure'],
|
|
577
|
+
];
|
|
578
|
+
const issueAuditPres = issueAuditCases.map(([tool, input, id]) => {
|
|
579
|
+
const candidate = issuePayload(tool, input, id);
|
|
580
|
+
return { candidate, result: actionGate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table }) };
|
|
581
|
+
});
|
|
582
|
+
for (let index = 0; index < issueAuditCases.length; index++) {
|
|
583
|
+
const [tool, input, id, outcome] = issueAuditCases[index];
|
|
584
|
+
const { candidate, result } = issueAuditPres[index];
|
|
585
|
+
check(result.record && result.record.disposition === 'deferred-to-host', id + ' has an independent pre-action audit record');
|
|
586
|
+
check(result.record && result.record.commandHash === actionGate.hashExact(actionGate.exactPayloadText(candidate)), id + ' records the exact payload hash');
|
|
587
|
+
check(result.record && !JSON.stringify(result.record).includes(input.comment || 'routine fixture comment'), id + ' audit does not persist comment text');
|
|
588
|
+
const post = actionGate.finalizeExecution(candidate, outcome, { sessionDir });
|
|
589
|
+
check(post.record && post.record.disposition === 'executed' && post.record.executionOutcome === outcome, id + ' PostToolUse outcome is accurate');
|
|
590
|
+
check(post.record && Boolean(post.record.executionFailure) === (outcome === 'failure'), id + ' failure flag matches outcome');
|
|
591
|
+
}
|
|
592
|
+
check(issueAuditPres[0].result.record.commandHash !== issueAuditPres[1].result.record.commandHash, 'different issue comments have different audit hashes');
|
|
593
|
+
const alteredIssue = {
|
|
594
|
+
...issueAuditPres[0].candidate,
|
|
595
|
+
tool_input: { ...issueAuditPres[0].candidate.tool_input, comment: 'changed after PreToolUse' },
|
|
596
|
+
};
|
|
597
|
+
check(actionGate.finalizeExecution(alteredIssue, 'success', { sessionDir }).record.disposition === 'integrity-violation', 'changed issue payload cannot reuse a deferred audit record');
|
|
598
|
+
const unexecutedIssue = issuePayload(issueCommentTools[0], { ...issueCommentInput, comment: 'never executed' }, 'issue-unexecuted-stop');
|
|
599
|
+
actionGate.evaluatePreToolUse(unexecutedIssue, { host: 'codex', sessionDir, ruleTable: table });
|
|
600
|
+
const issueStop = actionGate.rejectPendingAtStop(unexecutedIssue, { sessionDir });
|
|
601
|
+
check(issueStop.rejected > 0 && readAudit(sessionDir, unexecutedIssue.tool_use_id).disposition === 'rejected', 'Stop rejects an unexecuted issue deferral');
|
|
602
|
+
|
|
441
603
|
|
|
442
604
|
} catch (err) {
|
|
443
605
|
console.error(err.stack || err.message);
|
|
@@ -163,6 +163,43 @@ try {
|
|
|
163
163
|
assert.notStrictEqual(denied.record.commandHash, hash);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
for (const [gateName, gate] of [
|
|
167
|
+
['canonical', actionGate],
|
|
168
|
+
['packaged', require(path.join(pluginRoot, 'hooks', 'scripts', 'action-gate.js'))],
|
|
169
|
+
]) {
|
|
170
|
+
for (const [tool, input, expectedRule, outcome] of [
|
|
171
|
+
['mcp__codex_apps__github__add_comment_to_issue', {
|
|
172
|
+
repo_full_name: 'dyphn1/Harness-everything', pr_number: 502, comment: 'private issue comment fixture',
|
|
173
|
+
}, 'routine-issue-comment', 'success'],
|
|
174
|
+
['mcp__codex_apps__github_update_issue', {
|
|
175
|
+
repository_full_name: 'dyphn1/Harness-everything', issue_number: 502, state: 'closed', state_reason: 'completed',
|
|
176
|
+
}, 'routine-issue-completed-close', 'failure'],
|
|
177
|
+
]) {
|
|
178
|
+
const candidate = {
|
|
179
|
+
...payload('', { toolUseId: `${gateName}-${expectedRule}`, turnId: 'issue-turn' }),
|
|
180
|
+
tool_name: tool,
|
|
181
|
+
tool_input: input,
|
|
182
|
+
};
|
|
183
|
+
const pre = gate.evaluatePreToolUse(candidate, { host: 'codex', sessionDir, ruleTable: table });
|
|
184
|
+
assert.strictEqual(pre.kind, 'allow', `${gateName} ${expectedRule} defers to host`);
|
|
185
|
+
assert.strictEqual(pre.stdout, null);
|
|
186
|
+
assert.strictEqual(Object.prototype.hasOwnProperty.call(pre, 'permissionDecision'), false);
|
|
187
|
+
assert.strictEqual(pre.record.disposition, 'deferred-to-host');
|
|
188
|
+
assert.strictEqual(pre.record.matchedRule, expectedRule);
|
|
189
|
+
assert.strictEqual(pre.record.host, 'codex');
|
|
190
|
+
assert.strictEqual(pre.record.toolUseId, candidate.tool_use_id);
|
|
191
|
+
assert.strictEqual(pre.record.actionDescriptor.action, 'mutate');
|
|
192
|
+
assert.strictEqual(pre.record.actionDescriptor.classification, 'gated');
|
|
193
|
+
const hash = gate.hashExact(gate.exactPayloadText(candidate));
|
|
194
|
+
assert.strictEqual(pre.record.commandHash, hash);
|
|
195
|
+
assert.strictEqual(pre.record.actionDescriptor.payloadHash, hash);
|
|
196
|
+
assert.ok(!JSON.stringify(pre.record).includes('private issue comment fixture'));
|
|
197
|
+
const post = gate.finalizeExecution(candidate, outcome, { sessionDir });
|
|
198
|
+
assert.strictEqual(post.record.disposition, 'executed');
|
|
199
|
+
assert.strictEqual(post.record.executionOutcome, outcome);
|
|
200
|
+
assert.strictEqual(post.record.commandHash, hash);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
166
203
|
const metadataEntry = preAdapter.processPayload({
|
|
167
204
|
...payload('', { toolUseId: 'metadata-entry' }),
|
|
168
205
|
tool_name: 'mcp__codex_apps__github_update_pull_request',
|
|
@@ -168,6 +168,8 @@ The Codex-only metadata exception checks the actual tool input, with all of thes
|
|
|
168
168
|
|
|
169
169
|
Any additional key, including `state`, `base_branch`, `base`, `maintainer_can_modify`, `draft`, or an unknown key, prevents the exception, even when its value is null. Mixed metadata/high-risk inputs and similar operation names retain the existing Gate. Claude, OpenCode and unknown hosts retain their prior mutation rules. PR creation behavior is unchanged.
|
|
170
170
|
|
|
171
|
+
Codex also defers only the exact Issue comment tools when their arguments are exactly `{ repo_full_name, pr_number, comment }` with a non-empty string comment, and the exact Issue update tools when their arguments are exactly `{ repository_full_name, issue_number, state: "closed", state_reason: "completed" }`. The comment connector uses `pr_number` for the Issue number. These remain `mutate`/`gated` actions and are audited as `routine-issue-comment` or `routine-issue-completed-close`; extra keys (including null), other states, required action gates, and other hosts stay gated.
|
|
172
|
+
|
|
171
173
|
```mermaid
|
|
172
174
|
flowchart LR
|
|
173
175
|
A["Exact PR update + actual arguments"] --> B{"Codex + title/body only<br/>+ no required Gate?"}
|
|
@@ -112,10 +112,13 @@ function normalizeActionDescriptor(payload, options = {}) {
|
|
|
112
112
|
const tool = toolNameOf(payload);
|
|
113
113
|
const input = toolInputOf(payload);
|
|
114
114
|
const explicit = explicitActionDescriptor(payload);
|
|
115
|
-
const
|
|
116
|
-
const
|
|
115
|
+
const codex = detectHost(payload, options.host) === 'codex';
|
|
116
|
+
const codexPrUpdate = codex && isPullRequestUpdateTool(tool);
|
|
117
|
+
const codexIssueMutation = codex && isRoutineIssueTool(tool);
|
|
118
|
+
const protectedMcpMutation = codexPrUpdate || codexIssueMutation;
|
|
119
|
+
const toolFamily = inferToolFamily(tool, protectedMcpMutation ? null : explicit);
|
|
117
120
|
const inferred = inferStructuredAction(tool, explicit);
|
|
118
|
-
const action =
|
|
121
|
+
const action = protectedMcpMutation && !STRUCTURED_GATED_ACTIONS.has(inferred) ? 'mutate' : inferred;
|
|
119
122
|
const classification = STRUCTURED_GATED_ACTIONS.has(action)
|
|
120
123
|
? 'gated'
|
|
121
124
|
: (STRUCTURED_SAFE_ACTIONS.has(action) ? 'safe' : 'unknown');
|
|
@@ -146,6 +149,49 @@ function isPullRequestUpdateTool(name) {
|
|
|
146
149
|
return name.split('__').pop() === 'update_pull_request' || name === 'mcp__codex_apps__github_update_pull_request';
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
const ISSUE_COMMENT_TOOLS = new Set([
|
|
153
|
+
'mcp__codex_apps__github__add_comment_to_issue',
|
|
154
|
+
'mcp__codex_apps__github_add_comment_to_issue',
|
|
155
|
+
]);
|
|
156
|
+
const ISSUE_COMPLETED_CLOSE_TOOLS = new Set([
|
|
157
|
+
'mcp__codex_apps__github__update_issue',
|
|
158
|
+
'mcp__codex_apps__github_update_issue',
|
|
159
|
+
]);
|
|
160
|
+
// Both Issue exceptions require an owner/name repository selector; an ownerless
|
|
161
|
+
// name is uncertain and must keep the original gate.
|
|
162
|
+
const OWNER_REPO_SELECTOR = /^[^/\s]+\/[^/\s]+$/;
|
|
163
|
+
|
|
164
|
+
function isRoutineIssueTool(name) {
|
|
165
|
+
return ISSUE_COMMENT_TOOLS.has(name) || ISSUE_COMPLETED_CLOSE_TOOLS.has(name);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function hasExactKeys(input, expected) {
|
|
169
|
+
const keys = Object.keys(input);
|
|
170
|
+
return keys.length === expected.length && expected.every(key => Object.prototype.hasOwnProperty.call(input, key));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isRoutineIssueComment(payload) {
|
|
174
|
+
const input = toolInputOf(payload);
|
|
175
|
+
return ISSUE_COMMENT_TOOLS.has(toolNameOf(payload))
|
|
176
|
+
&& input && typeof input === 'object' && !Array.isArray(input)
|
|
177
|
+
&& hasExactKeys(input, ['repo_full_name', 'pr_number', 'comment'])
|
|
178
|
+
&& typeof input.repo_full_name === 'string' && input.repo_full_name.trim() !== ''
|
|
179
|
+
&& OWNER_REPO_SELECTOR.test(input.repo_full_name)
|
|
180
|
+
&& Number.isSafeInteger(input.pr_number) && input.pr_number > 0
|
|
181
|
+
&& typeof input.comment === 'string' && input.comment.trim() !== '';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function isRoutineIssueCompletedClose(payload) {
|
|
185
|
+
const input = toolInputOf(payload);
|
|
186
|
+
return ISSUE_COMPLETED_CLOSE_TOOLS.has(toolNameOf(payload))
|
|
187
|
+
&& input && typeof input === 'object' && !Array.isArray(input)
|
|
188
|
+
&& hasExactKeys(input, ['repository_full_name', 'issue_number', 'state', 'state_reason'])
|
|
189
|
+
&& typeof input.repository_full_name === 'string' && input.repository_full_name.trim() !== ''
|
|
190
|
+
&& OWNER_REPO_SELECTOR.test(input.repository_full_name)
|
|
191
|
+
&& Number.isSafeInteger(input.issue_number) && input.issue_number > 0
|
|
192
|
+
&& input.state === 'closed' && input.state_reason === 'completed';
|
|
193
|
+
}
|
|
194
|
+
|
|
149
195
|
function isPullRequestMetadataUpdate(payload) {
|
|
150
196
|
if (!isPullRequestUpdateTool(toolNameOf(payload))) return false;
|
|
151
197
|
const input = toolInputOf(payload);
|
|
@@ -173,6 +219,26 @@ function structuredRule(payload, options = {}) {
|
|
|
173
219
|
&& isPullRequestMetadataUpdate(payload) && !(hint && hint.required)) {
|
|
174
220
|
return { descriptor, rule: null, hostDeferred: true };
|
|
175
221
|
}
|
|
222
|
+
if (detectHost(payload, options.host) === 'codex' && descriptor.action === 'mutate'
|
|
223
|
+
&& isRoutineIssueComment(payload) && !(hint && hint.required)) {
|
|
224
|
+
return {
|
|
225
|
+
descriptor,
|
|
226
|
+
rule: null,
|
|
227
|
+
hostDeferred: true,
|
|
228
|
+
hostDeferredId: 'routine-issue-comment',
|
|
229
|
+
hostDeferredReason: 'Codex routine Issue comments defer to native task scope and permissions.',
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (detectHost(payload, options.host) === 'codex' && descriptor.action === 'mutate'
|
|
233
|
+
&& isRoutineIssueCompletedClose(payload) && !(hint && hint.required)) {
|
|
234
|
+
return {
|
|
235
|
+
descriptor,
|
|
236
|
+
rule: null,
|
|
237
|
+
hostDeferred: true,
|
|
238
|
+
hostDeferredId: 'routine-issue-completed-close',
|
|
239
|
+
hostDeferredReason: 'Codex routine Issue completed-close operations defer to native task scope and permissions.',
|
|
240
|
+
};
|
|
241
|
+
}
|
|
176
242
|
if (descriptor.classification === 'gated') {
|
|
177
243
|
return {
|
|
178
244
|
descriptor,
|
|
@@ -495,8 +561,8 @@ function evaluatePreToolUse(payload, options = {}) {
|
|
|
495
561
|
|
|
496
562
|
if (!rule) {
|
|
497
563
|
const record = structured.hostDeferred ? recordDecision(payload, {
|
|
498
|
-
id: 'routine-pr-metadata-update',
|
|
499
|
-
reason: 'Codex PR title/body metadata update defers to native task scope and permissions.',
|
|
564
|
+
id: structured.hostDeferredId || 'routine-pr-metadata-update',
|
|
565
|
+
reason: structured.hostDeferredReason || 'Codex PR title/body metadata update defers to native task scope and permissions.',
|
|
500
566
|
}, table, host, 'deferred-to-host', { ...options, sessionDir: context.sessionDir }) : null;
|
|
501
567
|
return {
|
|
502
568
|
kind: 'allow',
|
package/package.json
CHANGED
|
@@ -112,10 +112,13 @@ function normalizeActionDescriptor(payload, options = {}) {
|
|
|
112
112
|
const tool = toolNameOf(payload);
|
|
113
113
|
const input = toolInputOf(payload);
|
|
114
114
|
const explicit = explicitActionDescriptor(payload);
|
|
115
|
-
const
|
|
116
|
-
const
|
|
115
|
+
const codex = detectHost(payload, options.host) === 'codex';
|
|
116
|
+
const codexPrUpdate = codex && isPullRequestUpdateTool(tool);
|
|
117
|
+
const codexIssueMutation = codex && isRoutineIssueTool(tool);
|
|
118
|
+
const protectedMcpMutation = codexPrUpdate || codexIssueMutation;
|
|
119
|
+
const toolFamily = inferToolFamily(tool, protectedMcpMutation ? null : explicit);
|
|
117
120
|
const inferred = inferStructuredAction(tool, explicit);
|
|
118
|
-
const action =
|
|
121
|
+
const action = protectedMcpMutation && !STRUCTURED_GATED_ACTIONS.has(inferred) ? 'mutate' : inferred;
|
|
119
122
|
const classification = STRUCTURED_GATED_ACTIONS.has(action)
|
|
120
123
|
? 'gated'
|
|
121
124
|
: (STRUCTURED_SAFE_ACTIONS.has(action) ? 'safe' : 'unknown');
|
|
@@ -146,6 +149,49 @@ function isPullRequestUpdateTool(name) {
|
|
|
146
149
|
return name.split('__').pop() === 'update_pull_request' || name === 'mcp__codex_apps__github_update_pull_request';
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
const ISSUE_COMMENT_TOOLS = new Set([
|
|
153
|
+
'mcp__codex_apps__github__add_comment_to_issue',
|
|
154
|
+
'mcp__codex_apps__github_add_comment_to_issue',
|
|
155
|
+
]);
|
|
156
|
+
const ISSUE_COMPLETED_CLOSE_TOOLS = new Set([
|
|
157
|
+
'mcp__codex_apps__github__update_issue',
|
|
158
|
+
'mcp__codex_apps__github_update_issue',
|
|
159
|
+
]);
|
|
160
|
+
// Both Issue exceptions require an owner/name repository selector; an ownerless
|
|
161
|
+
// name is uncertain and must keep the original gate.
|
|
162
|
+
const OWNER_REPO_SELECTOR = /^[^/\s]+\/[^/\s]+$/;
|
|
163
|
+
|
|
164
|
+
function isRoutineIssueTool(name) {
|
|
165
|
+
return ISSUE_COMMENT_TOOLS.has(name) || ISSUE_COMPLETED_CLOSE_TOOLS.has(name);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function hasExactKeys(input, expected) {
|
|
169
|
+
const keys = Object.keys(input);
|
|
170
|
+
return keys.length === expected.length && expected.every(key => Object.prototype.hasOwnProperty.call(input, key));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isRoutineIssueComment(payload) {
|
|
174
|
+
const input = toolInputOf(payload);
|
|
175
|
+
return ISSUE_COMMENT_TOOLS.has(toolNameOf(payload))
|
|
176
|
+
&& input && typeof input === 'object' && !Array.isArray(input)
|
|
177
|
+
&& hasExactKeys(input, ['repo_full_name', 'pr_number', 'comment'])
|
|
178
|
+
&& typeof input.repo_full_name === 'string' && input.repo_full_name.trim() !== ''
|
|
179
|
+
&& OWNER_REPO_SELECTOR.test(input.repo_full_name)
|
|
180
|
+
&& Number.isSafeInteger(input.pr_number) && input.pr_number > 0
|
|
181
|
+
&& typeof input.comment === 'string' && input.comment.trim() !== '';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function isRoutineIssueCompletedClose(payload) {
|
|
185
|
+
const input = toolInputOf(payload);
|
|
186
|
+
return ISSUE_COMPLETED_CLOSE_TOOLS.has(toolNameOf(payload))
|
|
187
|
+
&& input && typeof input === 'object' && !Array.isArray(input)
|
|
188
|
+
&& hasExactKeys(input, ['repository_full_name', 'issue_number', 'state', 'state_reason'])
|
|
189
|
+
&& typeof input.repository_full_name === 'string' && input.repository_full_name.trim() !== ''
|
|
190
|
+
&& OWNER_REPO_SELECTOR.test(input.repository_full_name)
|
|
191
|
+
&& Number.isSafeInteger(input.issue_number) && input.issue_number > 0
|
|
192
|
+
&& input.state === 'closed' && input.state_reason === 'completed';
|
|
193
|
+
}
|
|
194
|
+
|
|
149
195
|
function isPullRequestMetadataUpdate(payload) {
|
|
150
196
|
if (!isPullRequestUpdateTool(toolNameOf(payload))) return false;
|
|
151
197
|
const input = toolInputOf(payload);
|
|
@@ -173,6 +219,26 @@ function structuredRule(payload, options = {}) {
|
|
|
173
219
|
&& isPullRequestMetadataUpdate(payload) && !(hint && hint.required)) {
|
|
174
220
|
return { descriptor, rule: null, hostDeferred: true };
|
|
175
221
|
}
|
|
222
|
+
if (detectHost(payload, options.host) === 'codex' && descriptor.action === 'mutate'
|
|
223
|
+
&& isRoutineIssueComment(payload) && !(hint && hint.required)) {
|
|
224
|
+
return {
|
|
225
|
+
descriptor,
|
|
226
|
+
rule: null,
|
|
227
|
+
hostDeferred: true,
|
|
228
|
+
hostDeferredId: 'routine-issue-comment',
|
|
229
|
+
hostDeferredReason: 'Codex routine Issue comments defer to native task scope and permissions.',
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (detectHost(payload, options.host) === 'codex' && descriptor.action === 'mutate'
|
|
233
|
+
&& isRoutineIssueCompletedClose(payload) && !(hint && hint.required)) {
|
|
234
|
+
return {
|
|
235
|
+
descriptor,
|
|
236
|
+
rule: null,
|
|
237
|
+
hostDeferred: true,
|
|
238
|
+
hostDeferredId: 'routine-issue-completed-close',
|
|
239
|
+
hostDeferredReason: 'Codex routine Issue completed-close operations defer to native task scope and permissions.',
|
|
240
|
+
};
|
|
241
|
+
}
|
|
176
242
|
if (descriptor.classification === 'gated') {
|
|
177
243
|
return {
|
|
178
244
|
descriptor,
|
|
@@ -495,8 +561,8 @@ function evaluatePreToolUse(payload, options = {}) {
|
|
|
495
561
|
|
|
496
562
|
if (!rule) {
|
|
497
563
|
const record = structured.hostDeferred ? recordDecision(payload, {
|
|
498
|
-
id: 'routine-pr-metadata-update',
|
|
499
|
-
reason: 'Codex PR title/body metadata update defers to native task scope and permissions.',
|
|
564
|
+
id: structured.hostDeferredId || 'routine-pr-metadata-update',
|
|
565
|
+
reason: structured.hostDeferredReason || 'Codex PR title/body metadata update defers to native task scope and permissions.',
|
|
500
566
|
}, table, host, 'deferred-to-host', { ...options, sessionDir: context.sessionDir }) : null;
|
|
501
567
|
return {
|
|
502
568
|
kind: 'allow',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "harness-everything",
|
|
4
|
-
"version": "0.57.
|
|
4
|
+
"version": "0.57.4",
|
|
5
5
|
"description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Miya Daniel",
|
package/sbom.cdx.json
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
"$schema": "https://cyclonedx.org/schema/bom-1.7.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.7",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:48c6a57b-e879-5182-9f4c-e520d44b1012",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-11-
|
|
8
|
+
"timestamp": "2026-11-22T17:47:42.668Z",
|
|
9
9
|
"tools": [
|
|
10
10
|
{
|
|
11
11
|
"vendor": "Harness Everything",
|
|
12
12
|
"name": "generate-sbom.js",
|
|
13
|
-
"version": "0.57.
|
|
13
|
+
"version": "0.57.4"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "application",
|
|
18
|
-
"bom-ref": "pkg:npm/harness-everything@0.57.
|
|
18
|
+
"bom-ref": "pkg:npm/harness-everything@0.57.4",
|
|
19
19
|
"name": "harness-everything",
|
|
20
|
-
"version": "0.57.
|
|
21
|
-
"purl": "pkg:npm/harness-everything@0.57.
|
|
20
|
+
"version": "0.57.4",
|
|
21
|
+
"purl": "pkg:npm/harness-everything@0.57.4"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -2033,7 +2033,7 @@
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
"ref": "pkg:npm/harness-everything@0.57.
|
|
2036
|
+
"ref": "pkg:npm/harness-everything@0.57.4",
|
|
2037
2037
|
"dependsOn": [
|
|
2038
2038
|
"pkg:npm/%40commitlint/cli@19.8.1",
|
|
2039
2039
|
"pkg:npm/%40commitlint/config-conventional@19.8.1",
|