gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainbd3591c7conductor: gates run on the live day44 binarymremain/lib/review-output.hl

4.3 KB

  1. $mode = 'static'
  2. isList = (value) => {
  3. return hlTypeName(value) == 'Hybrid' && JSON.stringify(value).startsWith('[')
  4. }
  5. require = (Boolean ok, String message) => {
  6. if (!ok) { hlError(message) }
  7. }
  8. parseResult = (String text) => {
  9. r = JSON.parse(text.trim())
  10. require(hlTypeName(r.summary) == 'String', 'result.summary must be a string')
  11. require(isList(r.findings), 'result.findings must be an array')
  12. require(isList(r.replies), 'result.replies must be an array')
  13. require(hlTypeName(r.axes.correctness) == 'String' && hlTypeName(r.axes.spec) == 'String' && hlTypeName(r.axes.standards) == 'String', 'result.axes must have three string axes')
  14. require(['approve', 'comment', 'request_changes'].includes(r.verdict), 'invalid verdict')
  15. require(hlTypeName(r.gates) == 'String', 'result.gates must be a string')
  16. for (let i = 0; i < r.findings.length; i = i + 1) {
  17. let f = r.findings[i]
  18. if (!['correctness', 'spec', 'standards'].includes(f.axis)) { f.axis = 'correctness' }
  19. require(hlTypeName(f.path) == 'String' && hlTypeName(f.title) == 'String' && hlTypeName(f.body) == 'String', 'invalid finding text')
  20. require(hlTypeName(f.line) == 'Number' && f.line >= 1 && f.line % 1 == 0, 'invalid finding line')
  21. require(['blocker', 'major', 'minor', 'nit'].includes(f.severity), 'invalid finding severity')
  22. r.findings[i] = f
  23. }
  24. for (reply of r.replies) {
  25. require(hlTypeName(reply.thread) == 'String' && hlTypeName(reply.body) == 'String' && hlTypeName(reply.resolve) == 'Boolean', 'invalid reply')
  26. }
  27. return r
  28. }
  29. parseEvents = (Hybrid lines) => {
  30. let session = null
  31. let message = ''
  32. let error = null
  33. let usage = { input_tokens = 0, cached_input_tokens = 0, output_tokens = 0 }
  34. // Tool executions the model made (kunibert#11): a command_execution item that completed is a success, any other end (failed/declined) a failure.
  35. // A tool call that could not even start (missing helper, broken sandbox) makes no item at all, so "no successful command" is the signal.
  36. let commandsOk = 0
  37. let commandsFailed = 0
  38. let spawnFailures = 0
  39. for (line of lines) {
  40. if (!line.startsWith('{')) { continue }
  41. e = JSON.parse(line)
  42. if (e.type == 'thread.started' && e.thread_id) { session = e.thread_id }
  43. if (e.type == 'item.completed' && e.item.type == 'agent_message' && hlTypeName(e.item.text) == 'String') { message = e.item.text }
  44. if (e.type == 'item.completed' && e.item.type == 'command_execution') {
  45. if (e.item.status == 'completed') { commandsOk = commandsOk + 1 }
  46. else {
  47. commandsFailed = commandsFailed + 1
  48. out = hlTypeName(e.item.aggregated_output) == 'String' ? e.item.aggregated_output : ''
  49. if (out.includes('failed to spawn') || out.includes('bwrap:') || out.includes('Operation not permitted')) { spawnFailures = spawnFailures + 1 }
  50. }
  51. }
  52. if (e.type == 'error' || e.type == 'turn.failed') {
  53. error = e.message
  54. if (error == null) { error = e.error.message }
  55. if (error == null) { error = JSON.stringify(e) }
  56. }
  57. if (e.usage != null) {
  58. for (key in e.usage) {
  59. require(hlTypeName(e.usage[key]) == 'Number', 'invalid usage counter')
  60. if (usage[key] == null) { usage[key] = 0 }
  61. usage[key] = usage[key] + e.usage[key]
  62. }
  63. }
  64. }
  65. return { =session, =message, =error, =usage, =commandsOk, =commandsFailed, =spawnFailures }
  66. }
  67. // needsCode: the run must have read the code (first review, new head, forced); a wake on an unchanged head may answer from memory.
  68. // No result without evidence that the tools worked: no successful command while the code had to be read, or only failed commands that
  69. // show a spawn/sandbox failure, is an error, whatever "review" the model wrote (kunibert#11). One failed command among successes is normal.
  70. checked = (Hybrid events, Number code, Boolean needsCode = true) => {
  71. require(code == 0 && events.error == null, 'codex failed (' + code + '): ' + events.error)
  72. require(events.commandsOk > 0 || (!needsCode && events.spawnFailures == 0), 'the model\'s tools failed')
  73. require(events.message != '', 'codex produced no final message')
  74. return { session = events.session, usage = events.usage, result = parseResult(events.message) }
  75. }

Branches

Latest commits

  • bd3591c7conductor: gates run on the live day44 binarymre
  • 47f747a7records: jukebox #9 fix livemre
  • 0a3169fdMerge branch 'vendored-size' into mainKunibert
  • e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
  • 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
  • 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
  • 50a1867estatus: jukebox #9mre
  • c57484e6log: jukebox #9 diff sizemre
  • 795a20carecords: guard fix live (PR 8)mre
  • 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
  • 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
  • f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
  • 10b2a49estatus: PR 314, guard fix proposedmre
  • e73995a3log: hycon PR 314 approved after fresh reviewmre
  • f60427falog: hycon PR 314 false tool errormre
  • 481974f7log: Hermes accepts PR 259 findingmre
  • bb0976acrecords: hycon PR 259 design findingmre
  • 5c637c24records: hycon PR 259 false tool errormre
  • a344c406log: routger 132 reviewedmre
  • 56e70dcbrecords: review time limit 1800 s (routger 132)mre