mirror of
https://github.com/morluto/rea.git
synced 2026-11-10 16:57:19 +00:00
feat(analysis): make resource budgets recoverable across CLI and MCP (#9706)
* refactor(analysis): centralize resource budgets and recovery facts * feat(analysis): expose ASAR and Ghidra runtime admission controls * feat(artifacts): expose reader admission and preserve limited recognition * feat(javascript): expose recoverable semantic precision budgets * feat(web): add recoverable source-map budgets and compact retained views * feat(web): make historical capture decoding budgets recoverable * fix(desktop): enforce selected view policies across capture and export * feat(runtime): make Frida and LLDB retention budgets selectable * feat(native): expose diagnostic budgets and preserve exhaustion causes * feat(managed): expose recoverable snapshot and representation budgets * feat(metadata): make Go and Rust inspection budgets recoverable * feat(wasm): expose representation and producer admissions * feat(evm): expose per-call worker resource budgets * feat(android): make resource and string-pool omissions recoverable * feat(producers): expose command and recorded-capture budgets * docs(analysis): record recovery contracts and integrated validation * fix(docs): link calibration oracle from published verification pages * fix(docs): restore desktop task anchors and receipt links * test(analysis): align fixtures with selectable budget contracts * fix(analysis): remove source-location projector dependency cycle * test(analysis): refresh budget recovery and verifier regressions * test(analysis): preserve format and publication recovery expectations * test(windows): align conformance with owned runtime admission * fix(desktop): preserve selected alias kinds in exported state * test(analysis): align provider fixtures with recoverable budgets * test(desktop): validate emitted alias metadata structurally * fix(ghidra): classify bounded Windows endpoint refusals * test(cli): assert selectable artifact admission recovery * fix(cli): preserve capture provenance in environment builds
This commit is contained in:
1 parent
55b6d2ca20
commit
cb4e5cfbff
515 files changed
+21066
-3637
No files matched your search
@@ -0,0 +1,59 @@
|
||||
"""Aggregate retained observer receipts and complete CLI records; needs tiktoken."""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import statistics
|
||||
|
||||
import tiktoken
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('inputs', type=Path)
|
||||
parser.add_argument('output', type=Path)
|
||||
options = parser.parse_args()
|
||||
encoder = tiktoken.get_encoding('cl100k_base')
|
||||
def compact(value):
|
||||
return json.dumps(value, ensure_ascii=False, separators=(',', ':'))
|
||||
rows = []
|
||||
for path in sorted(options.inputs.glob('*.metrics.json')):
|
||||
metrics = json.loads(path.read_text())
|
||||
record = json.loads(path.with_name(path.name.replace('.metrics.json', '.replies.json')).read_text())
|
||||
summary = json.loads(path.with_suffix('.stdout').read_text())
|
||||
tokens = {
|
||||
'arguments': len(encoder.encode(compact(record['argv']))),
|
||||
'reply': len(encoder.encode(compact(json.loads(record['stdout'])))),
|
||||
'progress_stderr': len(encoder.encode(record['stderr'])),
|
||||
}
|
||||
rows.append({
|
||||
'name': path.stem.removesuffix('.metrics'),
|
||||
'task': summary['case'], 'budget': summary['budget'],
|
||||
'verified_facts': summary['verified_facts'], 'unknowns': summary['unknowns'],
|
||||
'wall_s': metrics['elapsed_seconds'],
|
||||
'cpu_s': metrics['cpu_seconds_waited_subtree'],
|
||||
'host_group_rss_bytes': metrics['peak_process_group_rss_bytes_sampled'],
|
||||
'tokens': tokens, 'reply_bytes': summary['reply_bytes'],
|
||||
'exit_code': metrics['exit_code'], 'cleanup': metrics['cleanup'],
|
||||
'stop_reason': metrics['stop_reason'],
|
||||
})
|
||||
medians = []
|
||||
for task in ['theme', 'ms']:
|
||||
for budget in ['default', 'double']:
|
||||
selected = [row for row in rows if row['task'] == task and row['budget'] == budget]
|
||||
if not selected:
|
||||
continue
|
||||
medians.append({
|
||||
'task': task, 'budget': budget, 'trials': len(selected),
|
||||
'facts': selected[0]['verified_facts'], 'unknowns': selected[0]['unknowns'],
|
||||
'wall_s': statistics.median(row['wall_s'] for row in selected),
|
||||
'cpu_s': statistics.median(row['cpu_s'] for row in selected),
|
||||
'host_group_rss_mib': statistics.median(row['host_group_rss_bytes'] / 1048576 for row in selected),
|
||||
'tokens': statistics.median(sum(row['tokens'].values()) for row in selected),
|
||||
'reply_bytes': selected[0]['reply_bytes'],
|
||||
})
|
||||
options.output.write_text(json.dumps({'rows': rows, 'medians': medians}, indent=2) + '\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user