This changelog covers CocoIndex 1.1.1 through 1.3.1: the 1.2.0 and 1.3.0 minor releases and the 3 patch releases around them. The releases add updates that run only part of an app, data dependencies for memoized functions and components, a Discord source and a Google Docs target, a progress display that lists failures, and an exit status that cron jobs and CI can read.
Before upgrading, read the upgrade notes. They explain the one-time re-chunking after the splitter change, the new exit status of cocoindex update, and which new APIs are experimental.
CocoIndex builds fresh, structured context for AI from sources such as PDFs, codebases, emails, screenshots, and meeting notes, and keeps it up to date with an incremental engine. The source is on GitHub.
- You write pipelines: read updating part of an app, data dependencies and stable memo type IDs.
- You run deployments: read the upgrade notes, then the exit status, the progress display and a run that changes nothing writes nothing.
- You use or build connectors: read the Discord source, the Google Docs target, the Google Drive sign-in and the changes to existing connectors.
Why this release cycle matters
- Update part of an app
App.update(component_selector=...)andcocoindex update --selectrun the components you name and what it takes to reach them. Every other component is neither run nor treated as gone, so you can inspect or debug a few components without processing the rest. - Memoize on what a body read
coco.DataDepandcoco.use_data_dep()record the files an agent session chose to open, or anything else a body reads that its arguments do not name. The memo is reused only while every recorded read still validates. - Read a Discord channel, write a Google DocA Discord source indexes the messages and threads of a channel and reprocesses only what changed. A Google Docs target keeps a doc in step with declared Markdown and rewrites only the paragraphs that changed, so comments on the rest stay.
- Failures listed, and an exit status for CIThe progress display shows one status line, a bar per component and the first failures under it, and every failure logs one
ERRORline. From 1.2.1,cocoindex updateexits 1 when a failure goes unhandled.
The rest of the cycle, in brief:
- No writes on an unchanged run. A component whose run changes nothing no longer writes to the state store, so it pays no fsync. In the PR’s benchmark (a sequential
use_mount!through the Rust SDK, on one machine), the cost per unchanged component went from 8.75 ms to 99.6 µs. - Whole functions per chunk.
RecursiveSplitterkeeps a function, class or block that fits inchunk_sizein one chunk, and a header with the start of its body. The chunk boundaries change, so the first update after upgrading re-chunks. - Memo entries that survive a rename. A type with a stable type ID keeps its memo entries when it moves to another module.
Upgrade notes
Check these before upgrading. Each item names the release it applies from. In short:
- Re-chunking. From 1.2.1,
RecursiveSplitterplaces chunk boundaries differently. The first update after upgrading re-chunks the files it splits and runs the work downstream of the changed chunks again. - Exit status. From 1.2.1,
cocoindex updateexits with status 1 when a component failure goes unhandled. A job that read the exit status as “the process ran” now reads it as “the run had no unhandled failure”. - Progress output. From 1.2.0, the progress display has a new layout, engine logs go to stderr, and every failure logs one
ERRORline. Scripts that parsed the old[Stats]blocks need updating. - Experimental APIs. Data dependencies, the Google Drive personal sign-in and the Google Docs connector are outside the compatibility promise: a later release, a minor one included, may change or remove them.
- Requirements. The localfs connector needs
watchdog7 or later. Discord and Google Docs have their own extras.
The full list, by kind:
Behavior changes: 8 items
RecursiveSplitterkeeps code structure whole (v1.2.1). A function, class or block that fits inchunk_sizestays in one chunk. A header (adef,fn,classorifline, a Markdown heading) stays with the start of its body.min_chunk_sizeis a soft floor: a chunk may be smaller where that avoids a worse split point. The arguments are unchanged, but chunk boundaries differ from 1.2.0, so the next update re-chunks the files it splits. See the splitter section.cocoindex updateexits with status 1 (v1.2.1) when a component failure goes unhandled: no exception handler was registered for it, or every handler re-raised. A handler that returns normally keeps the status at 0.--previewfollows the same rule;--liveis unaffected.- Progress display (v1.2.0).
cocoindex update,cocoindex dropandupdate_blocking(report_to_stdout=True)draw one status line with the components in an aligned column under it. The[Stats]headers are gone. TheRunning app '…' (db path: …)line is nowCocoIndex <version> · Updating <app> · <db path>. Engine logs move from stdout to stderr, colored only on a terminal. Every failure logs oneERRORline, so a run with many failures scrolls one line per failure above the display. AlreadyDeclaredError(v1.2.0). A duplicateuse_statekey raisedRuntimeError. It now raisescocoindex.AlreadyDeclaredError, a subclass ofValueError. Other second declarations in one run (a target state key, a component path, aContextKey, an app name) raise the same type. They were plainValueErrors before, soexcept ValueErrorhandlers keep working.- A catch-up update beside a live one (v1.2.1).
app.update()whileapp.update(live=True)is running no longer cancels the live components (components that stay running after their first full scan and react to each change). It runs its own instance of each component beside them. - Sink order and sink errors (v1.2.1). A sink is the connector code that applies a target state’s actions. A component applies its sinks in the order of their providers’ keys, the same on every run. Before, the order was that of a hash map. A sink’s exception carries a note naming the target states it was applying.
- Preview lists deletions (v1.3.0).
app.update(preview=True)also lists the deletions an update makes for components no longer mounted, down their whole subtree. It still applies and writes nothing, so a preview’s output can be longer than before. - Class objects in memo keys (v1.3.0). A class object (the class itself, not an instance) no longer calls a
__coco_memo_key__or__coco_memo_state__defined on its metaclass or as a classmethod. Usememo_key=on the function, or register a key function on the metaclass or ontype. A key function registered onobjectno longer runs on class objects, which changes their fingerprints once. A class object whose metaclass defines__eq__without__hash__raisesTypeError. Types without a stable type ID fingerprint as before.
New errors: 6 items
RateLimiterraisesValueErrorfor a NaN or too-small rate and a non-finiteburst_window_secs, instead of crashing (v1.2.0).- An import error inside litellm, such as a missing optional dependency, fails at once instead of being retried as a connection error for 10 minutes (v1.2.0).
- A Doris table drop or replace whose
DROP TABLEfails, and a SQLite column type change whoseDROPfails, now fail instead of being recorded as applied (v1.2.1). - Under
component_selector, the update refuses a container change (a table rebuild or removal) that would affect rows of components it leaves out, with an error asking for a full update. A preview with the same selector refuses it the same way (v1.3.0). cocoindex update --selecttogether with--resetis a usage error (v1.3.0).register_memo_type(object, stable_type_id=...)raisesTypeError, because an ID onobjectwould reach every type (v1.3.0).
One-time effects on the first update after upgrading: 2 items
- Files split by
RecursiveSplitterare re-chunked, and the memoized work that took the changed chunks as input runs again (v1.2.1). - A Google Doc written by 1.3.0 lost its bold, italic and inline code. 1.3.1 writes them, but a doc written by 1.3.0 keeps the styles it lost. Its styled blocks stay frozen as a person’s edits until the flow declares the text the doc holds, or until the doc is recreated (v1.3.1).
Experimental APIs, outside the compatibility promise: 3 items
coco.DataDepandcoco.use_data_dep()(v1.2.0).- Google Drive
UserAccountand thecocoindex authcommands (v1.2.0). - The Google Docs connector (v1.3.0).
Requirements: 2 items
- The localfs connector requires
watchdog7 or later, whose Windows observer closes its handle once (v1.2.1). - The Discord connector installs with
pip install "cocoindex[discord]"(v1.2.0); the Google Docs connector withpip install "cocoindex[google_docs]"(v1.3.0). Thegoogle_driveextra gainshttpx(v1.2.0).
New APIs and capabilities
component_selector: update part of an app (v1.3.0)
A partial update is new. An update used to cover every component. Each one the app mounts was processed (its memo probed or its body run), and one whose source item was gone was deleted. App.update(component_selector=...) runs only the components at the given paths and what it takes to reach them: their ancestors, the root, and use_mount children, whose return values may be needed. Every other component is neither run nor treated as gone. Its target states, tracking records and memos (stored results reused while inputs and code are unchanged) stay as they are, and the next update that covers it catches it up (#2799, building on #2195 by @gjj930923).
A selector is a set of StablePaths, the component paths cocoindex show prints. Selecting a path selects its whole subtree. This example runs the process_file components for one page of files, then previews the same selection:
paths = [coco.ROOT_PATH / coco.Symbol("process_file") / name for name in page]
await app.update(component_selector=paths)
actions = await app.update(component_selector=paths, preview=True)
From the command line, cocoindex update --select PATH, repeatable, takes a path as cocoindex show prints it (@name is a Symbol, a quoted part is a string, a bare number is an int). It works with --preview, --live and --full-reprocess. await cocoindex.inspect.list_stable_paths(app) (or list_stable_paths_sync(app)) returns the paths of an app as StablePath values you can pass to component_selector as they are.
cocoindex update main.py --select '/@process_file/"docs/a.md"' --select '/@process_file/"docs/b.md"'
What you see. Pick a selector below. Components that run are outlined in periwinkle. Components the update leaves out are dashed, and nothing about them changes, even if their source item changed or was deleted.
cocoindex update main.py --select '/@process_file/"docs/a.md"'cocoindex update main.py --select '/@process_file'cocoindex update main.py --select '/@summary'cocoindex update main.pyRules that follow from “left out means untouched”:
- The source is read only as far as needed. A
mount_each()the selector leaves out does not read its items. One that is only an ancestor of selected paths asks a source that can read by key for just the selected keys.localfs.walk_dir(...).items()can, outside live mode: it checks the selected files instead of walking the directory. Other sources are listed in full and filtered item by item. - The next plain update catches up. A component with a child the selector left out, and each of its ancestors, stores no memo and drops the one it had. The next covering update therefore runs it and processes what was skipped, including deletions.
- A container change (a table or directory with rows or files under it) needs a plain update when it would affect rows of components left out. The update refuses a table rebuild or removal with an error that names the container and asks for a full update. A preview with the same selector refuses it too. A change that keeps the data, such as a new nullable column, applies.
- An ancestor component that is gone stays whole. Deleting it would delete unselected components too, so the next update that covers it does.
Two fixes in 1.3.1, both found by the selector’s differential fuzzer, close two cases the selector got wrong. A selected component that takes over a target state now drops the memo of every previous owner, including one the selector covers that never runs. Before, a later update could reuse that memo and lose the target state (#2868). And a selected key gone from a source that reads by key is now deleted when it sits where a component used to be, as it already was for a listed source. Before, the deleted key kept its target states (#2869).
Quick check: you run —select ’/@process_file/“docs/a.md”’, and docs/b.md was deleted from the source since the last update. What happens to b.md’s rows?
Nothing. The component for b.md is left out, so it is not run and not treated as gone: its rows and records stay. The next update that covers it (a plain update, or one that selects b.md or process_file) deletes them.
coco.DataDep and coco.use_data_dep(): memoize on what a body read (v1.2.0)
DataDep and use_data_dep() are outside the compatibility promise: a later release, a minor one included, may change or remove them.
A memoized function or component is reused when its logic, its arguments and the context values it read are unchanged. All of those are known before the body runs. Some bodies read things decided only while they run: an agent session opens the files the model chose, a test runner touches the files the tests import. Nothing in the arguments covers those reads, so the memo could not know when they went stale.
coco.DataDep declares a kind of such a read once, at module import, with a validator. coco.use_data_dep() records one read into the current call, as a key and the state observed. The next memo lookup (the probe) validates each record from the stored key and state alone, through the kind’s validator. The entry is reused only when its arguments, logic and context match and every record validates (#2662). This example records each file a session opened, with its mtime and digest:
def _validate_file(key: str, prev: tuple[int, bytes]) -> coco.MemoStateOutcome:
try:
st = os.stat(key)
except FileNotFoundError:
return coco.MemoStateOutcome(state=prev) # memo_valid defaults to False
if st.st_mtime_ns == prev[0]:
return coco.MemoStateOutcome(state=prev, memo_valid=True)
digest = hashlib.sha256(Path(key).read_bytes()).digest()
return coco.MemoStateOutcome(state=(st.st_mtime_ns, digest), memo_valid=digest == prev[1])
# Module level, at import, after the validator it names.
FILE = coco.DataDep("file", validate=_validate_file)
@coco.fn(memo=True)
async def session(task: Task) -> Outcome:
...
# Stat *before* reading, so the recorded mtime is never newer than the bytes.
st = os.stat(path)
data = path.read_bytes()
coco.use_data_dep(FILE, key=str(path.resolve()), state=(st.st_mtime_ns, hashlib.sha256(data).digest()))
...
What you see. A session that read a.md and c.md is reused while both still validate, whatever happens to files it never opened. Pick a change below.
How records travel, and the rules that follow:
- Record propagation. A record rides up through every enclosing function frame, whatever its
logic_tracking, into every enclosing memoized function’s entry and the component’s entry, where it stops. Records are not copied into ancestor components’ entries. A component reports one bit upward instead, and its parent’s entry lists the children that reported it. - Ancestor reuse. A memoized ancestor is reused when every descendant that recorded reads still validates (#2671). The parent’s probe checks those descendants from their own stored entries, by path, without mounting them. Before this change, such an ancestor re-ran its body on every update.
- One validation per update. Each record is validated at most once per update, not once per probe (v1.3.0, #2850). A memoized function beneath a component whose body re-runs, each level above an open component, and a sibling that read the same file all take the first answer. Two probes that start at the same time may still both validate. Before, a component and its 2 flagged ancestors validated one invalid read 3 times, once per level. Related: a memoized root whose memo misses on a rerun probes the memo once, not twice, so a validator that costs a search or a page fetch runs once (v1.2.1, #2836).
- Key and state are snapshotted at the call. Identity and equality are fingerprints of the serialized bytes, so use plain values (the resolved path string, a tuple of mtime and digest). Recording one key with two different states in one run stores no entry, because output that used two states has no single state to validate against.
- Build every
DataDepat module import. A kind constructed inside a component registers too late for the entries that recorded it, and constructing one inside a component context raises. Renaming a kind invalidates every entry that recorded it, which doubles as its version bump.
CocoIndex Agents, a new example, is an incremental agent harness built on data dependencies: agent sessions are memoized on what they read. It reads local folders, PDFs and a Google Drive folder as the signed-in account (v1.2.0), and researches a topic on the web, from a prompt or from named starting pages (v1.2.1). Its README records what its sample flows measured with a real model: the same decomposition in 3 runs of each flow, no model call on an unchanged rerun, and 2 or 3 calls after one edited input. The Google Docs connector’s read_doc_edits() records its read as a data dependency, so a person’s edit to a doc re-runs the memoized function that read it.
Quick check: a session read notes/a.md and notes/c.md. Someone edits notes/b.md. Does the session re-run on the next update?
No. The session recorded reads of a.md and c.md only; b.md is not in its entry, so nothing about it is validated. The session re-runs when a.md or c.md changes or disappears, or when its arguments or logic change.
__coco_memo_type_id__: memo entries that survive a rename (v1.3.0)
By default CocoIndex identifies a type in memo keys by its module and qualified name. Moving a class to another module, or renaming it, changed every memo key that held one of its instances, and the memoized work ran again. A type can now carry a stable type ID instead (#2256, by @MaxRong). Set __coco_memo_type_id__ on a class you own, pass stable_type_id= to coco.register_memo_type() for one you don’t, and use coco.prev_type_id(old_module, old_name) to keep the entries a type already has under its old name:
@dataclass
class SourceEntry:
__coco_memo_type_id__ = "com.example.SourceEntry/v1" # new entries
name: str
version: int
class ProductRow: # moved here from old_package.models; existing entries stay valid
__coco_memo_type_id__ = coco.prev_type_id("old_package.models", "ProductRow")
coco.register_memo_type(Path, lambda p: str(p.resolve()), stable_type_id="stdlib.pathlib.Path/v1")
A declared ID is inherited through the class’s MRO, a registered ID applies to subclasses too (the most specific registered type wins), and the fallback is the module and qualified name as before. The ID has to be in place before a value is fingerprinted. For deps= and coco.LogicDep values, that means before the decorator runs or the LogicDep is constructed. Types without a stable ID fingerprint as before, so upgrading alone reprocesses nothing, apart from the class-object cases in the upgrade notes. The same change caches resolved type identities, which made fingerprinting faster. The PR measured 100-item lists, median µs per item:
| Value | Before | After |
|---|---|---|
| dataclass instance | 5.75 | 4.76 |
| Pydantic model | 8.61 | 7.53 |
| class object | 3.89 | 1.40 |
A follow-up rejects a stable type ID on object (#2841). Such an ID would have reached every type through the MRO and made two unrelated dataclasses with equal fields fingerprint the same.
RecursiveSplitter: a function that fits stays in one chunk (v1.2.1)
The splitter picks chunk boundaries by minimizing a total cost over small pieces. The old rule for a chunk shorter than min_chunk_size was a flat penalty of 1,048,576, while a cut through a syntax node cost about 1,000. One short chunk cost as much as roughly 1,000 bad cuts. To avoid one, the splitter cut almost anything, a function’s body from its signature included (#2716).
The penalty for a short chunk is now graded by how far under the floor it falls: 17 B under a 112 B floor costs about 189. Three new costs make structure count: a cut inside a node that fits in chunk_size (4,096 per side), a cut inside a header (2,048 per side) or just after it, which strands the header from its body (1,024 per side), and a tiny chunk (3,072). On the PR’s corpus, cuts inside a function or class that fits fell from 3,528 to 350. The fit and header costs apply only to Tree-sitter nodes. The graded floor penalty and the tiny-chunk cost apply to every language, so a plain-text or regex-split file can also chunk differently.
What you see. The sample below is the Python file from How Tree-sitter works, split with chunk_size=225 and the default floor of 112 B. On 1.2.0, chunk 4 ends after the def low_stock line and chunk 5 starts with its body. On 1.2.1, class Report with its __init__ is one chunk of 95 B, 17 B under the floor, and low_stock stays whole.
On 1.2.0, the same sample split mid-function at every chunk_size from 100 to 300 with the default floor. As merged, the change made splitting 28% slower on a 3,531-file corpus, from 0.79 s to 1.01 s (split only, parse excluded). A follow-up brought that to 0.93 s, 18% over the old time, with identical chunks, checked by hashing 2,170,488 chunk ranges before and after (#2803). The 1.2.0 release also fixed RecursiveSplitter dropping text after the end of a grammar’s root node, such as after a stray byte order mark in YAML (#2786).
Smaller additions
cocoindex.AlreadyDeclaredError(v1.2.0). Declaring the same thing twice in one run raises a typed error: a target state key, a component path such as a duplicatemount_eachkey, ause_statekey, aContextKey, or an app name. It subclassesValueError, so a caller can branch on it while existingexcept ValueErrorhandlers keep working (#2672).- Preview lists deletions (v1.3.0).
App.update(preview=True)now lists the deletions an update makes for components no longer mounted, down their whole subtree: a deleted source file’s outputs, or a child whose key changed. Before, a preview ran only the commit phase and skipped the sweep that turns unmounted components into delete runs. It still applies and writes nothing, and under a selector it plans exactly the deletions the partial update makes (#2861). One limit remains: a failure that happens only when a sink applies its actions shows up only in the update.
Operations
A progress display that lists failures (v1.2.0)
cocoindex update, cocoindex drop and update_blocking(report_to_stdout=True) show one status line (Running…, ● Watching for changes, ✓ Done in 3.0s), with each component in an aligned column under it: a progress bar of runs finished out of runs started, its rate and its failures. The engine records the first 5 failures with their component path and message, and the summary lists them under their component (#2717, #2731):
⠹ Running… (13.5s)
· app_main running
· process_item ━━━━━━━━━╸────────── 5/12 · 0.4/s · 1 failed
item/3 ValueError: boom 3
✗ Done in 0.5s · 13 failed
✓ app_main 1 added
✗ process_item 47 added · 13 failed
item/0 ValueError: boom 0
item/3 ValueError: boom 3
…
… and 8 more failed
The display fits lines to the terminal’s width and uses color only on a terminal, never with NO_COLOR. Scrolling output (pipes, CI) prints a block at most every 10 s, only when the stats changed. A follow-up in the same release closed a gap in the first version (#2744): the engine keeps 5 failures and the display draws only its own stats, so past the fifth a failure had reached neither the display nor the log. Now every failure logs one ERROR line, with its traceback in scrolling output. The final status counts failures inside stats groups too, so a run whose work failed inside a group no longer ends green.
cocoindex update exits 1 when a failure goes unhandled (v1.2.1)
When a component mounted with coco.mount() or coco.mount_each() failed, cocoindex update still exited 0, so a cron job or CI step could not tell a failed run from a clean one. It now exits with status 1 when a component failure goes unhandled: no exception handler was registered for it, or every handler in the chain re-raised. The count is shared by the whole run, so a failure inside a coco.stats_group counts too (#2661, by @Goldloli).
- A handler that returns normally keeps the status at 0. That is the opt-out, so there is no new flag.
--previewfollows the same rule, and a failed preview’sNothing to changeline loses its green mark, since the preview did not see the failed components’ changes.--liveis excluded, because cumulative failures do not describe current health.- The reason is printed on stderr even under
--quiet.
Connectors
| Connector | Kind | Release |
|---|---|---|
| Discord | source: messages and threads of text, announcement and forum channels | v1.2.0 |
| Google Docs | target: a doc kept in step with declared Markdown (experimental) | v1.3.0 |
| Google Drive | source: sign in with a personal account beside the service account (experimental) | v1.2.0 |
Discord: a source for channels and threads (v1.2.0)
cocoindex.connectors.discord indexes the messages and threads of Discord text, announcement and forum channels through Discord’s HTTP API, using the token of a bot you create and invite to your server (#2695, by @jerryqu-coco). DiscordChannel.items() yields one DiscordMessage per message in the channel’s main stream and one DiscordThread per thread the bot can read, active or archived, forum posts included (a thread’s starter message becomes part of the thread). Both have read_text() for embedding. This example keeps one Markdown file per message or thread:
DISCORD = coco.ContextKey[discord.DiscordApp]("discord")
@coco.lifespan
async def coco_lifespan(builder: coco.EnvironmentBuilder) -> AsyncIterator[None]:
async with discord.DiscordApp(token=os.environ["DISCORD_BOT_TOKEN"]) as app:
builder.provide(DISCORD, app)
yield
@coco.fn(memo=True)
async def export_item(item: discord.DiscordMessage | discord.DiscordThread, channel_id: str, target: localfs.DirTarget) -> None:
if text := await item.read_text():
target.declare_file(filename=f"{channel_id}__{item.id}.md", content=text)
@coco.fn
async def sync_channel(channel: discord.DiscordChannel, target: localfs.DirTarget) -> None:
await coco.mount_each(export_item, channel.items(), channel.channel_id, target)
- Incremental. Each run lists the channel, and only the messages and threads that changed are reprocessed. A thread’s messages are fetched only when the thread reruns.
message_fieldsandthread_fieldschoose which fields an item exposes, and so what counts as a change. - Errors keep outputs. With the Message Content intent off, Discord answers with HTTP 200 and messages without their text. The connector checks the intent before it lists a channel, and again whenever the messages it reads look stripped, and raises. A missing permission such as Read Message History, or lost access, is an API error that raises with a hint naming the fix. Either way the channel keeps its outputs, instead of
mount_each()reading an empty listing as deletions. - Rate limits need no configuration. The connector paces on the limits Discord reports in each response, stays under the global 50 requests a second, and stops sending after a 401, since repeated failing requests get the IP banned.
DiscordApp.list_channels(guild_id)lists a server’s channels, so you need not copy IDs by hand.- A known gap. Discord reports nothing on a thread when a message inside it is edited, so the edit is picked up at the thread’s next change: a new or deleted message, a rename, an archive or a lock.
Two examples ship with it: semantic search over a channel (discord_text_embedding) and support threads turned into an FAQ for agents (discord_support_faq), which its own post walks through.
DocumentationThe Discord connector.Bot setup and permissions, DiscordChannel and its items, choosing fields, rate limiting, and what deletes outputs.Google Docs: a target updated block by block (v1.3.0)
The Google Docs connector is outside the compatibility promise: a later release, a minor one included, may change or remove it.
cocoindex.connectors.google_docs keeps a Google Doc in step with Markdown your flow declares, such as a report or brief that people read and comment on (#2863). google_docs.declare_doc(account, name, content) creates the doc in your My Drive on the first run and updates it in place afterwards:
GDOCS = coco.ContextKey[google_docs.UserAccount]("gdocs")
@coco.lifespan
async def coco_lifespan(builder: coco.EnvironmentBuilder) -> AsyncIterator[None]:
builder.provide(GDOCS, google_docs.UserAccount())
yield
@coco.fn
async def app_main() -> None:
report = await write_report() # Markdown
google_docs.declare_doc(GDOCS, "Weekly brief", report)
What you see. The target splits the Markdown into blocks, a heading with its paragraphs. When the content changes, one batchUpdate rewrites only the paragraphs that changed, in the blocks that changed. The target never touches unchanged paragraphs, so the comments and suggestions anchored to them stay, and the doc’s version history shows only the real changes. An unchanged run makes no call to Google: the target compares the declared content with what it wrote last time.
- A person’s edits are kept. A block a person changed since the target wrote it keeps the person’s text, even when the flow’s version changed. Each write logs a warning naming the doc and the block until the flow declares the same text. A block that holds a pending suggestion is left as it is too. From 1.3.1 the warning says so, instead of calling the block edited (#2872).
- Edits can be read back.
await google_docs.read_doc_edits(account, name, last_declared=...)returns the blocks people changed asBlockEdits, each with the block as declared and as it reads now in Markdown. It also returnscontent, the declared text with those edits applied, so a flow can take them in. The read is a data dependency: a person’s edit re-runs a memoized reader, and the target’s own writes do not (#2866, #2867). - The doc goes to the trash. When the declaration goes away, the doc moves to the trash, where Google Drive keeps it for 30 days. The connector never deletes a doc permanently.
- Scope:
drive.fileonly. The connector signs in as your personal Google account with thedrive.filescope only, which reaches the docs CocoIndex created and nothing else. Sign in withcocoindex auth sign-in google-docs <client_secret.json>, and revoke withsign-out google-docs. The sign-in is separate from the Google Drive connector’s, with its own token file.
The real-account check, rerun with the fix, measured the writes: a 300-entry brief went out in one batchUpdate of 1,931 requests, a 1,700-entry one in 10,891 requests (56.7 s), and a 1-entry change took 9 requests. That check, run against 1.3.0, found the bug 1.3.1 fixes. Setting a paragraph’s named style on the real Docs API clears the text’s bold, italic and font. The writer set paragraph styles after the text styles, so every write by 1.3.0 lost them, and the block then read back as a person’s edit. 1.3.1 sets paragraph styles right after inserting the text and the text styles after them (#2870). The one-time effect on docs written by 1.3.0 is in the upgrade notes.
Google Drive: sign in with a personal account (v1.2.0)
UserAccount and the cocoindex auth commands are outside the compatibility promise: a later release, a minor one included, may change or remove them.
Beside a service account, the Google Drive connector can read a Drive as a personal Google account signed in once through OAuth: GoogleDriveSource(root_folder_ids=[...], user_account=google_drive.UserAccount()) (#2687, #2689, #2791, #2792). The sign-in is an explicit step outside any run:
cocoindex auth sign-in google-drive ~/Downloads/client_secret_XXXX.json
cocoindex auth sign-out google-drive # revokes at Google and deletes the token file
The client file comes from a Desktop app OAuth client you create in your own Google Cloud project. The connector docs walk through it. On a host with no browser, the command prints the link and takes the pasted redirect address. The sign-in asks for read-only Drive access. Before it opens the browser, it prints what it asks for and where it stores the token. The token stays on your computer only, with permissions that let only your user read it. UserAccount().sign_in(...) does the same from your own program. The service-account path is unchanged.
Also in this cycle:
- Every Drive API request retries 5xx, 429 and rate-limit 403 responses with backoff, where the source had no retry before (v1.2.0, part of the same change).
- Folders and files in a shared drive are indexed (v1.2.1, #2815, by @pcbeingused33).
- The docs show how to read a Google Drive for desktop folder with
localfs(v1.2.1, #2829).
Changes to existing connectors
- Excluded directories (v1.2.1).
excluded_patternsthat name a directory exclude everything under it in Amazon S3, Azure Blob Storage and OCI Object Storage, as in a local directory walk (#2822), and in localfs live file events (#2758, by @Sujit-1509). - Amazon S3 (v1.2.1).
read()withsize=0returns empty bytes instead of the whole object (#2805, by @khrisshie). - Doris (v1.2.1). A table drop or replace whose
DROP TABLEfails now fails, instead of being recorded as applied and leaving the old table in place (#2804, by @khrisshie). - SQLite (v1.2.1). A column type change whose
DROPfails now fails, instead of being recorded as applied (#2798, by @SuperMarioYL). - OCI Object Storage (v1.2.1).
logic_versionis recorded only after a startup scan in which nothing failed, so a rerun after a failed scan scans again (#2825). - zvec (v1.2.0). A component declaring more than 1,024 documents no longer fails every run, and deleting a document that is already missing no longer fails (#2771).
- localfs (v1.2.1). Requires
watchdog7 or later, whose Windows observer closes its handle once (#2831). - LiteLLM embedder (v1.1.1).
LiteLLMEmbedderacceptsencoding_format="base64"responses, a much smaller payload over the wire, probes the right dimension for them, and refuses dtype options (vLLMembed_dtype, Voyageoutput_dtype) that would decode into a wrong vector (#2455, by @johannespfrang-h-d). From 1.2.0, an import error inside litellm fails at once instead of being retried for 10 minutes as a connection error (#2685).
Performance
A run that changes nothing writes nothing (v1.2.0)
Every build of a component ran two durable LMDB write transactions, even on a warm run that changed nothing: the precommit rewrote the tracking record (the engine’s stored record of what the component did last run) with a stage marker, and the commit rewrote it again. A warm run of an unchanged component wrote the same bytes twice and paid two fsyncs. On a disk where fdatasync takes 2.5 to 4.5 ms, a sequential use_mount! through the Rust SDK cost about 8.7 ms per component, all of it waiting on fsync. The root of every update paid the same on the critical path (#2785).
The stage marker exists to recover sink actions in flight if the process dies before the commit. A build that queued no sink action, claims no target-state path and sets no provider generation has nothing in flight. Its precommit now finalizes the record itself and writes nothing, and the commit writes nothing when the finalized bytes equal the stored ones. LMDB commits a transaction with no dirty pages without syncing. Stored formats and fingerprints are unchanged. A skipped write is byte-identical to the stored record.
| Scenario, per component | Before | After |
|---|---|---|
Sequential use_mount! (Rust SDK), warm, 300 components | 8.75 ms | 99.6 µs |
mount_each without a memo key, warm, 10,000 components | 36.7 µs | 8.2 µs |
| Environment open, app, and an empty update | 24.0 ms | 15.2 ms |
The numbers come from a scratch harness through the Rust SDK, release build with LTO, on one shared 64-core aarch64 machine. Before and after ran back to back, because fsync latency on that machine varies over time. A companion change cut decode work and allocations on the submit and memo paths: the tracking-record decoder no longer builds a serde error per stored state, a decode that nothing read is gone, and a memo hit on an entry that stores no memo states no longer hashes the whole row. Heap allocations per component fell from 145 to 119 on a cold memoized mount_each! and from 104.5 to 94.4 on a warm mount_each without a memo key (#2784).
Fixes
Live components and memos (v1.1.1 to v1.2.1)
- A live component’s first run (v1.1.1). A live component that called
operator.update()before anyupdate_full()lost what it mounted on its first run. Its own record was written only at its parent’s commit, so the first child’s early write recorded it as a plain directory entry. The parent’s commit then marked every child mounted so far as deleted. Watch-only feeds (Kafka, Iggy, anyLiveMapFeedwith onlywatch()) hit this on a first run against a backlog. Items a first run lost come back when the source delivers them again (#2673, reported by @jerryqu-coco). - A memo-state refresh (v1.1.1). A memoized function whose tracked state changed while its memo stayed valid had its target states and nested memo entries deleted at commit. They are now kept. A component’s memo refresh writes only to the row it validated, so a concurrent run of the same component can no longer be overwritten under it (#2660).
- A live delete wins (v1.2.0). In a live component, a delete issued while the same item’s update was still running left that update’s target states behind. The delete now wins. A
process_livethat fails before it is ready fails its parent with its own error, notChild component build cancelled(#2779). - Parent-first apply (v1.2.0). A component applies its target states parent-first, so an attachment such as a vector index is no longer created before the table it belongs to. LanceDB sometimes refused to build an index on a first run because of this (#2769).
- Abandoned batches (v1.2.0). A queued batch whose callers have all gone away, after a timeout or a cancelled update, is no longer run, which saves a wasted model request or GPU batch (#2787).
- A catch-up update beside a live one (v1.2.1). It no longer cancels the live components. It runs its own instance beside them (#2802, #2820).
- Drop and run-time root providers (v1.2.1). Dropping an app also reverts the target states of root providers a Rust SDK run registered (#2802).
- Sinks in a fixed order (v1.2.1). A component applies its target sinks in the same order on every run. A sink’s error names the target states it was applying, as a note on the exception for a Python connector (#2828).
Runtime and shutdown (v1.2.0 to v1.2.1)
- Ctrl+C stops
update_blocking()anddrop_blocking()and raisesKeyboardInterrupt(v1.2.1, #2840). - Interpreter exit. A live update still running at interpreter exit is cancelled cleanly, without the
Task was destroyed but it is pending!error and the 5 s delay (v1.2.1, #2830). - GPU subprocess mode (v1.2.1). With
COCOINDEX_RUN_GPU_IN_SUBPROCESS=1,coco.current_gpu()returns the GPU the call was given, and calls on different GPUs run in parallel instead of one at a time, each GPU with its own workers (#2390, by @NithinGoud2605). - Pydantic
bytesfields that aren’t UTF-8 round-trip through serialization (v1.2.1, #2817, by @rtmalikian). RateLimiterraisesValueErrorfor a NaN or too-small rate and a non-finiteburst_window_secs, instead of crashing (v1.2.0, #2764).
Internal improvements
Documentation
- The docs site follows cocoindex.io’s design system (v1.1.1). The examples catalog filters by category, source, target, model and level. Each of the 32 walkthroughs opens with a “What you’ll build” scene drawn from the example’s own files. Core Concepts has the pipeline playground on the page and a shorter reading path. Navigation, search, tabs and reading on phones were reworked (#2639 and #2640; Core Concepts in #2653, #2654 and #2656; navigation, search, tabs and accessibility in #2641, #2644, #2645 and #2655).
- Python and Rust pages (v1.2.0). The docs have separate pages for the two SDKs, under /docs and /docs/rust, with every Rust SDK page labeled experimental (#2742, #2762). The Rust SDK also gained a standalone
cocoindexCLI for Rust projects (#2693). - Smaller fixes.
- The
map()section is easier to find in search (#2325, by @rchiang). - The Python download link in the installation guide was corrected (#2628) and the agent skill’s batching and runner examples now use
as_async(#2636), both by @hatemadi15. - Install commands quote their extras, so they also work in zsh (#2809).
- The feature request template’s contributing link was fixed (#2819, by @Standing-Man).
- The
Examples
- CocoIndex Agents (v1.2.0, v1.2.1): the incremental agent harness described under data dependencies. It needs CocoIndex 1.2.0 or later (#2659, #2686, #2688, #2833, #2835).
- Two Discord examples (v1.2.0):
discord_text_embeddinganddiscord_support_faq, each with a script that fills a test channel with made-up posts through webhooks. pdf_elements_embedding: PDF text and images into Qdrant (#2691).- Graph examples moved to the node and relationship APIs introduced in 1.1.0 (#2706),
hn_trending_topicsmemoizes its LLM topic extraction (#2684), and the podcast and multi-codebase LLM steps declare their prompts and models indeps(#2812, #2813).
Release process and CI
- Release branches. A minor or major release creates its release branch, and patch releases are cut from it with a backport playbook (#2675, #2728).
- CI. The Rust SDK checks run daily rather than on every pull request (#2737), and a test keeps engine logs off a piped stdout (#2794, by @hatemadi15).
What to try next
- Update one component. Run
cocoindex show main.py, copy a path, and runcocoindex update main.py --select '<path>' --preview, then without--preview, as in updating part of an app. - Record a read. If a memoized function reads files it chooses at run time, declare one
coco.DataDepper kind of read at module import and callcoco.use_data_dep()after each read, as in the file example. - Wire a job to the exit status. From 1.2.1,
cocoindex updateexits 1 on an unhandled component failure, so a cron job or CI step can fail on it without parsing output. - Index a Discord channel, or write a Google Doc. Start from the Discord quick start or the Google Docs connector.
- Before you upgrade, check the upgrade notes for the re-chunking and the exit status.
For the complete list of changes, see the GitHub releases.
Thanks to the community
Thanks to everyone who contributed this cycle, including 7 first-time contributors.
Thanks for the Discord source connector, its two examples, and for reporting the live-component first-run bug fixed in 1.1.1.
Thanks for stable memo type identifiers, which let a type keep its memo entries through a rename or a move, and made fingerprinting faster along the way.
Thanks for the first implementation of sliced execution, which App.update(component_selector=...) builds on.
Thanks for your first contribution, making cocoindex update exit 1 on failures nobody handled, so cron jobs and CI can detect a failed run.
Thanks for your first contribution, carrying the GPU assignment into subprocess mode, so calls on different GPUs run in parallel.
Thanks for your first contributions: failing a Doris table drop whose DROP TABLE fails instead of recording it as applied, and returning empty bytes from an S3 read() with size=0.
Thanks for your first contribution, indexing folders and files that live in a Google shared drive.
Thanks for your first contribution, encoding_format="base64" support in LiteLLMEmbedder, a much smaller payload over the wire.
Thanks for your first contribution, making the map() section easier to find in search.
Thanks for your first contribution, fixing the contributing guide link in the feature request template.
Thanks for failing a SQLite column type change whose DROP fails, instead of recording it as applied.
Frequently asked questions
How do I update only some components of a CocoIndex app?
Pass component_selector to App.update() with the StablePaths of the components to run, or pass cocoindex update --select PATH on the command line, once per path, written as cocoindex show prints it. The selected components, their ancestors, the root and use_mount children run; every other component is neither run nor treated as gone, and the next update that covers it catches it up. Available from CocoIndex 1.3.0.
How can a memoized function depend on files it reads at run time?
Declare a kind of read once at module import with coco.DataDep(name, validate=...), and after each read call coco.use_data_dep(kind, key=..., state=...) inside the memoized function or component. The memo entry is reused only while every recorded read still validates through the kind's validator. The API is experimental in 1.2.0 and later.
Does cocoindex update return a non-zero exit status when a component fails?
From 1.2.1, yes: cocoindex update exits with status 1 when a component failure goes unhandled, meaning no exception handler was registered for it or every handler re-raised. A handler that returns normally keeps the status at 0, and --live is unaffected.
Why does CocoIndex re-chunk my files after upgrading to 1.2.1?
From 1.2.1, RecursiveSplitter keeps a function, class or block that fits in chunk_size in one chunk and keeps a header with the start of its body, and treats min_chunk_size as a soft floor. Chunk boundaries therefore differ from 1.2.0, so the first update after upgrading re-chunks the files it splits.
See RecursiveSplitter: a function that fits stays in one chunk.
Can CocoIndex index a Discord server?
Yes. From 1.2.0, cocoindex.connectors.discord reads the messages and threads of text, announcement and forum channels with the token of a bot you invite to your server. Each run lists the channel and reprocesses only the messages and threads that changed.
Can CocoIndex write to a Google Doc?
From 1.3.0, the experimental google_docs connector keeps a Google Doc in step with Markdown your flow declares. It rewrites only the paragraphs that changed, so comments on the rest stay, keeps blocks a person edited and reports them, and signs in with the drive.file scope only.
How do I keep memo entries when I rename or move a class?
From 1.3.0, set __coco_memo_type_id__ on the class to a stable string, or use coco.prev_type_id(old_module, old_name) to keep the entries it already has under its old name. For a type you don't own, pass stable_type_id= to coco.register_memo_type().
See __coco_memo_type_id__: memo entries that survive a rename.
Build fresh context for your agents.
CocoIndex keeps derived data in sync with its sources. Only what changed re-runs.


