A method, apparatus, electronic device, and storage medium for responding to a code task.
Patent Information
- Application Number
- CN202611352521.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-10-20
AI Technical Summary
[0003]但是,采用第一种方式需频繁创建/销毁代码操作环境,当任务并发量高、代码仓库体积庞大时,大量的代码文件复制操作会导致磁盘I/O成为性能瓶颈,无法满足AI智能体秒级响应的需求
[0015]本申请实施例提供了一种代码任务的响应方法、装置、电子设备及存储介质,该方法包括:接收目标代码任务的请求数据;所述请求数据中包含代码操作类型和代码标识数据;当所述代码操作类型为读写操作时,从拓扑注册表中查询在代码读写池内与所述代码标识数据对应的第一代码工作区实例的第一物理路径;根据所述第一物理路径对所述目标代码任务进行响应;当所述代码操作类型为只读操作时,从代码只读池中查询与所述代码标识数据对应代码文件的冻结引用副本的第二物理路径,以对所述目标代码任务进行响应。通过本申请能够减少创建/销毁代码操作环境的次数,提高磁盘I/O效率,满足AI智能体秒级响应的需求,避免共享构建产物或依赖缓存引发冲突,避免编译逻辑错误或交叉污染的增量构建失败。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer software engineering and version control technology, and more specifically, to a method, apparatus, electronic device, and storage medium for responding to code tasks. Background Technology
[0002] In the scenario of AI Coding Agent driven by Large Language Model (LLM), the system often needs to concurrently process multiple reading or modification tasks for different versions of the same code repository. Existing technologies typically manage the code workspace in the following ways: (1) making a complete copy of the code repository on disk for each task; (2) creating multiple associated work trees under the same code repository.
[0003] However, the first method requires frequent creation and destruction of the code operation environment. When the task concurrency is high and the code repository is large, the large number of code file copying operations can cause disk I / O to become a performance bottleneck, failing to meet the AI agent's requirement for sub-second response times. When the development pipeline forks, the development progress and dependency configurations of different branches are often inconsistent. Using the second method is prone to conflicts due to shared build artifacts or dependency caches, leading to unreproducible compilation logic errors or cross-contamination causing incremental build failures. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a method, apparatus, electronic device and storage medium for responding to code tasks, which can reduce the number of times code operation environments are created / destroyed, improve disk I / O efficiency, meet the second-level response requirements of AI agents, avoid conflicts caused by shared build artifacts or dependency caches, and avoid incremental build failures due to compilation logic errors or cross-contamination.
[0005] In a first aspect, embodiments of this application provide a method for responding to code tasks, the method comprising: Receive request data for the target code task; the request data includes the code operation type and Code identifies data; When the code operation type is a read-write operation, query the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data in the code read-write pool; The target code task is responded to according to the first physical path; When the code operation type is read-only, the second physical path of the frozen reference copy of the code file corresponding to the code identification data is queried from the code read-only pool in order to respond to the target code task.
[0006] In one possible implementation, when the code operation type is a read / write operation, querying the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data within the code read / write pool includes: From the topology registry, query the first physical path of the first code workspace instance in the code read / write pool that corresponds to the code identifier data and is in an idle state.
[0007] In one possible implementation, when the code operation type is a read / write operation, the method further includes: If the second physical path is not found in the topology registry, a physical path is assigned to the code file in the code repository corresponding to the code identifier data to obtain the third physical path; Based on the third physical path, a second code workspace instance is added to the code read / write pool, corresponding to the code file in the code repository with the code identification data; The target code task is responded to according to the third physical path; and the second code workspace instance is registered in the topology registry according to the third physical path and the code identification data.
[0008] In one possible implementation, when the code operation type is a read / write operation, after responding to the target code task according to the first physical path, the method further includes: Set the occupancy status of the first code workspace instance within the code read / write pool in the topology registry to a locked state.
[0009] In one possible implementation, when the code operation type is a read / write operation, after the target code task has been executed, the method further includes: If the target code task is executed successfully, the version information of the code file corresponding to the first code workspace instance in the code read / write pool in the topology registry will be updated.
[0010] In one possible implementation, when the code operation type is a read / write operation, after the target code task has been executed, the method further includes: If the target code task fails to execute, the first code workspace instance in the code read / write pool in the topology registry will be processed according to the preset failure handling strategy.
[0011] In one possible implementation, when the code operation type is a read-only operation, the method further includes: If the second physical path is not found in the code read-only pool, a frozen reference copy of the code corresponding to the code identification data is created in the code read-only pool.
[0012] Secondly, embodiments of this application also provide a code task response device, the device comprising: A receiving module is used to receive request data from a target code task; the request data includes code operation type and code identification data; The query module is used to query the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data in the code read / write pool when the code operation type is a read / write operation; A response module is used to respond to the target code task according to the first physical path; The response module is further configured to, when the code operation type is a read-only operation, query the second physical path of the frozen reference copy of the code file corresponding to the code identification data from the code read-only pool, in order to respond to the target code task.
[0013] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of a response method for a code task as described in any of the first aspects.
[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of a response method for a code task as described in any of the first aspects.
[0015] This application provides a method, apparatus, electronic device, and storage medium for responding to code tasks. The method includes: receiving request data for a target code task; the request data includes code operation type and code identification data; when the code operation type is a read-write operation, querying a topology registry for a first physical path of a first code workspace instance corresponding to the code identification data within a code read-write pool; responding to the target code task according to the first physical path; when the code operation type is a read-only operation, querying a code read-only pool for a second physical path of a frozen reference copy of the code file corresponding to the code identification data, in order to respond to the target code task. This application reduces the number of times code operation environments are created / destroyed, improves disk I / O efficiency, meets the second-level response requirements of AI agents, avoids conflicts caused by shared build artifacts or dependency caches, and avoids incremental build failures due to compilation logic errors or cross-contamination. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a code task response method provided in an embodiment of this application is shown. Figure 2 This illustration shows a schematic diagram of I / O optimization provided in an embodiment of this application; Figure 3 This illustration shows a reference isolation diagram based on a code read-only pool provided in an embodiment of this application; Figure 4 This illustration shows a structural schematic diagram of a code task response device provided in an embodiment of this application; Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0019] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0020] To enable those skilled in the art to utilize the content of this application, and in conjunction with the specific application scenario of "computer software engineering and version control technology," the following implementation methods are provided. For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application. Although this application is primarily described within the "computer software engineering and version control technology field," it should be understood that this is merely an exemplary embodiment.
[0021] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0022] In scenarios where large language models (LLMs) drive AI coding agents, the system often needs to concurrently process multiple reading or modification tasks for different versions of the same code repository. For example, Agent A is developing feature F1 based on version V1, while Agent B simultaneously needs to develop feature F2 based on version V1, or Agent C needs to read the code of version V1 as a reference.
[0023] Existing technologies typically manage code workspaces in the following ways: 1. Full Clone: Creates a complete copy of the code repository on disk for each task.
[0024] Drawbacks: Huge I / O overhead; copying GB-level warehouses can cause significant startup delays and consume a large amount of disk space.
[0025] 2. Traditional multi-working directories (such as Git Worktree): Allows the creation of multiple related working trees under the same repository.
[0026] Defects: (1) Lack of state reuse: When a task ends, the working tree is usually idle or manually deleted, lacking an automated "relay" mechanism. (2) Lack of reference isolation: When multiple tasks are modified concurrently, if task A directly reads task B's working directory, it is easy to read "dirty data" in the intermediate state.
[0027] Key pain points of existing technologies: (1) I / O bottleneck: Frequent creation / destruction of the environment makes disk I / O a performance bottleneck, which cannot meet the second-level response requirements of AI intelligent agents.
[0028] (2) Risk of concurrent references (dirty reads): When the development chain forks, the development progress of different branches is inconsistent, and cross-branch references are very likely to cause logical errors or build failures.
[0029] In view of this, embodiments of this application provide a method, apparatus, electronic device, and storage medium for responding to code tasks. The method includes: when the code operation type is a read-write operation, querying the topology registry for the first physical path of a first code workspace instance corresponding to code identification data within the code read-write pool; responding to the target code task according to the first physical path; when the code operation type is a read-only operation, querying the code read-only pool for the second physical path of a frozen reference copy of the code file corresponding to the code identification data, in order to respond to the target code task. This application can reduce the number of times code operation environments are created / destroyed, improve disk I / O efficiency, meet the second-level response requirements of AI agents, avoid conflicts caused by shared build artifacts or dependency caches, and avoid incremental build failures due to compilation logic errors or cross-contamination.
[0030] The following is a detailed description of a computer software engineering and version control technology method provided in the embodiments of this application.
[0031] Reference Figure 1 The diagram shown is a flowchart illustrating a code task response method provided in an embodiment of this application. The exemplary steps of this embodiment are described below: S101 receives request data for the target code task; the request data includes code operation type and code identification data.
[0032] In this application's implementation, the target code task refers to a code operation task issued by a user or intelligent agent, involving reading or writing corresponding code; the target code task's request data refers to the code data information requested under the target code task, i.e., which code needs to be provided. The request data of the target code task is received, and this request data includes the code operation type and code identification data.
[0033] The code operation type characterizes the operation performed on the code by the target code task, and can be either a read-write operation or a read-only operation. The code identifier data characterizes which code the target code task needs to operate on, including the code repository identifier and the target baseline version. The code repository identifier indicates which repository the target code task requires, and the target baseline version indicates which version of the code within the code repository corresponding to that code repository identifier.
[0034] In addition, the request data may include a list of referenced versions, which indicates which versions of code from the corresponding code repository need to be read when executing the target code task. All code operations performed on the requested code in the referenced version list are read-only.
[0035] S102. When the code operation type is a read-write operation, query the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data in the code read-write pool.
[0036] In this embodiment, the read-write pool (RW Pool) is a collection of code workspace instances used to handle mutable operations such as code modification, compilation, and testing. A workspace instance is a file system container with a fixed physical path, used to hold a specific version of code files and provide a compilation and runtime environment. This embodiment also maintains a topology registry to record the real-time mapping relationship between "code version snapshot - code workspace instance - physical path - occupancy status," serving as the basis for responding to code tasks.
[0037] A version snapshot is a static collection of code repository content at a specific point in time (corresponding to a Git commit). It is a logically immutable object, with one version snapshot corresponding to one version of the code file. Therefore, a version snapshot is used to identify the code version corresponding to the code working directory instance. The physical path is the storage location information of the compilation and execution environment of a specific version of the code file on the disk; the occupancy status refers to the usage status of the code working directory instance, indicating whether the identified code working directory instance is being used.
[0038] Specifically, querying the topology registry for the first physical path of the first code workspace instance corresponding to the code identification data within the code read / write pool includes: querying the topology registry for the first physical path of the first code workspace instance corresponding to the code identification data within the code read / write pool, which is in an idle state.
[0039] In this embodiment, the code workspace instance corresponding to the code identification data is queried from the code read / write pool. The code read / write pool may contain multiple code workspace instances corresponding to the code identification data. Some code workspace instances are occupied, while others are idle. The available one is indicated by the occupancy status field. If the occupancy status of a code workspace instance in the topology registry is idle, it means that the code workspace instance is not used to respond to any task, that is, no other user or programming agent is reading or writing the code corresponding to the code workspace instance. Therefore, any code workspace instance with an idle occupancy status among all code workspace instances corresponding to the code identification data is taken as the first code workspace instance. Finally, the physical path of the first code workspace instance is queried from the code read / write pool.
[0040] As can be seen from the implementation process of S102, this application, through the topology registry and code read / write pool, can directly inherit the first code workspace instance corresponding to the code identifier data in the code read / write pool, avoiding copying a code file for each target code task, achieving almost zero-overhead environment readiness, and solving the I / O efficiency problem.
[0041] S103. Respond to the target code task according to the first physical path.
[0042] In this embodiment, the first physical path is returned to the requesting user or programming agent of the target code task so that read and write operations can be performed on the code corresponding to the code identification data within the first code workspace instance at the location corresponding to the first physical path. Simultaneously, the occupancy status of the first code workspace instance in the code read / write pool in the topology registry is set to a locked state to prevent simultaneous use by other code tasks.
[0043] In addition, when the code operation type is a read / write operation, the method also includes: Step 1: If the second physical path is not found in the topology registry, then a physical path is assigned to the code file in the code repository corresponding to the code identifier data to obtain the third physical path.
[0044] In this embodiment, the second physical path may not be found because there is no code workspace instance corresponding to the code identifier data in the topology registry, or because all code workspace instances corresponding to the code identifier data in the topology registry are in a locked state (i.e., all code workspace instances corresponding to the code identifier data are in use). If no second physical path is found, a code workspace instance is used to store code files in the code repository corresponding to the code identifier data in response to the target code task.
[0045] Step 2: Based on the third physical path, add a second code workspace instance to the code read / write pool, corresponding to the code file in the code repository with the code identification data.
[0046] In this embodiment of the application, a new code workspace instance is created for the target code task at the location corresponding to the third physical path, and added to the code read / write pool.
[0047] Step 3: Respond to the target code task based on the third physical path; and register the information of the second code workspace instance in the topology registry based on the third physical path and code identification data.
[0048] In this embodiment, the third physical path is returned to the requesting user or programming agent of the target code task so that read and write operations can be performed on the code corresponding to the code identification data within the second code workspace instance at the location corresponding to the third physical path. Simultaneously, a new data entry is added to the topology registry. The feature value of the code version snapshot field in this data entry, combined with the code identification data, indicates that the feature value of the code workspace instance in this data entry is the second code workspace instance. The feature value of the physical path in this data entry is the third physical path, and the feature value of the occupied status in this data entry is the idle status.
[0049] Here, based on the response process of read and write operations in the aforementioned embodiments of this application, it can be seen that the embodiments of this application optimize the traditional full file copying into incremental state switching, achieving almost zero-overhead environment readiness and solving the I / O efficiency problem.
[0050] Furthermore, when the code operation type is a read / write operation, after the target code task is executed, the method further includes: if the target code task is executed successfully, updating the version information of the code file corresponding to the first code workspace instance in the code read / write pool in the topology registry; and setting the occupancy status of the first code workspace instance in the code read / write pool in the topology registry to an idle state.
[0051] In this embodiment of the application, the successful execution of the target code task indicates that the read and write operation of the code file corresponding to the first code workspace instance has been completed. Therefore, the version information of the code file corresponding to the first code workspace instance has changed, so it is necessary to update the version information (i.e., code version snapshot) of the code file corresponding to the first code workspace instance in the code read and write pool in the topology registry.
[0052] In addition, when the code operation type is a read-write operation, after the target code task is completed, the method further includes: if the target code task fails to execute, then the first code workspace instance in the code read-write pool in the topology registry is processed for failure according to a preset failure handling strategy.
[0053] In this application embodiment, if the target code task fails to execute, it means that the read / write operation of the code file corresponding to the first code workspace instance has failed. In order to avoid code errors, the first code workspace instance in the code read / write pool in the topology registry is processed according to the preset failure handling strategy.
[0054] The preset failure handling strategy can be to roll back the code file corresponding to the first code workspace instance to the code file corresponding to the code identification data, or to mark the first code workspace instance as failed to trigger the physical reclamation operation of the code workspace instance.
[0055] In summary, by using a topology registry to manage the entire lifecycle of all code workspace instances, resources can be safely reclaimed or reused after a task ends or is abnormally interrupted.
[0056] S104. When the code operation type is read-only, query the second physical path of the frozen reference copy of the code file corresponding to the code identification data from the code read-only pool in order to respond to the target code task.
[0057] In this embodiment, the read-only code pool (RO Pool) is a collection of frozen reference copies used to carry out code referencing, retrieval, index building, and other immutable code operations. A frozen reference copy (Frozen Anchor) is a read-only copy of the code file explicitly created in the read-only code pool. The second physical path refers to the physical path of the frozen reference copy of the code file corresponding to the code identification data. The second physical path is returned to the requesting user or programming agent of the target code task so that the code file at the location corresponding to the second physical path can be read.
[0058] In addition, when the code operation type is read-only, the method further includes: if no second physical path is found in the code read-only pool, then a frozen reference copy of the code corresponding to the code identification data is created in the code read-only pool, so that the physical path of the frozen reference copy of the code corresponding to the code identification data is used as the second physical path.
[0059] Here, this application embodiment ensures that cross-version code references always point to a stable version snapshot by using a code read-only pool and frozen reference copies (Frozen Anchor), prohibiting direct reading of the path of any active instance in the RW Pool, completely eliminating the risk of "dirty reads" and solving the problem of concurrent reference security.
[0060] In summary, the embodiments of this application adopt a three-layer architecture of "RW dynamic development layer + RO stable reference layer + topology registration layer": (1) RW Dynamic Development Layer: It is responsible for concurrent code modification and state advancement through topology registry and code read / write pool, supports the inheritance and reuse of code workspace instances, and solves the I / O efficiency problem.
[0061] (2) RO stable reference layer: Through the read-only pool (RO Pool) and frozen reference copy (Frozen Anchor), stable references and deduplication sharing are ensured to guarantee the consistency of cross-path references.
[0062] (3) Topology Registration Layer: Maintain a persistent topology registry to record the real-time mapping relationship of "code version snapshot - code workspace instance - physical path - occupancy status" as the basis for code scheduling decisions.
[0063] Furthermore, referring to Figure 2 The figure shown is an I / O optimization diagram provided in an embodiment of this application. The diagram illustrates how to reuse code workspace instances and solve I / O efficiency problems through the code task response method provided in this embodiment of the application during continuous code development.
[0064] (1) Element definitions in the diagram: Circle A: Initial code version. Circles B and C: Code versions of two different branches evolved in parallel from A. Circle D: Iterative code version evolved from B. Circle E: Iterative code version evolved from C. Box 1: First code workspace instance, bound to a fixed physical path Path-1. Box 2: Second code workspace instance, bound to a fixed physical path Path-2.
[0065] (2) Detailed explanation of each step: Step 1: The initial state of the read / write pool, consisting only of the initial code version A.
[0066] Step 2: When the task in the upper branch requests A, the first code workspace instance is in an idle state. Therefore, a response is made in the first code workspace instance to advance A to B, and the occupancy state of the first code workspace instance is set to locked. While responding to A to B in the first code workspace instance, the task in the lower branch concurrently requests A. However, since the first code workspace instance is in a locked state, a response is not allowed in the first code workspace instance. A second code workspace instance can be created to advance A to C in the second code workspace instance.
[0067] Step 3: When the task in the previous branch requires B to develop D, a query of the topology registry reveals that the first code workspace instance is idle. Therefore, the first code workspace instance is directly reused. This process avoids the I / O overhead of rebuilding the environment, smoothly advancing B to D. When the task in the next branch requires B to develop E, a query of the topology registry reveals that the second code workspace instance is idle. Therefore, the second code workspace instance is directly reused. This process avoids the I / O overhead of rebuilding the environment, smoothly advancing B to E.
[0068] Example 1 (corresponding) Figure 2 The principle of path usage development, scenario: a code repository of 2GB): 1. Initial stage: user initiates task T1 (development features) ) and T2 (development features) All are based on the trunk. Code workspace instance 1 is allocated to T1 in the code read / write pool, and code workspace instance 2 is allocated to T2. After T1 completes its task, the version snapshot of code workspace instance 1 becomes feat- 2. Reuse Phase: User initiates task T3: Based on feat- Bug fixes. A query of the topology registry revealed that code workspace instance 1 met the condition: snapshot version Current_Version==feat- And the status is Idle. Ownership of code workspace instance 1 is transferred to T3. Result: T3 starts immediately, without needing to recopy the 2GB of code. After T3 finishes execution, the code version snapshot of code workspace instance 1 is updated to feat-A-fix.
[0069] Furthermore, referring to Figure 3 The diagram shown is a reference isolation diagram based on a code read-only pool provided in an embodiment of this application. The diagram illustrates how to solve the "dirty read" problem of cross-version references by introducing external anchors when multiple tasks are modified concurrently.
[0070] I. Definition of Diagram Elements: Code Read-Write Pool: Active development area, containing boxes 1 and 2. Code Read-Only Pool: Stable reference area, containing box 3. Circle C': Explicitly frozen reference copy (FrozenAnchor) of version C in the code read-only pool. Circle E: Intermediate dynamics (dirty state) of version C's evolution process in the code read-write pool (box 2).
[0071] II. Definition of line segment and action: (1) L_Develop(B->D): The task in the upper branch (box 1) is developing D from B.
[0072] (2) L_Develop (C->E): The next branch task (box 2) is developing E from C.
[0073] (3) L_Ref_Risk (with X dashed line): The upper branch task attempts to directly reference the lower branch box 2 to obtain version C.
[0074] *Logical Deduction*: Invalid (X). According to the state records of the topology registry, the content of box 2 has been changed to E (or its unusable intermediate dirty state) during development, and physically no longer contains the clean version C. Therefore, logically, consistent data cannot be obtained from here.
[0075] (4) L_Freeze(C->C'): In response to a reference request, freezes a snapshot of the code version C in the read-only code pool, generating a frozen reference copy (C') as shown in box 3. This explicitly solidifies the version state in the read-only region via FORK or Clone operations.
[0076] (5) L_Ref_Safe (with a √ dotted line): The upper branch task is redirected to reference box 3.
[0077] *Logical deduction*: Valid (√). Box 3 is a verified, read-only, and frozen copy of version C, which logically guarantees the stability and correctness of the reference.
[0078] Example 2 (corresponding) Figure 3 The secure reference based on read-only anchors, scenario: Task T_Main is under development and needs to reference the public library configuration of a historical version v1.0): 1. Risk Identification: A code workspace instance R is detected in the RW Pool. Although its code baseline version is v1.0, it is currently being modified by another task T_Side and is in a "dirty" state of "uncommitted". Therefore, T_Main's request to read the code workspace instance R is rejected. 2. Anchor Creation: The RO Pool is queried, and it is found that v1.0 has not yet been cached. A new code workspace instance Anchor-1 is allocated in the RO Pool, and the clean v1.0 code is checked out. 3. Secure Reference: The path of Anchor-1 is returned to T_Main. T_Main successfully reads the configuration. At this point, no matter how T_Side modifies instance R, T_Main can only see the stable content in Anchor-1.
[0079] In summary, the code task response method provided in this application has the following beneficial effects: (1) Significant improvement in I / O efficiency: utilizing multiplexing mechanisms ( Figure 2 In step 3), high-frequency concurrent tasks can reuse existing physical paths, reducing file system operations by more than 90% and significantly reducing agent response latency.
[0080] (2) Reference consistency guarantee: through dual-pool isolation ( Figure 3 The introduction of C's (in Chinese) forces cross-version references to use ROPool, fundamentally eliminating the risk of "dirty reads" and ensuring the stability of builds and tests.
[0081] (3) Maximize resource utilization: Idle resources in the RW pool are reused first, and replicas in the RO pool are globally deduplicated and shared, avoiding waste of disk space.
[0082] Based on the same inventive concept, this application also provides a code task response device corresponding to the code task response method. Since the principle of the device in this application is similar to the code task response method described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0083] Reference Figure 4 The diagram shown is a schematic of a code task response device provided in an embodiment of this application. The device includes: The receiving module 401 is used to receive request data for the target code task; the request data includes code operation type and code identification data; The query module 402 is used to query the first physical path of the first code workspace instance corresponding to the code identifier data in the code read / write pool from the topology registry when the code operation type is a read / write operation; Response module 403 is used to respond to the target code task according to the first physical path; The response module 403 is further configured to, when the code operation type is a read-only operation, query the second physical path of the frozen reference copy of the code file corresponding to the code identification data from the code read-only pool, so as to respond to the target code task.
[0084] In one possible implementation, the query module 402 is specifically used to query from the topology registry the first physical path of the first code workspace instance in the code read / write pool that corresponds to the code identifier data and is in an idle state.
[0085] In one possible implementation, when the code operation type is a read / write operation, the response module 403 is further configured to: If the second physical path is not found in the topology registry, a physical path is assigned to the code file in the code repository corresponding to the code identifier data to obtain the third physical path; Based on the third physical path, a second code workspace instance is added to the code read / write pool, corresponding to the code file in the code repository with the code identification data; The target code task is responded to according to the third physical path; and the second code workspace instance is registered in the topology registry according to the third physical path and the code identification data.
[0086] In one possible implementation, the device further includes a setting module 404, which is configured to, when the code operation type is a read-write operation, after responding to the target code task according to the first physical path, set the occupancy status of the first code workspace instance in the code read-write pool in the topology registry to a locked state.
[0087] In one possible implementation, the device further includes an update module 405, which is used to update the version information of the code file corresponding to the first code workspace instance in the code read / write pool in the topology registry if the target code task is successfully executed after the target code task is completed when the code operation type is a read / write operation.
[0088] In one possible implementation, the device further includes a failure handling module 406, which is used to perform failure handling on the first code workspace instance in the code read / write pool in the topology registry according to a preset failure handling strategy when the code operation type is a read / write operation and the target code task fails after the target code task is executed.
[0089] In one possible implementation, the query module 402 is further configured to, when the code operation type is a read-only operation, create a frozen reference copy of the code corresponding to the code identification data in the read-only code pool if the second physical path is not found in the read-only code pool.
[0090] This application provides a code task response device that can reduce the number of times code operation environments are created / destroyed, improve disk I / O efficiency, meet the second-level response requirements of AI agents, avoid conflicts caused by shared build artifacts or dependency caches, and avoid incremental build failures due to compilation logic errors or cross-contamination.
[0091] like Figure 5 As shown in the embodiment of this application, an electronic device 500 includes a processor 501, a memory 502, and a bus. The memory 502 stores machine-readable instructions executable by the processor 501. When the electronic device is running, the processor 501 communicates with the memory 502 via the bus, and the processor 501 executes the machine-readable instructions to perform the steps of the response method for the code task described above.
[0092] Specifically, the memory 502 and processor 501 mentioned above can be general-purpose memory and processor, without any specific limitations. When the processor 501 runs the computer program stored in the memory 502, it can execute the response method of the above-mentioned code task.
[0093] Corresponding to the above-described code task response method, this application embodiment also provides a computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to perform the steps of the above-described code task response method.
[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.
[0095] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0097] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0098] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A response method for a code task, characterized in that, The method includes: Receive request data for the target code task; the request data includes code operation type and code identification data; When the code operation type is a read-write operation, query the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data in the code read-write pool; The target code task is responded to according to the first physical path; When the code operation type is read-only, the second physical path of the frozen reference copy of the code file corresponding to the code identification data is queried from the code read-only pool in order to respond to the target code task.
2. The response method for code tasks according to claim 1, characterized in that, When the code operation type is a read / write operation, querying the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data within the code read / write pool includes: From the topology registry, query the first physical path of the first code workspace instance in the code read / write pool that corresponds to the code identifier data and is in an idle state.
3. The response method for a code task according to claim 1 or 2, characterized in that, When the code operation type is a read / write operation, the method further includes: If the second physical path is not found in the topology registry, a physical path is assigned to the code file in the code repository corresponding to the code identifier data to obtain the third physical path; Based on the third physical path, a second code workspace instance is added to the code read / write pool, corresponding to the code file in the code repository with the code identification data; The target code task is responded to according to the third physical path; and the second code workspace instance is registered in the topology registry according to the third physical path and the code identification data.
4. The response method for code tasks according to claim 2, characterized in that, When the code operation type is a read / write operation, after responding to the target code task according to the first physical path, the method further includes: Set the occupancy status of the first code workspace instance within the code read / write pool in the topology registry to a locked state.
5. The response method for code tasks according to claim 2, characterized in that, When the code operation type is a read / write operation, after the target code task is executed, the method further includes: If the target code task is executed successfully, the version information of the code file corresponding to the first code workspace instance in the code read / write pool in the topology registry will be updated.
6. The response method for code tasks according to claim 2, characterized in that, When the code operation type is a read / write operation, after the target code task is executed, the method further includes: If the target code task fails to execute, the first code workspace instance in the code read / write pool in the topology registry will be processed according to the preset failure handling strategy.
7. The response method for code tasks according to claim 1, characterized in that, When the code operation type is a read-only operation, the method further includes: If the second physical path is not found in the code read-only pool, a frozen reference copy of the code corresponding to the code identification data is created in the code read-only pool.
8. A response device for a code task, characterized in that, The device includes: A receiving module is used to receive request data from a target code task; the request data includes code operation type and code identification data; The query module is used to query the topology registry for the first physical path of the first code workspace instance corresponding to the code identifier data in the code read / write pool when the code operation type is a read / write operation; A response module is used to respond to the target code task according to the first physical path; The response module is further configured to, when the code operation type is a read-only operation, query the second physical path of the frozen reference copy of the code file corresponding to the code identification data from the code read-only pool, in order to respond to the target code task.
9. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of a response method for a code task as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of a response method for a code task as described in any one of claims 1 to 7.