Open Source Contribution

Year2026
TechnologyOpen Source, Java, AI Agents, Workflow Recovery, Retry & Backoff, Kubernetes, Testing, 开源贡献, 故障恢复, 重试退避, Spring AI Alibaba, Google LangExtract
Project

Open Source Contribution demo

Open Source Contribution video cover
0:00 / 0:06RxJava #8399
Open PR

Open Source · 3 Merged Pull Requests · 2026

Fixes I Contributed to Spring AI Alibaba, Google LangExtract and the Kubernetes Java Client

Three pull requests, each merged by the project's own maintainers. Each one fixes a case where the library worked fine on the normal path but broke when something unusual happened.

At a Glance

Project What was wrong What I changed Pull request
Spring AI Alibaba
Java framework for AI agents
After a human approved a paused agent, its shell command crashed The agent now finds its existing shell again when it resumes #4491
Google LangExtract
Python library that extracts data from text with Gemini
One brief Gemini error (503 or 429) failed the whole document Only the failed piece is retried, a few times, with growing waits #385
Kubernetes Java client
Official Java library for Kubernetes
No working example of how to patch a custom resource correctly Added a runnable example and tests that check the real request #4868

1. Spring AI Alibaba — Keep the Shell After a Pause

The problem

An AI agent can run shell commands. It keeps one shell open, so a command like cd build still applies to the next command.

Some steps need a person to approve them. The agent pauses, the person approves, and the agent continues. When it continued, it had lost track of its shell, so the next command failed with a NullPointerException.

What I changed

Each conversation has an id (threadId) that survives the pause. I added a small lookup table from that id to the open shell. When the agent resumes, it looks up its shell by id and keeps using it, still in the same folder.

sequenceDiagram autonumber actor Person participant Agent participant Table as Lookup table participant Shell Agent->>Shell: open a shell Agent->>Table: save shell under this conversation's id Agent->>Shell: cd build Agent-->>Person: pause, approval needed Person-->>Agent: approve, continue Agent->>Table: find the shell by id Table-->>Agent: same shell as before Agent->>Shell: make, still in the build folder Agent->>Table: remove the entry when finished Agent->>Shell: close the shell
  • The entry is removed when the conversation ends, so the table only holds shells that are still in use.
  • If a caller has no conversation id, the code raises a clear error instead of opening a shell nobody would close.
  • Eight unit tests cover saving, finding, removing, and keeping two conversations apart.

2. Google LangExtract — Retry Only the Piece That Failed

The problem

LangExtract splits a long document into pieces and sends them to Gemini at the same time. If Gemini briefly answered "busy" (503) or "too many requests" (429) for one piece, the whole document failed, and all the pieces that had already succeeded were thrown away.

What I changed

Each piece now retries on its own when the error is temporary. It waits about 1 second, then 2, then 4, up to a limit, and gives up after a few tries. Errors that retrying cannot fix are reported straight away.

flowchart LR Send["Send one piece<br/>to Gemini"] OK{"Success?"} Done["Keep the result"] Temp{"Temporary error<br/>and tries left?"} Wait["Wait, then<br/>double the wait"] Fail["Report the error"] Send --> OK OK -- Yes --> Done OK -- No --> Temp Temp -- Yes --> Wait Wait --> Send Temp -- No --> Fail
Setting Default Meaning
max_retries3Extra tries per piece
retry_delay1 sFirst wait; doubles each time
max_retry_delay16 sLongest wait

Before merging, the maintainer built on my change: random variation in the waits so pieces do not all retry at the same moment, and a check that stops these retries from stacking on top of the Gemini SDK's own retries.


3. Kubernetes Java Client — A Tested Example for Patching

The problem

To change part of a Kubernetes object you send a PATCH request, and the request must say which patch format its body uses. With the generated Java client it is easy to send a patch for a custom resource without that format, and the server then rejects it. The library has a helper, PatchUtils, that sets it correctly, but there was no example for custom resources.

What I changed

  • A runnable example, PatchCustomObjectExample, that patches a custom resource from a JSON file.
  • A short README section: use PatchUtils for patches.
  • Tests against a mock server that check the exact request that goes out, for two patch formats, so the example cannot quietly stop working.
Object result =
    PatchUtils.patch(
        Object.class,
        () ->
            api.patchNamespacedCustomObject(
                    group, version, namespace, plural, name, new V1Patch(patchJson))
                .buildCall(null),
        V1Patch.PATCH_FORMAT_JSON_PATCH,
        client);

What These Have in Common

  • Look at the unusual path. All three bugs only showed up after a pause, a brief outage, or an unusual request.
  • Fix the smallest piece. Recover one shell, retry one piece, show one request, rather than restarting everything.
  • Prove it with tests. Every change came with tests, and every one was reviewed and merged by the project's maintainers.

PR #4491 PR #385 PR #4868


Repository Wiki

Explore the codebases behind the contributions. These Wikis describe Yuqi's forks; the upstream pull requests above remain the contribution evidence.

AI-generated repository documentation; it may lag behind the code. Devin sign-in and workspace access may be required.

Comments

Be kind. Comments are reviewed before appearing.