Isaac: Welcome to Never Rewrites. I'm Isaac Askew. Jeffrey Sherman: And I'm Jeffrey Sherman. And today we're going to ponder the question: in an agentic workflow, when should the first human touch be? So, kicking this off, it's been in my head. I working as always with legacy code, not even legacy code, code that has evolved organically over 16 years. And there's a few anti-patterns in the code base. And in the olden days, when I noticed a anti-pattern that was having an impact, I would fix it. And now when I see it, I'm just like, yes, I remember this anti-pattern. in this case it's do running a query that's select star, count star, select count star from a table, and then taking that answer and seeing if it's greater than zero. Right? So it's just an existence check. And you can transform that into a much more efficient Query where you do select one comma, from this thing, and it just if if there a row return in a limit one and it'll return the first time it sees a row, so it'll be faster. and so Isaac: Right. Jeffrey Sherman: it's a pattern. And on giant tables or tables without indexes or whatever, this could you know cause significant delays. And for a long tail of it, there's nothing. So this morning I I Got reminded of this anti-pattern. I was like, all right, I haven't looked at this in a while. Fired up Claude. I said, hey Claude, look at the code. and determine when we're doing a count star that also what we just check using it as an existence check. And here's the patterns of it. and create Jira tickets and then create pull requests, you know, then create the branches and then create pull requests. You know, and then in between there, it will argue with a Reviewer bot. And I'm like, I'm not gonna look at any of this stuff until it's done. Right? When when you tell me this thing is approved by the reviewer bot, then I'm gonna look. How and some of those are wrong, right? Just some of them are just like, no, no, you're wrong. like this is not actually an existence check. There's other stuff going on. And so Isaac: okay. Jeffrey Sherman: it just as an example, but it it made me wonder, like, is this a reasonable thing to do? Should I have looked at the Jiro tick like the ticket description? Because I would have known it was wrong from the Jira from the ticket description. Isaac: What was the gear description Jeffrey Sherman: But I didn't I Isaac: that made it look wrong? Jeffrey Sherman: it was in this case it was using into a clause inside of a select statement. So it was like select blah blah blah where and then inside that it had a subclause and so that subclause confused Claude 'cause it was Isaac: okay. Yeah. Jeffrey Sherman: hairy. It wasn't like a a straight, you know, select star and then or select count star and then afterwards, you know, if count is greater than zero. It was in a subquery where it got confused and I knew it would get confused because I remember that piece Isaac: Gotcha. Jeffrey Sherman: of code because I got confused there the first time too. And caused an incident. Isaac: Oops. Right. Jeffrey Sherman: As soon as I c as soon as I saw it, I'm like, this code. Yeah, I remember this. No, this is not don't. I know why you think that, 'cause I thought that. Don't do that. Isaac: Gotcha. So you're wondering when the first touch point is for as a human, do I inspect at the JIRA creation phase? Do I inspect at Jeffrey Sherman: Isn't it? Isaac: the open PR phase? After the reviewer you said you like a reviewer bot that goes in too, and I'm sure that flags it is reviewed so you go in at that point. Jeffrey Sherman: Right, yeah, the reviewer bot will go in and be like, there's an edge case here, or you didn't add enough tests and then the agent bot will go, you're right, I didn't and they can talk to each other in the way that Isaac: Mm-hmm. Jeffrey Sherman: bots talked very verbosely to each other and you're just like okay. and I did the same thing, where I stuck it on an error log. So you the the same problem of like, hey, look at the error look at the error stream. Look at the logs to last 24 hours. Look at everything that's logged at error. Aggregate that, create tickets, give create solutions, and I'm gonna look when you think you fix the bug. And again, probably eighty, eighty five percent of those are right, straight out of the gate, this This endpoint, if you pass in a date as null, null as a string, and so the date validator tries to parse null as a string and blows up. And so we return a five hundred and this should be a four hundred where you've submitted an invalid date. Isaac: Okay. Jeffrey Sherman: Right? sure. Easy peasy. Go right ahead. That's a no-brainer change. and then some of them are like, you these two if statements are in opposition. It's a nested if statement. It's in opposition. This code block can never execute, therefore delete the code block. And I'm like, No. One of those if statements is wrong. This code block should execute. You've I d you've you've correctly identified a bug here, but it's the wrong bug. Isaac: Got it. Right, right. So like it's not that the code is dead, it's that we should fix the ifs the conditional so that we could get to that block because that that's relevant code. Jeffrey Sherman: Mm-hmm. Isaac: Gotcha. Jeffrey Sherman: But the cost of that, right, and and here's the the back and forth in my head, the cost of letting Claude be wrong and arguing with the review bot and all that is tokens of some amount. And the cost of me having to review five PRs or five like five look at five tickets to find the one that maybe needs me to massage it before it's ready is going to be much, much slower. Isaac: Right. Jeffrey Sherman: So is it okay to just let it go all the way to the end, right? It's and I don't have auto merge on, right? So the the code is it does not get merged, it just gets reviewed by a review bot, generated and reviewed. And so there's no direct risk in this case, right? But maybe I could even go a little further, like, well, you know, if the review bot is happy, just do it. Isaac: Got it. Jeffrey Sherman: in the case of those positional if statements where it wanted to delete the code, that code had been wrong for four years. I I had the whole Boy Scout rule fear of what's gonna happen if I fix this? And this code runs now. Isaac: Right. Yeah, and that's actually another good philosophical question of if the code is dead and it never got there to begin with, do you clean it up by killing the dead code and then write a new ticket to actually correctly implement the feature? Or do you just fix the feature there? You'd want to almost like clean up the dead code first and you already have a commit history, then fix it. Rather than otherwise you'll just kinda keep hydrating heads out of things that might need to be fixed. Jeffrey Sherman: Mm-hmm. Isaac: but I think to your main question is when is it good to check in as a human? It sounds like w you did catch it, you don't have auto merge on, you were able to use your role as a human to go through and correctly flag areas and realize, okay, some of these are wrong. So is the better question that you actually effectively did your role right there or that you could have caught the issue earlier in the pipeline. before the when the tickets were being created, should you have reviewed the ticket essentially? Which might be a little more tricky than reviewing actual diffs of code. Because the description of a problem versus actually seeing the code is different. So in that case waiting for the PR to be opened so you could see it is a good part for you to do the check. Jeffrey Sherman: Right, this it's it flies in the face of I'm tr I'm thinking like batch manufacturing versus lean or just in time. Where right, the way Toyota got good, the whole Kaizen thing is build one at one at a time in in sequ in series, boom boom boom boom boom. Isaac: Mm-hmm. Jeffrey Sherman: And go from there, A, B, C, and then so it's good on each step of the way. So you don't have work in progress, you don't have this. And here I'm saying it feels like the opposite. Where or I am totally doing the opposite. I am batching up, have AI batch up a ton of work. Right? I've got Isaac: Yeah. Jeffrey Sherman: fifty PRs ready for me to sorry, that's not right. I have a hundred and fifty PRs Isaac: Mm. Jeffrey Sherman: that I started last night asking asking it to generate stuff off the logs and then generate stuff for this anti pattern that I just got reminded of. I'm like, there's a hundred and fifty things right now and now I'm just burning through them Isaac: Yeah. Jeffrey Sherman: somewhat randomly. w and, you know, either saying yes, no, or looking at it and be like, that's a weird description. I don't want to deal with it right this second. Isaac: Yeah. Jeffrey Sherman: Right, 'cause that's from a cost standpoint, I guess there's at no point is it better to move the human earlier. But from a whip standpoint, from work in progress standpoint, maybe it Isaac: Yeah. Jeffrey Sherman: is. Isaac: Well, there's also a way to slightly evade the question and catch it even earlier. And it's yeah, it's at the very Jeffrey Sherman: Yes. Evade the question is always good. Put on that consultant tab. Isaac: beginning of the process of like why did you spend all the money looking for all those inefficiencies? Like, is there any even if even if an existence check could be made better in those cases, was the problem bad enough to spend money? investigating and writing tickets for that particular area. if there's 150 PRs and let's say five areas actually would greatly benefit from that change because it really greatly reduces the time the database takes to execute and return or, something like that, versus some other ones that you found in the code base that were scattered on smaller features that sure they were inefficient, but they were on tables that actually are really small and they always will will be small. And it doesn't you you almost spend more time of your own time not only Spinning up the PR and the Jero ticket, but also using your time to review the code in an area that's like no one cares about this area. And a human actually would never have gotten to it. Jeffrey Sherman: So I had thought about that and I had two counter arguments there. Isaac: Mm-hmm. Jeffrey Sherman: counter argument one the more the anti pattern exists in the code, the more the agents will use the anti pattern when they are generating code. So that was my first thing of like, if I leave this, it's going to think this if this is an acceptable pattern, and the agents will continue to do it, and that's Isaac: Mm, okay. Jeffrey Sherman: a problem, and that makes it worth fixing. and the other one is. I as a human am slow to find this stuff and slow and fast to judge it. The agent is fast to find it, but does not have my judgment, in terms of, these are the important Isaac: Yeah. Jeffrey Sherman: tables. Even if I give it to it makes mistakes. And so the thing in my head is like, well, I could tell to just do the important tables, but I could be wrong about what the important tables are. And also probably Isaac: Mm, yep. Jeffrey Sherman: by the time I explained the important tables and how to decide and triage and it would probably be take longer, I might as well just do them all. Because it's still it's not an unlimited scope, right? Where it's a hundred and fifty. Isaac: Yeah. Jeffrey Sherman: And then this problem will probably be gone for quite a while, right? I should still check in it periodically. But it it should be mostly fixed. Isaac: So I like I like part of the argument. Jeffrey Sherman: All right. Isaac, it's our podcast. You can't disagree with me. I I'm perfect. Isaac: I've made a similar argument before with like spending time to clean up dead code. And I found one of the projects I was working at the last job where we use AI, there was a lot of like like over 50% of the code base was dead code. It was a huge amount. And I thought, okay, this We could justify cleaning this up just so that we don't give Claude bad context on what we should support, which is really similar to your argument of don't leave these bad practices in because it will look at that and think this is an acceptable thing to do. Or just somehow mislead it. So cleaning it for the sake of context, Jeffrey Sherman: Yes. And how'd that work out? Isaac: I don't really know. I can't really prove that it felt better after, Jeffrey Sherman: Mm. Isaac: I'm really sure. Which is not a good answer too for people who want you to quantify how spending or using all your time to clean up and QA that. But I think it must be better. Jeffrey Sherman: Right, well it would Right it would have shown up in token spend. Mm maybe but yeah. Isaac: Yeah, yeah, I imagine it must have. Yeah. I didn't measure that. But either way, that's an argument for a separate day. So I I like that concept for for part of your argument here. And I think that's relevant. But I I I don't know if I can actually quantify off the top of my head that the danger of replicating that practice versus cleaning it up. versus the amount of spend versus all the amount of manual time you have to go through and approve a hundred and fifty separate PRs and investigate them is impactful enough compared to what else could be worked on at the company. Because I don't know your situation. I just in my head, if I'm thinking of hmm, something feels like I would like to investigate more, something about that flow feels like you've you've got a point, but I don't know if the point is sharp enough, so to speak, Jeffrey Sherman: Yes. Isaac: to justify the spend. Especially the manual spend on your end. if you're if you're clo if you're correcting select statements for the next two weeks and something else it breaks that you you know needs your attention, it seems like there might be diminishing returns there. Jeffrey Sherman: Well, right, and in this case, you know, we're talking say fifty merge requests that are all gonna be one Isaac: Yeah. Jeffrey Sherman: or two liners. So call it you know, it's the risk of maybe two hours, call maybe three hours of Isaac: Mm. Jeffrey Sherman: doing code changes that quite profitably don't have any value and are keeping me from doing code changes that do have value versus missing stuff and all the bad things that might happen if we leave the code there. Right. So it's it's very small. Mm. Isaac: And an and a third option of what if as you're going through and fixing these you accidentally approve one that shouldn't have been fixed and you do break something. Jeffrey Sherman: Right, create an issue. Isaac: you create an issue from trying to clean it up. And that it whereas normally normally it might not have been an issue if you just left it be efficient for a bit. So it's a trade off. I'm not, you I don't know your your situation or the code areas that you're tinkering with. I just kinda like it it stuck out in my head as like a call out, I guess. Jeffrey Sherman: Right, yeah, there's always the the more changes you do, especially in my situation where we have fairly large releases once a week. So Isaac: Mm, yeah, okay. Jeffrey Sherman: adding an extra fifty merges into a weekly release is a lot more dangerous than adding one merge into a continuous release. Yeah, just one more continuous release. Isaac: Gotcha. Yeah, and you guys just do weekly, not daily? Jeffrey Sherman: Yeah. Isaac: Got it. Okay. 'Cause I imagine your QA process for a weekly release is a bit different 'cause people you spend usually if you have a longer cadence, then you you have a a more fleshed out QA flow. Versus if you're doing it daily, sometimes you're like moving so fast you don't actually have time for a full very thorough QA flow. Jeffrey Sherman: Yes. But the stuff that doesn't matter, the the things that would have been just fine to not do are probably not particularly tested in the manual QA because they're not that important. And so it would just be the unit tests. So it would not the additional QA wouldn't add any extra protection. Isaac: Hmm, I see. Well, either way, back to our original point, is when is it good for you to be to step in the process as a human? as we have talked through it in the last X minutes, is anything do you feel like Jeffrey Sherman: Sixteen. Isaac: do you feel like y you're still centered around maybe that it's fine for doing it at the PR review phase? Jeffrey Sherman: I am. I d I still don't like it because it creates a lot of whip and I'm convinced but, right, flip side, the problem with whip is it it becomes stuff that has to get be maintained and it has costs for sitting around, etc. etcetera. Isaac: Yeah. Jeffrey Sherman: Right and it it can dry rot or get a merge conflict if in the digital world. But also this is software and it's an agent who's going to fix it and have do the rework. So is the cost of WIP also much lower? Because I I feel like Isaac: I'd say yeah. Jeffrey Sherman: I feel like in this workflow, the cost of work in progress is so much lower, almost infinitesimal, that going from continuous or Kaizen to batch. doesn't have the same impact that it would if it was in the physical world. Isaac: Yeah. This is loosely reminding me of a a separate argument. People joke about Jeffrey Sherman: Mm-hmm. Isaac: about there was like this whole flow of like what is each generation the best at in their joke answers and the joke answers for boomers was always turning off the light when you exit a room. Right. Jeffrey Sherman: Yeah. Isaac: So I was laughing at this idea of like cause like especially now when I was in a home ownership out here in Colorado, solar is a big issue. people get rebates of it and they really won't install solar because we have a lot of sunny days. And I'm thinking, okay, well if you've got solar power to the point you've got enough panels that covers your actual cost, does it matter to leave a light on? Is it inefficient Jeffrey Sherman: Mm. Isaac: or bad to waste energy? Because are you really wasting it if the sun is powering it? And so as things get cheaper and cheaper in the digital world too, if work in progress at a Toyota plant was very expensive and work in progress now with a Gentic programming gets cheaper and cheaper and cheaper. Do you care about the inefficiencies of doing things or overdoing things or having plenty of work in progress or having a bottleneck there if you can automate some of that? And I think that's the main route of where a lot of where I see a lot of people at companies now when you see the bottleneck becoming the QA thing, or just Jeffrey Sherman: Mm-hmm. Isaac: spinning up people people don't mind spinning up brand new projects very quickly, or even transient software that we talked about before, like software I'm gonna spin up. for my band and then if our band goes away I'll just delete the app because it's so cheap to make software. Do I care about Jeffrey Sherman: Mm-hmm. Isaac: the waste anymore? Because the waste is pennies. at what point do I stop trying to optimize here? And so I think that's kinda somewhat loosely tied in with this idea of work in progress now because it's become so cheap to have work in progress. Well, still expensive, but relative it's become Jeffrey Sherman: Mm-hmm. Isaac: cheaper to have work stay in progress. And if there's a merge conflict, I can say Claude fix a merge conflict. And it'll do repas for me. Yeah. Yeah. Jeffrey Sherman: Right, I've said it several times today. And I I said it really inefficiently go through this list of a hundred and fifty MR MRs and double check and rebase anything that's got a merge conflict and resolve the merge conflict. And I'm just Isaac: Yeah. Jeffrey Sherman: like go. Isaac: And I also I've seen a lot of i in somewhat related territory too, there's a lot of ability to a address tech debt these days. Because the same amount of time you're QAing a huge release, you could also go ahead and throw in a PHP upgrade in there. Or go ahead and throw in some other kind of package upgrade that needs to be just as thoroughly tested in it. And you don't have to do all the work it takes to do the upgrade. You c I mean if you have good and you have good test coverage for everything, you can bump a major version and have be relatively confident with all your different happy path testing and everything that it did a good job. But you don't have to do the manual work of identifying everything. before if I had to go upgrade major version of PHP, that took a long time to get make sure everything across the entire Jeffrey Sherman: Mm-hmm. Isaac: repo was using kosher syntax the next version or anything deprecated was removed. AI can do that while you sleep. Right. So we start running out of work as engineers because we keep wanting to go like I this is my feeling at least is I keep going, okay, well now I can upgrade all the packages. And okay, now the packages are upgraded. Now I can finally remove the dead code. Okay, the dead codes removed. Cool. and then you get smaller and smaller and smaller changes until you're like, I guess we just build more features now because we've addressed a lot of the tech debt. Right. So Jeffrey Sherman: Mm-hmm. Isaac: that becomes cheaper and cheaper. And then the you just all I said I feel like all of the expense goes towards QA. Or just like test automated testing QA. Anything to make sure that all the changes the massive churn that you're causing in your code base is not destroying anything customer facing. Jeffrey Sherman: Well, also the other at the front end, right? You you should be spending your time as an engineer thinking about what the solution should be. Like, you Isaac: Yeah. Jeffrey Sherman: know, I've got this code and does it does what this code is doing make sense? And then at Isaac: Mm-hmm. Jeffrey Sherman: the other end it's it does this work correctly. Right. In in my examples I'm taking this something is wrong. Right, there's a bug, there's an inefficient database pattern. We know what like it it's very contained of this, you know. fix this thing. But w so it excluded the entire think about how your product works. Isaac: Mm-hmm. Yeah. Jeffrey Sherman: Which I think is really where engineers should be spending their time at this point. Isaac: Yeah, actually that's that's the same argument that I've made before where like engineers kind of have a habit, including me, in in the past of getting lost in picking up the geoticket and just fixing the problem that's explained, without really asking questions like why? Why do I fix this? Who are you to tell me to fix? Not not that Jeffrey Sherman: Yeah. Isaac: bad. But like pushing back before you you get the work done. and Jeffrey Sherman: Right. Isaac: I think before I and pr prior I was saying those people, I think those people who are just like, Well, that's what the story said, and I did it just like the story said. You're no better than AI at that point. You should not take commands that literally. You should be asking those reflective questions of, is this really the right way to solve the problem? I mean, yes, you you you did the math and the math checks out, but like no one's using the end result that you came up with. Who cares? Right? Jeffrey Sherman: Right, and this goes back to the question of okay, if you tell AI to do that, when does the human step into the loop to Isaac: Yeah. Jeffrey Sherman: decide if if you've asked AI right, assuming AI has done the work correctly, just take that as a given, did you even ask AI to do useful work? Isaac: I think that it depends. Right. So Jeffrey Sherman: Yeah. Isaac: this is actually an interesting point. I think it depends on if the problem is purely product or technical where you step in at. Right? 'Cause if if it's a purely technical problem, we don't need customer input to tell us something is slow. It's obvious in the logs and we know when to step in and to implement a fix because this is clu I don't have to ask. Who cares it is slow? I just know that's slow and the database says it's slow and things are groaning and not moving fast enough. That's one thing. Versus a product facing thing, it's like, why am I building this thing? Does it work the way I think it should work? Am I assuming it's working this way? Because the ticket says to build this thing, but I'm like, who would use that? Can I get some more information about who's using it and what the main problem is? And I go, This is a bad description. We should put this in there for a little bit extra detail because this solves main problem. So the check in points for those are probably different. One of them is very product y and the other one does not even need product intervention to really tell you I d no one needs to tell me that, I can't load the page because it times out. We should ask a customer about their timeout experience. Just make it work, you know, versus the other producty Jeffrey Sherman: Right, yes. Isaac: ones. Jeffrey Sherman: Right. If your product people are telling you that database queries are too slow, then you have an a big observability problem. Isaac: yeah, that's that's a good point too. You should gotta sho you should have gotten alerted way before they they they complained. Jeffrey Sherman: Yes. All Isaac: So yeah, I think it's it Jeffrey Sherman: right. Isaac: depend the check in depends. Yeah. Jeffrey Sherman: Yeah. All right. It depends. Once again. Thank you all for listening. I'm Jeffrey Sherman. Isaac: And I'm Isaac Askew, and this is Never Rewrite.