Conversation
This commit adds a new OpenSpec proposal for Task Output Caching. It includes: - `proposal.md`: Rationale and scope. - `tasks.md`: Implementation checklist. - `design.md`: Architectural decisions and trade-offs. - `specs/task-runner/spec.md`: Delta requirements for `TaskStep` and execution strategy. This feature will allow tasks to skip execution if their inputs haven't changed, significantly improving performance for repeated workflows. Co-authored-by: thalesraymond <32554150+thalesraymond@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello @thalesraymond, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a comprehensive proposal for a new "Task Output Caching" feature within the task runner. The core objective is to significantly enhance performance by preventing the redundant execution of computationally expensive tasks when their inputs or context remain unchanged. The proposal outlines the necessary modifications to task configuration, introduces a dedicated caching execution strategy, and establishes a pluggable caching mechanism to support various backend implementations, ensuring efficient and flexible task processing. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
There was a problem hiding this comment.
Code Review
This pull request introduces a proposal for a new task output caching feature. The design is well-structured and thoughtful, particularly with the inclusion of a pluggable ICacheProvider and a restore callback to handle side effects. My review focuses on refining the specification to address potential edge cases and ambiguities. I've suggested clarifications around failure handling for the restore function, the status of cached tasks, handling of non-serializable data, and ensuring consistency across the proposal documents. Addressing these points will help create a more robust and predictable feature.
|
|
||
| - **WHEN** the `CachingExecutionStrategy` executes a task with a cache key that IS present in the cache provider | ||
| - **THEN** it SHALL NOT execute the inner strategy. | ||
| - **AND** it SHALL invoke the `restore` function (if provided) with the current context and the cached result. |
There was a problem hiding this comment.
| - **Task Configuration**: Add `cache` configuration to `TaskStep` interface, allowing tasks to define a cache key and a restoration logic. | ||
| - **Execution Strategy**: Introduce `CachingExecutionStrategy` that wraps other strategies. It checks for a cached result before execution and stores the result after successful execution. | ||
| - **Cache Provider**: Define an `ICacheProvider` interface with a default in-memory implementation (`MemoryCacheProvider`), allowing for future extension (e.g., file system or remote cache). | ||
| - **Task Result**: Ensure `TaskResult` is serializable and contains necessary metadata for caching. |
There was a problem hiding this comment.
This point is crucial, but lacks detail on enforcement. The TaskResult.data property is of type unknown, which allows for non-serializable values. The proposal should specify how the system will handle non-serializable data in a cached task's result. Will it cause a runtime error during the caching process, or should there be a mechanism to prevent this, for example by using a more specific type for data on cacheable tasks?
| - **WHEN** the `CachingExecutionStrategy` executes a task with a cache key that IS present in the cache provider | ||
| - **THEN** it SHALL NOT execute the inner strategy. | ||
| - **AND** it SHALL invoke the `restore` function (if provided) with the current context and the cached result. | ||
| - **AND** it SHALL return the cached result. |
There was a problem hiding this comment.
Returning the original cached result might be confusing, as its status (e.g., success) doesn't reflect that the task was restored from cache, not executed. It would be more informative to return a result with a new status, like cached, as hinted at in tasks.md. This would improve observability of the workflow execution.
| - **AND** it SHALL return the cached result. | |
| - **AND** it SHALL return a `TaskResult` with a status of `cached`. |
| - Calculate cache key using `step.cache.key(context)`. | ||
| - Check cache provider. If hit: | ||
| - Execute `step.cache.restore(context, result)` if provided. | ||
| - Return cached result with status `skipped` (or a new status `cached`). |
There was a problem hiding this comment.
This is a great implementation detail, but it introduces a potential ambiguity. It's not clear if 'Return cached result with status...' means modifying the cached object or creating a new one. Modifying cached data is risky. It would be better to specify that a new TaskResult should be created. Also, this requirement is important enough to be in specs/task-runner/spec.md to ensure it's part of the formal contract.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |



Proposed a new "Task Output Caching" feature using the OpenSpec workflow.
openspec/changes/feat-task-caching/directory.proposal.mddetailing the need for caching to avoid redundant execution.tasks.mdwith a breakdown of implementation steps (Interfaces, Strategy, Tests).design.mdcovering architectural decisions (e.g., pluggable providers,restorecallback).specs/task-runner/spec.mdwith formal requirements forTaskCacheConfig,CachingExecutionStrategy, andICacheProvider.build,lint,test).PR created automatically by Jules for task 14087489645052090480 started by @thalesraymond