g1t/crates/runner/src/revise.rs
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Agents as a team: lifecycle, merge queue, billing and a new shell | 1 | //! Sends the author back to a pull request that is already ready for |
| 2 | //! review, to address what its acceptance checks or a review found. | |
| 3 | //! | |
| 4 | //! The work is the same as making the change in the first place (see | |
| 5 | //! `main`): clone the fork, run the agent on `PROMPT`, commit and push. | |
| 6 | //! What differs is the ending. The pull request stays as it is, with the | |
| 7 | //! agent's account of what it changed added to its session, and a failure | |
| 8 | //! leaves it open for a person to look at. | |
| 9 | ||
| 10 | use crate::report::{Entry, Reporter}; | |
| 11 | ||
| 12 | pub fn main() -> i32 { | |
| 13 | let mut reporter = match Reporter::from_env() { | |
| 14 | Ok(reporter) => reporter, | |
| 15 | Err(error) => { | |
| 16 | eprintln!("g1t-runner: {error:#}"); | |
| 17 | return 2; | |
| 18 | } | |
| 19 | }; | |
| 20 | let outcome = crate::run(&mut reporter); | |
| 21 | // On success the agent's account is already in the session: the harness | |
| 22 | // records its messages as they arrive. | |
| 23 | if let Err(error) = &outcome { | |
| 24 | eprintln!("g1t-runner: {error:#}"); | |
| 25 | reporter.record(Entry::new( | |
| 26 | "note", | |
| 27 | &format!("The revision failed: {error:#}. Nothing was pushed."), | |
| 28 | )); | |
| 29 | } | |
| 30 | reporter.flush(); | |
| 31 | i32::from(outcome.is_err()) | |
| 32 | } |