[{"data":1,"prerenderedAt":712},["ShallowReactive",2],{"navigation_docs":3,"-reference-chain-nodes-fix-loop":270,"-reference-chain-nodes-fix-loop-surround":707},[4,28,51,110,243],{"title":5,"path":6,"stem":7,"children":8},"Get started","\u002Fget-started","1.get-started",[9,12,16,20,24],{"title":10,"path":6,"stem":11},"Overview","1.get-started\u002Findex",{"title":13,"path":14,"stem":15},"Why Kraft","\u002Fget-started\u002Fwhy-kraft","1.get-started\u002F0.why-kraft",{"title":17,"path":18,"stem":19},"Install","\u002Fget-started\u002Finstall","1.get-started\u002F1.install",{"title":21,"path":22,"stem":23},"Your first work item","\u002Fget-started\u002Ffirst-work-item","1.get-started\u002F2.first-work-item",{"title":25,"path":26,"stem":27},"Troubleshooting and FAQ","\u002Fget-started\u002Ftroubleshooting","1.get-started\u002F3.troubleshooting",{"title":29,"path":30,"stem":31,"children":32},"Concepts","\u002Fconcepts","2.concepts",[33,35,39,43,47],{"title":10,"path":30,"stem":34},"2.concepts\u002Findex",{"title":36,"path":37,"stem":38},"Vocabulary","\u002Fconcepts\u002Fvocabulary","2.concepts\u002F1.vocabulary",{"title":40,"path":41,"stem":42},"How a work item runs","\u002Fconcepts\u002Fhow-a-work-item-runs","2.concepts\u002F2.how-a-work-item-runs",{"title":44,"path":45,"stem":46},"Caps and budgets","\u002Fconcepts\u002Fcaps-and-budgets","2.concepts\u002F3.caps-and-budgets",{"title":48,"path":49,"stem":50},"Why a permission gate","\u002Fconcepts\u002Fpermission-gate","2.concepts\u002F4.permission-gate",{"title":52,"path":53,"stem":54,"children":55},"Guides","\u002Fguides","3.guides",[56,58,62,66,70,74,78,82,86,90,94,98,102,106],{"title":10,"path":53,"stem":57},"3.guides\u002Findex",{"title":59,"path":60,"stem":61},"Use Kraft from your agent","\u002Fguides\u002Fagent-integration","3.guides\u002F01.agent-integration",{"title":63,"path":64,"stem":65},"Kraft Lite","\u002Fguides\u002Fkraft-lite","3.guides\u002F02.kraft-lite",{"title":67,"path":68,"stem":69},"Remote access","\u002Fguides\u002Fremote-access","3.guides\u002F03.remote-access",{"title":71,"path":72,"stem":73},"Add or override a harness","\u002Fguides\u002Fadding-a-harness","3.guides\u002F04.adding-a-harness",{"title":75,"path":76,"stem":77},"Schedule or webhook work","\u002Fguides\u002Fschedule-and-webhook-work","3.guides\u002F05.schedule-and-webhook-work",{"title":79,"path":80,"stem":81},"Add a security review or a gate reviewer","\u002Fguides\u002Fadd-review-agents","3.guides\u002F06.add-review-agents",{"title":83,"path":84,"stem":85},"Kraft for VS Code","\u002Fguides\u002Fvscode","3.guides\u002F07.vscode",{"title":87,"path":88,"stem":89},"Reviewing a change","\u002Fguides\u002Freview-a-change","3.guides\u002F08.review-a-change",{"title":91,"path":92,"stem":93},"Write your own chain","\u002Fguides\u002Fwrite-your-own-chain","3.guides\u002F09.write-your-own-chain",{"title":95,"path":96,"stem":97},"Switch a harness","\u002Fguides\u002Fswitch-harness","3.guides\u002F10.switch-harness",{"title":99,"path":100,"stem":101},"Upgrade your templates","\u002Fguides\u002Fupgrading-templates","3.guides\u002F11.upgrading-templates",{"title":103,"path":104,"stem":105},"Operations","\u002Fguides\u002Foperations","3.guides\u002F12.operations",{"title":107,"path":108,"stem":109},"Worker Kit","\u002Fguides\u002Fworker-kit","3.guides\u002F13.worker-kit",{"title":111,"path":112,"stem":113,"children":114},"Reference","\u002Freference","4.reference",[115,117,139,183,201,205,227,231,235,239],{"title":10,"path":112,"stem":116},"4.reference\u002Findex",{"title":118,"path":119,"stem":120,"children":121},"CLI","\u002Freference\u002Fcli","4.reference\u002F1.cli\u002Findex",[122,123,127,131,135],{"title":10,"path":119,"stem":120},{"title":124,"path":125,"stem":126},"Item verbs","\u002Freference\u002Fcli\u002Fitem","4.reference\u002F1.cli\u002F2.item",{"title":128,"path":129,"stem":130},"View verbs","\u002Freference\u002Fcli\u002Fview","4.reference\u002F1.cli\u002F3.view",{"title":132,"path":133,"stem":134},"Repo verbs","\u002Freference\u002Fcli\u002Frepo","4.reference\u002F1.cli\u002F4.repo",{"title":136,"path":137,"stem":138},"Admin verbs","\u002Freference\u002Fcli\u002Fadmin","4.reference\u002F1.cli\u002F5.admin",{"title":140,"path":141,"stem":142,"children":143},"Configuration","\u002Freference\u002Fconfiguration","4.reference\u002F2.configuration\u002Findex",[144,145,155,159,163,167,171,175,179],{"title":10,"path":141,"stem":142},{"title":146,"path":147,"stem":148,"children":149},"Repos","\u002Freference\u002Fconfiguration\u002Frepos","4.reference\u002F2.configuration\u002F2.repos\u002Findex",[150,151],{"title":10,"path":147,"stem":148},{"title":152,"path":153,"stem":154},"Workspaces","\u002Freference\u002Fconfiguration\u002Frepos\u002Fworkspaces","4.reference\u002F2.configuration\u002F2.repos\u002F3.workspaces",{"title":156,"path":157,"stem":158},"Policy","\u002Freference\u002Fconfiguration\u002Fpolicy","4.reference\u002F2.configuration\u002F3.policy",{"title":160,"path":161,"stem":162},"Library and chains","\u002Freference\u002Fconfiguration\u002Flibrary-and-chains","4.reference\u002F2.configuration\u002F4.library-and-chains",{"title":164,"path":165,"stem":166},"Harnesses file","\u002Freference\u002Fconfiguration\u002Fharnesses-file","4.reference\u002F2.configuration\u002F5.harnesses-file",{"title":168,"path":169,"stem":170},"Access","\u002Freference\u002Fconfiguration\u002Faccess","4.reference\u002F2.configuration\u002F6.access",{"title":172,"path":173,"stem":174},"Intake","\u002Freference\u002Fconfiguration\u002Fintake","4.reference\u002F2.configuration\u002F7.intake",{"title":176,"path":177,"stem":178},"Sandbox host","\u002Freference\u002Fconfiguration\u002Fsandbox","4.reference\u002F2.configuration\u002F8.sandbox",{"title":180,"path":181,"stem":182},"Environment variables","\u002Freference\u002Fconfiguration\u002Fenvironment-variables","4.reference\u002F2.configuration\u002F9.environment-variables",{"title":184,"path":185,"stem":186,"children":187},"Chain nodes","\u002Freference\u002Fchain-nodes","4.reference\u002F3.chain-nodes\u002Findex",[188,189,193,197],{"title":10,"path":185,"stem":186},{"title":190,"path":191,"stem":192},"Subprocess tasks","\u002Freference\u002Fchain-nodes\u002Fsubprocess-tasks","4.reference\u002F3.chain-nodes\u002F2.subprocess-tasks",{"title":194,"path":195,"stem":196},"Fix loop and judge","\u002Freference\u002Fchain-nodes\u002Ffix-loop","4.reference\u002F3.chain-nodes\u002F3.fix-loop",{"title":198,"path":199,"stem":200},"Result file","\u002Freference\u002Fchain-nodes\u002Fresult-file","4.reference\u002F3.chain-nodes\u002F4.result-file",{"title":202,"path":203,"stem":204},"Permission gate","\u002Freference\u002Fpermissions","4.reference\u002F4.permissions",{"title":206,"path":207,"stem":208,"children":209},"Agent harnesses","\u002Freference\u002Fharnesses","4.reference\u002F5.harnesses\u002Findex",[210,211,215,219,223],{"title":10,"path":207,"stem":208},{"title":212,"path":213,"stem":214},"Unattended runs","\u002Freference\u002Fharnesses\u002Funattended-runs","4.reference\u002F5.harnesses\u002F2.unattended-runs",{"title":216,"path":217,"stem":218},"Agent profiles","\u002Freference\u002Fharnesses\u002Fagent-profiles","4.reference\u002F5.harnesses\u002F3.agent-profiles",{"title":220,"path":221,"stem":222},"Harness files","\u002Freference\u002Fharnesses\u002Fharness-files","4.reference\u002F5.harnesses\u002F4.harness-files",{"title":224,"path":225,"stem":226},"Fallback and escalation","\u002Freference\u002Fharnesses\u002Ffallback-and-escalation","4.reference\u002F5.harnesses\u002F5.fallback-and-escalation",{"title":228,"path":229,"stem":230},"Inbound triggers","\u002Freference\u002Ftriggers","4.reference\u002F6.triggers",{"title":232,"path":233,"stem":234},"HTTP API","\u002Freference\u002Fhttp-api","4.reference\u002F7.http-api",{"title":236,"path":237,"stem":238},"MCP tools","\u002Freference\u002Fmcp-tools","4.reference\u002F8.mcp-tools",{"title":240,"path":241,"stem":242},"Events","\u002Freference\u002Fevents","4.reference\u002F9.events",{"title":244,"path":245,"stem":246,"children":247},"Project","\u002Fproject","5.project",[248,250,254,258,262,266],{"title":10,"path":245,"stem":249},"5.project\u002Findex",{"title":251,"path":252,"stem":253},"Architecture","\u002Fproject\u002Farchitecture","5.project\u002F1.architecture",{"title":255,"path":256,"stem":257},"Contributing","\u002Fproject\u002Fcontributing","5.project\u002F2.contributing",{"title":259,"path":260,"stem":261},"Security","\u002Fproject\u002Fsecurity","5.project\u002F3.security",{"title":263,"path":264,"stem":265},"Data and privacy","\u002Fproject\u002Fdata-and-privacy","5.project\u002F4.data-and-privacy",{"title":267,"path":268,"stem":269},"Status and support","\u002Fproject\u002Fstatus-and-support","5.project\u002F5.status-and-support",{"id":271,"title":194,"body":272,"description":700,"extension":701,"links":702,"meta":703,"navigation":704,"path":195,"seo":705,"stem":196,"__hash__":706},"docs\u002F4.reference\u002F3.chain-nodes\u002F3.fix-loop.md",{"type":273,"value":274,"toc":691},"minimark",[275,288,293,356,359,415,427,431,441,471,474,478,481,527,539,546,562,566,573,593,597,600,617,671],[276,277,278,279,283,284,287],"p",{},"An exec node's ",[280,281,282],"code",{},"fix_loop"," repairs the node and measures it again until it\npasses. This page is the loop's contract: when it opens, what runs in each\ncycle, and how the judge's verdict is read. For why loops and caps work the\nway they do, see ",[285,286,44],"a",{"href":45},".",[289,290,292],"h2",{"id":291},"keys","Keys",[294,295,296,309],"table",{},[297,298,299],"thead",{},[300,301,302,306],"tr",{},[303,304,305],"th",{},"Key",[303,307,308],{},"Meaning",[310,311,312,330,346],"tbody",{},[300,313,314,324],{},[315,316,317,320,321],"td",{},[280,318,319],{},"tasks"," or ",[280,322,323],{},"steps",[315,325,326,327,287],{},"The repair. Runs as an ordered group, like a node's own steps. No task or step in it may take an ",[280,328,329],{},"on_failure",[300,331,332,337],{},[315,333,334],{},[280,335,336],{},"judge",[315,338,339,340,342,343,287],{},"Optional. One task of any kind, which may not take an ",[280,341,329],{},". The shipped one is ",[280,344,345],{},"strict_judge",[300,347,348,353],{},[315,349,350],{},[280,351,352],{},"max_attempts",[315,354,355],{},"Optional, above 0. The loop's attempt limit.",[276,357,358],{},"The loop's limits resolve narrowest last, each replacing only what it sets:",[360,361,362,385,399,405],"ol",{},[363,364,365,368,369,372,373,376,377,380,381,384],"li",{},[280,366,367],{},"policy.yaml","'s ",[280,370,371],{},"loops.\u003Cnode>.fix_loop"," entry, else its ",[280,374,375],{},"default","\n(",[280,378,379],{},"attempts"," and ",[280,382,383],{},"wall_clock_s",");",[363,386,387,388,391,392,394,395,398],{},"the node's ",[280,389,390],{},"policy",": ",[280,393,352],{},", and ",[280,396,397],{},"timeout_minutes"," for the wall\nclock;",[363,400,401,402,404],{},"the loop's own ",[280,403,352],{},";",[363,406,407,408,410,411,414],{},"the work item's own ",[280,409,352],{}," (",[280,412,413],{},"kraft item set-policy",").",[276,416,417,418,420,421,423,424,287],{},"See ",[285,419,156],{"href":157},". A node with a ",[280,422,282],{}," cannot\nbe ",[280,425,426],{},"read_only",[289,428,430],{"id":429},"when-the-loop-opens","When the loop opens",[276,432,433,434,436,437,440],{},"After the node's tasks run (and after any ",[280,435,329],{}," recovery), Kraft reads\nevery measuring task's findings and records a ",[280,438,439],{},"findings_measured"," event. The\nloop opens when either is true:",[442,443,444,460],"ul",{},[363,445,446,447,450,451,453,454,380,457,384],{},"a finding's severity is in ",[280,448,449],{},"findings.loop_severities"," in ",[280,452,367],{},"\n(default ",[280,455,456],{},"critical",[280,458,459],{},"important",[363,461,462,463,465,466,470],{},"a task failed without reporting any findings. Kraft writes one ",[280,464,456],{},"\nfinding for it, as a ",[285,467,469],{"href":468},"\u002Freference\u002Fchain-nodes\u002Fsubprocess-tasks#what-a-fix-loop-sees","subprocess task","\ndescribes.",[276,472,473],{},"Otherwise the node completes. Findings below the loop severities are kept and\nshown at the review gate.",[289,475,477],{"id":476},"one-cycle","One cycle",[276,479,480],{},"Each cycle runs these checks in order:",[360,482,483,490,500,508,515,521],{},[363,484,485,486,489],{},"A measuring task ended ",[280,487,488],{},"needs_context",": the item stops with its question.",[363,491,492,493,320,496,499],{},"Every failure came from a task Kraft runs itself (a ",[280,494,495],{},"builtin",[280,497,498],{},"forge","\ntask), and nothing else reported a finding: the item stops, because no\nworker commit can change the outcome.",[363,501,502,503,507],{},"A ",[285,504,506],{"href":505},"\u002Fconcepts\u002Fcaps-and-budgets#token-and-dollar-budgets","token or dollar budget","\nis spent: the item stops.",[363,509,510,511,514],{},"The ",[285,512,336],{"href":513},"#the-judge",", when it is due.",[363,516,517,518,287],{},"The attempt count or wall clock is past its limit:\n",[280,519,520],{},"\u003Cnode>.fix_loop exhausted after N fix cycle(s)",[363,522,523,524,287],{},"After a repair, the same set of loop-severity findings came back, or one\nfinding came back unchanged three cycles running: ",[280,525,526],{},"stuck: ...",[276,528,529,530,533,534,538],{},"Steps 1 to 3 stop the item for you. Steps 5 and 6, and a judge's\n",[280,531,532],{},"stop_needs_human",", leave the node stuck: its\n",[285,535,537],{"href":536},"\u002Fconcepts\u002Fhow-a-work-item-runs#inside-a-node","escalation"," runs before the\nitem stops.",[276,540,541,542,545],{},"If nothing stopped the loop, Kraft records ",[280,543,544],{},"fix_cycle_started",", runs the\nrepair, and measures the whole node again from its first step.",[276,547,548,549,552,553,320,555,557,558,561],{},"A repair that ends ",[280,550,551],{},"done",", or that fails in an agent or subprocess task, spends\nthe attempt. A repair that was paused, rate limited or refused to start, or\nwhose ",[280,554,495],{},[280,556,498],{}," step failed, did not try anything: Kraft gives the\nattempt back (",[280,559,560],{},"fix_cycle_refunded",") instead of measuring again.",[289,563,565],{"id":564},"what-a-repair-task-is-told","What a repair task is told",[276,567,568,569,572],{},"A repair task's own ",[280,570,571],{},"prompt"," is not used. Its harness, profile, model and skill\nstill are. Kraft writes its instruction instead:",[442,574,575,578,584,587,590],{},[363,576,577],{},"which tasks failed, or that a review reported findings;",[363,579,580,581,404],{},"the loop-severity findings, each with its tag, a finding that was in the last\nmeasurement marked ",[280,582,583],{},"REPEAT",[363,585,586],{},"the judge's reasoning, when the judge ran this cycle;",[363,588,589],{},"once there are two rounds, every round so far, with any finding that was\nfixed and came back;",[363,591,592],{},"the path of the previous attempt's result file and session summary.",[289,594,596],{"id":595},"the-judge","The judge",[276,598,599],{},"The judge runs before every cycle except the first one of each entry into the\nnode, which repairs without asking. It does not run when a steer from a person\nor a gate review is waiting to be delivered: the steer is the answer to the\ntrend the judge would rule on.",[276,601,602,603,605,606,609,610,613,614,287],{},"Its own ",[280,604,571],{}," is not used either. Its instruction lists every round so far\nwith each finding's tag, the attempts used of the limit, and the seconds used\nof the wall clock. It answers in its ",[285,607,608],{"href":199},"result file",":\n",[280,611,612],{},"verdict",", and its reasoning in ",[280,615,616],{},"concerns",[294,618,619,630],{},[297,620,621],{},[300,622,623,627],{},[303,624,625],{},[280,626,612],{},[303,628,629],{},"What happens",[310,631,632,645,658],{},[300,633,634,639],{},[315,635,636],{},[280,637,638],{},"continue",[315,640,641,642,644],{},"The cycle goes ahead. The repair task gets ",[280,643,616],{}," as the judge's reasoning.",[300,646,647,651],{},[315,648,649],{},[280,650,532],{},[315,652,653,654,657],{},"The node is stuck with ",[280,655,656],{},"judge: "," and the reasoning.",[300,659,660,665],{},[315,661,662],{},[280,663,664],{},"stop_downgrade",[315,666,667,668,670],{},"The node completes with the remaining findings unresolved, and ",[280,669,616],{}," is the note you see at the review gate. Only when no task in the node failed outright; otherwise the cycle goes ahead.",[276,672,673,674,676,677,680,681,683,684,686,687,690],{},"Kraft reads a verdict only from a judge that ended ",[280,675,551],{}," or\n",[280,678,679],{},"done_with_concerns",". Any other status, a missing verdict or an unknown one\ncounts as ",[280,682,638],{},". A verdict never buys a cycle past the attempt limit or\nthe wall clock: step 5 runs after the judge. A loop with no ",[280,685,336],{}," always\ncontinues. Each verdict is recorded as a ",[280,688,689],{},"judge_verdict"," event.",{"title":692,"searchDepth":693,"depth":693,"links":694},"",2,[695,696,697,698,699],{"id":291,"depth":693,"text":292},{"id":429,"depth":693,"text":430},{"id":476,"depth":693,"text":477},{"id":564,"depth":693,"text":565},{"id":595,"depth":693,"text":596},"When a node's fix loop opens, what its repair tasks are told, when the judge runs, and what each verdict does.","md",null,{},true,{"title":194,"description":700},"DnpSJuL6c6Xiod-sEwFyS35aYSSVxWTqv2bUdLpShSY",[708,710],{"title":190,"path":191,"stem":192,"description":709,"children":-1},"What Kraft passes a subprocess task, how it runs, and how its exit code and result file become a status.",{"title":198,"path":199,"stem":200,"description":711,"children":-1},"The JSON file a task writes at $KRAFT_RESULT_PATH, and every field Kraft reads from it.",1790824510086]