Skip to content
Merged
222 changes: 221 additions & 1 deletion examples/claude-native/workflows/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/claude-native/workflows/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ca62177687420fe22e03d0510a18e4f32b5d150e0156f6651c48367c3da506e1 check-syntax.mjs
f5ea9c3a1b47cab91e90a515f455bcf6a960fb696db89717e04b7424e4ff42a0 child-usage.mjs
062f4c0fa48209d7dce76075faa3d074920ba67e46df425769fcd4757f8c291f child-usage.mjs
cd303779df6521c804070a319aa04c86ed2d6fe1c099c537836f037dec5f4e8b codex-cross-review.mjs
07d9b6553ea5535f005c68830047c99bdec8d26d6b7edd86406028f4dd8a7cab test-child-usage.mjs
78d60c83e31a0edc4601fb1957bf6b0fb35596b3dc88d518a6daff4f6681fce5 test-child-usage.mjs
2617c081f606268ed20a6e00f6472495fad950db433ca3afbb44ea970aaac446 test-codex-envelope.mjs
f0d70874aa023445208f6e3a06042644deedfc3bd0ddb8dfd0fea360ef7679a7 test-contract-mutations.mjs
699fc1d7a8f52a7142d75b9d51385dcc454e0e076e7bc5aa0e09f3575ad8b945 test-envelope.mjs
Expand Down
735 changes: 671 additions & 64 deletions examples/claude-native/workflows/child-usage.mjs

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions examples/claude-native/workflows/test-child-usage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// OFFLINE check of child-usage.mjs against SYNTHETIC transcript rows (no provider
// call, not native evidence). Real runs are checked by passing their directory;
// stored receipts from real runs are bound to the documentation by test-usage-receipts.mjs.
import { summarizeChild, summarizeRun, latestRunDir, effortMismatches, modelGeneration, expectedModel, webSearch, childLanes, aggregateLanes, sweepLanes, fetchKind, mcpServer, safeKey, tokenStats, parseArgs, loadRtkDecisions, DEFAULT_MARKER } from './child-usage.mjs'
import { summarizeChild, summarizeRun, latestRunDir, effortMismatches, modelGeneration, expectedModel, webSearch, childLanes, aggregateLanes, sweepLanes, fetchKind, mcpServer, safeKey, tokenStats, parseArgs, loadRtkDecisions, DEFAULT_MARKER, executedText, logFindPart, sensitivePart } from './child-usage.mjs'
import { mkdtempSync, writeFileSync, rmSync, mkdirSync, utimesSync, readFileSync, chmodSync } from 'node:fs'
import { spawnSync } from 'node:child_process'
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -216,7 +216,7 @@ expect('lanes: an unknown decision value is kept as other', childLanes(agentTool
const injected = childLanes([ask('plain workflow packet', 0), attach({ type: 'hook_additional_context', hookName: 'SubagentStart:workflow-subagent', hookEvent: 'SubagentStart', toolUseID: 'start', content: ['lanes\n' + DEFAULT_MARKER] }, 0), call('b1', 'Read', { file_path: 'a' }, 1, tokens(5, 0, 100))])
expect('lanes: SubagentStart hook_additional_context carrying the marker is an injected block', !injected.injected_block.in_first_prompt && injected.injected_block.in_subagent_start_context && injected.subagent_start.additional_context && injected.subagent_start.types.join() === 'workflow-subagent')
const viaStdout = childLanes([ask('packet', 0), attach({ type: 'hook_success', hookName: 'SubagentStart:general-purpose', hookEvent: 'SubagentStart', toolUseID: 'start', command: 'lanes-hook', stdout: JSON.stringify({ hookSpecificOutput: { hookEventName: 'SubagentStart', additionalContext: 'block ' + DEFAULT_MARKER } }), stderr: '', exitCode: 0 }, 0)])
expect('lanes: SubagentStart additionalContext in hook stdout is an injected block too', viaStdout.injected_block.in_subagent_start_context && viaStdout.subagent_start.additional_context)
expect('lanes: stdout-only context is a claim, never proof of insertion', !viaStdout.injected_block.in_subagent_start_context && !viaStdout.subagent_start.additional_context && viaStdout.measurement.hook_context.claimed === 1)
const quoted = childLanes([ask('no block here', 0), call('d1', 'Bash', { command: 'grep -c "' + DEFAULT_MARKER + '" hooks.mjs' }, 1), toolResult('d1', 'match ' + DEFAULT_MARKER, 1)])
expect('lanes: the marker in tool input or output is never an injected block', !quoted.injected_block.in_first_prompt && !quoted.injected_block.in_subagent_start_context)
expect('lanes: another marker is looked for when given', childLanes([ask('nonce-7f3', 0)], { marker: 'nonce-7f3' }).injected_block.in_first_prompt && !childLanes([ask('nonce-7f3', 0)]).injected_block.in_first_prompt)
Expand Down Expand Up @@ -366,5 +366,15 @@ try {
expect('rtk-db: the sweep joins every Bash call in the window, and the database is unchanged', all && JSON.stringify(all.rtk.decisions) === JSON.stringify({ allow: 1, ask: 1, defer: 1, deny: 1, not_logged: 3, other: 0 }) && all.rtk.covered_share_of_bash === 0.2857 && readFileSync(db).equals(before))
}
} finally { rmSync(sweepRoot, { recursive: true, force: true }) }
// CodeQL js/redos witnesses (2026-09-27): before the repair each took seconds at 28 repetitions, doubling with each one.
const timed = (f) => { const t = process.hrtime.bigint(), r = f(); return { r, ms: Number(process.hrtime.bigint() - t) / 1e6 } }
const gitWitness = 'git ' + '--git-dir --! '.repeat(28) + 'status'
const gitRun = timed(() => [logFindPart(gitWitness), sensitivePart(gitWitness)])
expect('redos: repeated --git-dir option words are read in linear time', gitRun.ms < 1000 && gitRun.r.join() === 'false,false')
const codeRun = timed(() => ['node -', 'bun -', 'deno eval -'].map((p) => executedText(p + '-- -'.repeat(28) + " 'fetch(u)'", { inlineHttp: true })))
expect('redos: repeated interpreter option words are matched in linear time', codeRun.ms < 1000)
expect('git options: any reading of the option words reaches the subcommand, as in the RTK exclude_commands',
logFindPart('git -C repo -c core.pager=cat --no-pager log -3') && logFindPart('git --git-dir .git --work-tree . log') && logFindPart('find . -name x')
&& !logFindPart('git status') && sensitivePart('git -C repo branch -a') && sensitivePart('git --git-dir=.g show HEAD:a') && !sensitivePart('git -C repo status'))
console.log('SUMMARY passed=' + passed + ' failed=' + failed + ' total=' + (passed + failed))
process.exit(failed ? 1 : 0)
31 changes: 18 additions & 13 deletions manifests/evidence.json
Original file line number Diff line number Diff line change
Expand Up @@ -38203,12 +38203,12 @@
},
{
"path": "examples/claude-native/workflows/README.md",
"sha256": "bf1b2ee8d9a444f286ae579b968748a4e69166c3c05d2ea36fa891c19b6b2618",
"bytes": 32964
"sha256": "c878419597aec836095bae82da831edc65c7bb2c801194190b80248a360ba9e1",
"bytes": 48365
},
{
"path": "examples/claude-native/workflows/SHA256SUMS",
"sha256": "9681f807742a33da71ffb9200892fd8f1b0b6c08b2b256c47ea21931e0651709",
"sha256": "9eadf11b8e659cc026de7f92d6b2923521341a25fcc56f52a1c738258996bb6d",
"bytes": 1129
},
{
Expand All @@ -38218,8 +38218,8 @@
},
{
"path": "examples/claude-native/workflows/child-usage.mjs",
"sha256": "f5ea9c3a1b47cab91e90a515f455bcf6a960fb696db89717e04b7424e4ff42a0",
"bytes": 46586
"sha256": "062f4c0fa48209d7dce76075faa3d074920ba67e46df425769fcd4757f8c291f",
"bytes": 90100
},
{
"path": "examples/claude-native/workflows/codex-cross-review.mjs",
Expand All @@ -38243,8 +38243,8 @@
},
{
"path": "examples/claude-native/workflows/test-child-usage.mjs",
"sha256": "07d9b6553ea5535f005c68830047c99bdec8d26d6b7edd86406028f4dd8a7cab",
"bytes": 49742
"sha256": "78d60c83e31a0edc4601fb1957bf6b0fb35596b3dc88d518a6daff4f6681fce5",
"bytes": 51024
},
{
"path": "examples/claude-native/workflows/test-codex-envelope.mjs",
Expand Down Expand Up @@ -39738,8 +39738,8 @@
},
{
"path": "tests/test_skill_usage.py",
"sha256": "996d235b48dbc7a2d6be74b8c5e737ab688716b99661f7144cc7a70beb307551",
"bytes": 55700
"sha256": "7683e067b2931d60e42ba8f886bb61823d182bc693924093a7d3cef6429a8362",
"bytes": 71049
},
{
"path": "tests/test_skills_manifest.py",
Expand Down Expand Up @@ -39786,6 +39786,11 @@
"sha256": "2c4426392551fc44ac10799423772c1fa79f68d4bb12d83428c29ad192b3d144",
"bytes": 12080
},
{
"path": "tests/test_token_measurement.py",
"sha256": "314c86151c3fab9236b0c20fa9682491b9191d7ae5ec5bc1774e9bd21c8c9699",
"bytes": 45198
},
{
"path": "tests/test_trading_gates.py",
"sha256": "10b1ce5b0cec4d3e68d792c83a9ad2b4fcbb70863305b0496961650deb34214f",
Expand Down Expand Up @@ -39968,13 +39973,13 @@
},
{
"path": "tools/skill-usage/README.md",
"sha256": "5e18f1ff2cd1850260e59aa02949c97ea202c0b5326afe8354078141252d1607",
"bytes": 15487
"sha256": "08c549f84a852ebb19987f36a8c69aa677cfc8ab635eac635b8ef7263c21de5c",
"bytes": 22119
},
{
"path": "tools/skill-usage/skill_usage.py",
"sha256": "b979fea4714817223b66b08af557faf62a37faffe665865b764bfb957fca438f",
"bytes": 65407
"sha256": "471309cea9fb2cf3088dcb6a1bb9b401009294f5fd20d91b635e4e7640244e44",
"bytes": 80259
},
{
"path": "tools/sota-convergence/README.md",
Expand Down
Loading
Loading